Add vanilla toggle function

This commit is contained in:
NullBite 2022-03-19 00:51:12 -04:00
parent b4c71f509d
commit f109c763c1
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -44,11 +44,6 @@ end
-- }}} -- }}}
-- initialize values --
function player_init()
old_health=player.getHealth()
end
-- Parts -- -- Parts --
HEAD=model.Head.Head HEAD=model.Head.Head
VANILLA_OUTER={ vanilla_model.HAT, vanilla_model.JACKET, vanilla_model.LEFT_SLEEVE, vanilla_model.RIGHT_SLEEVE, vanilla_model.LEFT_PANTS_LEG, vanilla_model.RIGHT_PANTS_LEG } VANILLA_OUTER={ vanilla_model.HAT, vanilla_model.JACKET, vanilla_model.LEFT_SLEEVE, vanilla_model.RIGHT_SLEEVE, vanilla_model.LEFT_PANTS_LEG, vanilla_model.RIGHT_PANTS_LEG }
@ -60,6 +55,9 @@ VANILLA_INNER={
vanilla_model.LEFT_LEG, vanilla_model.LEFT_LEG,
vanilla_model.RIGHT_LEG vanilla_model.RIGHT_LEG
} }
VANILLA_ALL={}
for _, v in pairs(VANILLA_INNER) do table.insert(VANILLA_ALL,v) end
for _, v in pairs(VANILLA_OUTER) do table.insert(VANILLA_ALL,v) end
-- Expression change -- {{{ -- Expression change -- {{{
do do
@ -98,16 +96,6 @@ do
end end
-- }}} -- }}}
function setVanilla(state)
end
-- Initial configuration --
for key, value in pairs(vanilla_model) do
value.setEnabled(false)
end
vanilla_model.CAPE.setEnabled(true)
-- Action Wheel & Pings -- {{{ -- Action Wheel & Pings -- {{{
action_wheel.SLOT_1.setTitle('test expression') action_wheel.SLOT_1.setTitle('test expression')
action_wheel.SLOT_1.setFunction(function() ping.expressionTest() end) action_wheel.SLOT_1.setFunction(function() ping.expressionTest() end)
@ -154,12 +142,23 @@ function syncState()
end end
--- Toggle Vanilla --- --- Toggle Vanilla ---
function ping.setVanilla(state) function setVanilla(state)
if state == nil then if state == nil then
vanilla_enabled=not vanilla_enabled vanilla_enabled=not vanilla_enabled
else else
vanilla_enabled=state vanilla_enabled=state
end end
ping.setVanilla(vanilla_enabled)
end
function ping.setVanilla(state)
if not meta.getCanModifyVanilla() then return end
for _, v in pairs(VANILLA_ALL) do
v.setEnabled(state)
end
for _, v in pairs(model) do
v.setEnabled(not state)
end
end end
-- Timer (not mine lol) -- {{{ -- Timer (not mine lol) -- {{{
@ -200,6 +199,18 @@ end
-- }}} -- }}}
-- initialize values --
function player_init()
old_health=player.getHealth()
end
-- Initial configuration --
for key, value in pairs(vanilla_model) do
value.setEnabled(false)
end
vanilla_model.CAPE.setEnabled(true)
-- Tick function -- -- Tick function --
function tick() function tick()
-- optimization, only execute these once a second -- -- optimization, only execute these once a second --
@ -232,7 +243,7 @@ chat.setFiguraCommandPrefix(chat_prefix)
function onCommand(input) function onCommand(input)
input=splitstring(input) input=splitstring(input)
if input[1] == chat_prefix .. "vanilla" then if input[1] == chat_prefix .. "vanilla" then
ping.setVanilla() setVanilla()
print("Toggled vanilla skin") print("Toggled vanilla skin")
end end
if input[1] == chat_prefix .. "toggle_custom" then if input[1] == chat_prefix .. "toggle_custom" then