Add toggle armor function
This commit is contained in:
parent
e5c29d5bbd
commit
71cfc72698
15
script.lua
15
script.lua
@ -8,6 +8,7 @@ step_u_face=32
|
||||
step_v_face=16
|
||||
offset_u_face=64
|
||||
offset_v_face=0
|
||||
armor_enabled=true
|
||||
|
||||
-- initialize values --
|
||||
function player_init()
|
||||
@ -62,6 +63,8 @@ function ping.expressionTest()
|
||||
end
|
||||
action_wheel.SLOT_2.setTitle('log health')
|
||||
action_wheel.SLOT_2.setFunction(function() print(player.getHealth()) end)
|
||||
action_wheel.SLOT_3.setTitle('Toggle Armor')
|
||||
action_wheel.SLOT_3.setFunction(function() ping.setArmor() end)
|
||||
|
||||
-- Pings --
|
||||
--- Damage function --
|
||||
@ -75,6 +78,18 @@ end
|
||||
function ping.healed(health)
|
||||
setExpression(0,0)
|
||||
end
|
||||
--- Toggle Armor ---
|
||||
function ping.setArmor(enabled)
|
||||
if enabled == nil then
|
||||
armor_enabled=not armor_enabled
|
||||
else
|
||||
armor_enabled=enabled
|
||||
end
|
||||
|
||||
for key, value in pairs(armor_model) do
|
||||
value.setEnabled(armor_enabled)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- does not work on multiplayer, use ping.oof()
|
||||
|
Loading…
x
Reference in New Issue
Block a user