Skip to content

Commit af91620

Browse files
➕ add set velocity and set angle velocity gates (wiremod#3559)
* ➕ add set velocity and set angle velocity gates * 🔧 fix use clamp in set velocity gates * 🔧 fix angle velocity * Revert "🔧 fix angle velocity" This reverts commit c2b86f4. * 🔧 fix entity_setanglevelocity uses vector input * Copy vectors + small optimization --------- Co-authored-by: Astralcircle <142503363+Astralcircle@users.noreply.github.com>
1 parent f033a0c commit af91620

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

lua/wire/gates/entity.lua

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,4 +1236,36 @@ GateActions["entity_eyepos"] = {
12361236
end
12371237
}
12381238

1239+
GateActions["entity_setanglevelocity"] = {
1240+
name = "Set Angle Velocity",
1241+
inputs = { "Ent", "Vec" },
1242+
inputtypes = { "ENTITY", "VECTOR" },
1243+
timed = true,
1244+
output = function(gate, ent, vec)
1245+
if not isAllowed(gate, ent) then return end
1246+
local phys = ent:GetPhysicsObject()
1247+
if not phys:IsValid() then return end
1248+
phys:SetAngleVelocity(clamp(Vector(vec)))
1249+
end,
1250+
label = function(_, ent, vec)
1251+
return string.format("(%s):setAngleVelocity(%s)", ent, vec)
1252+
end
1253+
}
1254+
1255+
GateActions["entity_setvelocity"] = {
1256+
name = "Set Velocity",
1257+
inputs = { "Ent", "Vec" },
1258+
inputtypes = { "ENTITY", "VECTOR" },
1259+
timed = true,
1260+
output = function(gate, ent, vec)
1261+
if not isAllowed(gate, ent) then return end
1262+
local phys = ent:GetPhysicsObject()
1263+
if not phys:IsValid() then return end
1264+
phys:SetVelocity(clamp(Vector(vec)))
1265+
end,
1266+
label = function(_, ent, vec)
1267+
return string.format("(%s):setVelocity(%s)", ent, vec)
1268+
end
1269+
}
1270+
12391271
GateActions()

0 commit comments

Comments
 (0)