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 --
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 }
@ -60,6 +55,9 @@ VANILLA_INNER={
vanilla_model.LEFT_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 -- {{{
do
@ -98,16 +96,6 @@ do
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.SLOT_1.setTitle('test expression')
action_wheel.SLOT_1.setFunction(function() ping.expressionTest() end)
@ -154,12 +142,23 @@ function syncState()
end
--- Toggle Vanilla ---
function ping.setVanilla(state)
function setVanilla(state)
if state == nil then
vanilla_enabled=not vanilla_enabled
else
vanilla_enabled=state
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
-- 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 --
function tick()
-- optimization, only execute these once a second --
@ -232,7 +243,7 @@ chat.setFiguraCommandPrefix(chat_prefix)
function onCommand(input)
input=splitstring(input)
if input[1] == chat_prefix .. "vanilla" then
ping.setVanilla()
setVanilla()
print("Toggled vanilla skin")
end
if input[1] == chat_prefix .. "toggle_custom" then