ah_sce_unpacked/unpacked/Checker_white Displacement Tool 0f1374.ttslua
2022-03-27 10:12:31 -04:00

63 lines
1.4 KiB
Plaintext

---
--- Generated by Luanalysis
--- Created by Whimsical.
--- DateTime: 2022-01-21 1:39 p.m.
---
function onload()
self:getRotation(Vector(0, 270, 0))
end
local excluded = {
["b7b45b"] = true,
["f182ee"] = true,
["721ba2"] = true
}
---@type table<string, table<string, any>>
local OFFSETS = {
left = {
axis = "z",
offset = 7.67
},
right = {
axis = "z",
offset = -7.67
},
up = {
axis = "x",
offset = 6.54
},
down = {
axis = "x",
offset = -6.54
}
}
---@param player Player
---@param direction string
function shift(player, direction)
if self:getDescription()=="" then
player:broadcast("The description of the displacement tool must contain (only) the GUID for a scripting zone that contains the play field.", Color.RED)
return
end
local zone = getObjectFromGUID(self:getDescription())
local offset = OFFSETS[direction]
if not zone then
player:broadcast("The description of the displacement tool either contains text that is not a GUID or contains a GUID for a scripting zone that does not exist.", Color.RED)
return
end
local adjustment = Vector(0, 0, 0)
adjustment[offset.axis] = offset.offset
---@param object TTSObject
for _, object in ipairs(zone:getObjects()) do
if not (excluded[object:getGUID():lower()] or object:hasTag("displacement_excluded")) then
object:translate(adjustment)
end
end
end