Add toggle armor function

This commit is contained in:
NullBite 2021-12-27 10:41:07 -05:00
parent e5c29d5bbd
commit 71cfc72698
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -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()