You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
split AffectSelf into two to distinguish between player owner and root owner (e.g. projectiles)
for backward compatibility, AffectSelf will still act as both by default, but with AlternateAffectSelf the split occurs. you can then use AffectPlayerOwner to affect your player, and AffectSelf to affect the root part owner separately
Copy file name to clipboardExpand all lines: lua/pac3/core/client/parts/force.lua
+18-6Lines changed: 18 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,9 @@ Radial gets the base directions from the targets to the force part]]})
67
67
:GetSet("DampingReverseFalloff", false, {description="Whether the damping should fade with distance but reverse (closer is weaker influence)"})
68
68
69
69
:SetPropertyGroup("Targets")
70
-
:GetSet("AffectSelf",false)
70
+
:GetSet("AffectSelf", false, {description="Affect Root Owner (i.e. it can be a projectile entity)"})
71
+
:GetSet("AlternateAffectSelf", false, {description="'Affect Self' was split into two. For backward compatibility reasons, this must be a setting.\nif this is off, affect self will affect both player owner and root owner, which may not be desired"})
72
+
:GetSet("AffectPlayerOwner", false)
71
73
:GetSet("Players",true)
72
74
:GetSet("PhysicsProps", true)
73
75
:GetSet("PointEntities",true, {description="other entities not covered by physics props but with potential physics"})
@@ -85,6 +87,9 @@ end
85
87
functionPART:Initialize()
86
88
self.next_impulse=CurTime() +0.05
87
89
ifnotGetConVar("pac_sv_force"):GetBool() orpac.Blocked_Combat_Parts[self.ClassName] thenself:SetError("force parts are disabled on this server!") end
90
+
timer.Simple(0, function()
91
+
self.initialized=true
92
+
end)
88
93
end
89
94
90
95
functionPART:OnShow()
@@ -213,9 +218,6 @@ local function ProcessForcesList(ents_hits, tbl, pos, ang, ply)
ifpre_excluded_ent_classes[v:GetClass()] or (Is_NPC(v) andnottbl.NPC) or (v:IsPlayer() andnottbl.Playersandnot (v==plyandtbl.AffectSelf)) thenents_hits[i] =nil
if (nottbl.AffectSelf) andv==tbl.RootPartOwnerthenents_hits[i] =nilend
1324
+
end
1325
+
1326
+
ifpre_excluded_ent_classes[v:GetClass()] or (Is_NPC(v) andnottbl.NPC) or (v:IsPlayer() andnottbl.Playersandnot (v==plyandtbl.AffectPlayerOwner)) thenents_hits[i] =nil
0 commit comments