forked from mrkubax10/industrialtest
Move addYVelocityClamped to common API
This commit is contained in:
@@ -41,6 +41,15 @@ function industrialtest.internal.clamp(num,min,max)
|
||||
return math.max(math.min(num,max),min)
|
||||
end
|
||||
|
||||
function industrialtest.internal.addYVelocityClamped(player,vel,max)
|
||||
local playerVel=player:get_velocity()
|
||||
if playerVel.y+vel>max then
|
||||
player:add_velocity(vector.new(0,math.max(max-playerVel.y,0),0))
|
||||
else
|
||||
player:add_velocity(vector.new(0,vel,0))
|
||||
end
|
||||
end
|
||||
|
||||
function industrialtest.internal.unpackTableInto(first,second)
|
||||
for k,v in pairs(second) do
|
||||
first[k]=v
|
||||
|
||||
Reference in New Issue
Block a user