From 9d81fa18856241ed0931dd5f05cb3a00d9a99167 Mon Sep 17 00:00:00 2001 From: NullBite Date: Mon, 3 Oct 2022 22:47:13 -0400 Subject: [PATCH] Add code for trust warning (doesn't work yet) Turns out, untrusted players cannot modify the nameplate, completely breaking the way this was intended to work. I'll model a sign or something in Blockbench that will float above the player's head. --- script.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/script.lua b/script.lua index 575c27d..7db379c 100644 --- a/script.lua +++ b/script.lua @@ -703,6 +703,36 @@ end SNORES={"snore-1", "snore-2", "snore-3"} -- }}} +-- Initial Trust Warning {{{ +do + local function deregister_trust_tick() + nameplate.ENTITY:setText(player:getName()) + nameplate.ENTITY:setBackgroundColor(vec(0,0,0)) + events.TICK:remove("trust_warning") + end + + local function trust_tick() + if world.getTimeOfDay() % 20 == 0 then + if avatar:canEditVanillaModel() then + deregister_trust_tick() + elseif world.getTimeOfDay() % 40 == 0 then + nameplate.ENTITY:setBackgroundColor(vec(0,0,0)) + else + nameplate.ENTITY:setBackgroundColor(vec(1,1,0)) + end + end + end + + events.ENTITY_INIT:register(function () + if not avatar:canEditVanillaModel() then + nameplate.ENTITY:setText("[PLEASE UPDATE TRUST]\n" .. player:getName()) + events.TICK:register(trust_tick, "trust_warning") + end + events.ENTITY_INIT:remove("trust_init") + end, "trust_init") +end +-- }}} + -- Expression change -- {{{ do local expressions={}