Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onLoad()
- gameBox = getObjectFromGUID(Global.getTable('bags').gameBox.guid)
- end
- function showMenu(player, value, id)
- local found = value:find("|")
- if found == nil then
- Global.UI.show(value)
- else
- Global.UI.hide(value:sub(found + 1))
- Global.UI.show(value:sub(1, found - 1))
- end
- end
- function closeMenu(player, value, id)
- Global.UI.hide(value)
- end
- function campaign(player, value, id)
- local campaigns = {}
- local bag_toLoad = nil
- campaigns["People of the Bloom"] = {lang_toLoad = "Language", deck_toLoad_1 = "Starting Innovation Deck", deck_toLoad_2 = "Consequences"}
- campaigns["People of the Dark"] = {lang_toLoad = "Language", deck_toLoad_1 = "Starting Innovation Deck", deck_toLoad_2 = "Consequences"}
- campaigns["People of the Lantern"] = {lang_toLoad = "Language", deck_toLoad_1 = "Starting Innovation Deck", deck_toLoad_2 = "Consequences"}
- campaigns["People of the Skull"] = {lang_toLoad = "Language", deck_toLoad_1 = "Starting Innovation Deck", deck_toLoad_2 = "Consequences"}
- campaigns["People of the Soil"] = {lang_toLoad = "Language", deck_toLoad_1 = "Starting Innovation Deck", deck_toLoad_2 = "Consequences"}
- campaigns["People of the Stars"] = {lang_toLoad = "Dragon Speech", deck_toLoad_1 = "Starting Innovation Deck (Stars)", deck_toLoad_2 = "Consequences (Stars)"}
- campaigns["People of the Sun"] = {lang_toLoad = "Sun Language", deck_toLoad_1 = "Starting Innovation Deck (Other)", deck_toLoad_2 = "Consequences (Sun)"}
- broadcastToAll("Loading...", {1, 1, 1})
- for _, obj in ipairs(gameBox.getObjects()) do
- local name = obj.name
- if name == value then
- bag_toLoad = gameBox.takeObject({
- position = {26.07, 1.91, - 4.89},
- rotation = {0, 0, 0},
- guid = obj.guid,
- smooth = false
- })
- end
- if obj.name == campaigns[value].deck_toLoad_1 then
- gameBox.takeObject({position = { - 60.96, 3.5, - 11.91}, rotation = {0.00, 180.07, 180.00}, guid = obj.guid, smooth = false})
- elseif obj.name == campaigns[value].deck_toLoad_2 then
- gameBox.takeObject({position = { - 83.76, 3.5, - 11.91}, rotation = {0.00, 180.07, 180.00}, guid = obj.guid, smooth = false})
- elseif obj.name == campaigns[value].lang_toLoad then
- gameBox.takeObject({position = { - 72.30, 9.00, 24.91}, rotation = {8.12, 179.98, 0.00}, guid = obj.guid, smooth = false})
- end
- end
- if bag_toLoad == nil then
- broadcastToAll(value .. " Box not found!", {1, 0, 0})
- else
- Wait.condition(function() get_from_campaign(bag_toLoad) end, function() return checkLoaded(bag_toLoad) end)
- end
- end
- function get_from_campaign(bag_toLoad)
- local terrainOffset = 1
- local strangeOffset = 1
- for _, obj in pairs(bag_toLoad.getObjects()) do
- local name = obj.name
- local desc = obj.description
- if name == "Lantern Hoard"
- or name == "Skull Totem"
- or name == "Forest Gate"
- or name == "Throne"
- or name == "The Sun"
- or name == "Thorny Mangrove"
- or name == "Sacred Grove" then
- bag_toLoad.takeObject({position = {72.28, 4.48, - 2.20}, rotation = {11.11, 179.97, 179.99}, guid = obj.guid, smooth = false})
- elseif string.find(name, "Survivor Bag") then
- bag_toLoad.takeObject({position = {0.00, 2.56, - 45.00}, rotation = {17.60, 179.94, 359.98}, guid = obj.guid, smooth = false}).lock()
- elseif string.find(name, "P1") then
- bag_toLoad.takeObject({position = { - 33.20, 1.63, - 35.90}, rotation = {3.12, 179.85, 359.99}, guid = obj.guid, smooth = false})
- elseif string.find(name, "P2") then
- bag_toLoad.takeObject({position = { - 15.88, 1.63, - 35.90}, rotation = {3.12, 179.85, 359.99}, guid = obj.guid, smooth = false})
- elseif string.find(name, "P3") then
- bag_toLoad.takeObject({position = {11.28, 1.63, - 35.90}, rotation = {3.12, 179.85, 359.99}, guid = obj.guid, smooth = false})
- elseif string.find(name, "P4") then
- bag_toLoad.takeObject({position = {28.31, 1.63, - 35.90}, rotation = {3.12, 179.85, 359.99}, guid = obj.guid, smooth = false})
- elseif string.find(name, "Unamed Settlement") then
- bag_toLoad.takeObject({position = { - 0.28, 16.76, 63.78}, rotation = {32.00, 180.00, 0.00}, guid = obj.guid, smooth = false}).lock()
- end
- if string.find(desc, "terrain") then
- terr_pos = {x = 23.79, y = -8.79, z = -104.54}
- bag_toLoad.takeObject({
- position = {terr_pos.x, terr_pos.y + terrainOffset, terr_pos.z},
- rotation = {0, 180, 180},
- smooth = false,
- guid = obj.guid
- })
- terrainOffset = terrainOffset + 1
- end
- if string.find(desc, "strange") then
- strange_pos = {x = 76.77, y = 3.00, z = -10.14}
- bag_toLoad.takeObject({
- position = {strange_pos.x, strange_pos.y + strangeOffset, strange_pos.z},
- rotation = {0, 180, 180},
- smooth = false,
- guid = obj.guid
- })
- strangeOffset = strangeOffset + 1
- end
- end
- broadcastToAll(bag_toLoad.getName() .. " Loaded", {1, 1, 1})
- bag_toLoad.destruct()
- end
- function expansion(player, value, id)
- local bag_toLoad = nil
- for _, obj in ipairs(gameBox.getObjects()) do
- local name = obj.name
- if name == value then
- bag_toLoad = gameBox.takeObject({
- position = {26.07, 1.91, - 4.89},
- rotation = {0, 0, 0},
- guid = obj.guid,
- smooth = false
- })
- end
- end
- if bag_toLoad == nil then
- broadcastToAll(value .. " Box not found!", {1, 0, 0})
- else
- Wait.condition(function() get_from_expansion(bag_toLoad) end, function() return checkLoaded(bag_toLoad) end)
- end
- end
- function get_from_expansion(bag_toLoad)
- local offsets = {disorder = 1, fa = 1, sfa = 1, strange = 1, innovation = 1, terrain = 1, tactics = 1, se = 1}
- local dis_pos = {x = -1.1, y = 2, z = -54.92}
- local fa_pos = {x = 1.09, y = 2, z = -54.92}
- local sfa_pos = {x = 3.29, y = 2, z = -54.92}
- local strange_pos = {x = 76.77, y = 2.00, z = -10.14}
- local inn_pos = {x = -83.71, y = 3.14, z = -11.84}
- local terr_pos = {x = 23.79, y = -8.59, z = -104.54}
- local tact_pos = {x = -5.56, y = 2.00, z = -53.03}
- local se_pos = {x = -79.26, y = 8.43, z = 19.67}
- for _, obj in ipairs(bag_toLoad.getObjects()) do
- local name = obj.name
- local desc = obj.description
- print(name)
- if string.find(desc, "disorder") then
- bag_toLoad.takeObject({
- position = {dis_pos.x, dis_pos.y + offsets.disorder, dis_pos.z},
- rotation = {0, 180, 0},
- smooth = false,
- guid = obj.guid
- })
- offsets.disorder = offsets.disorder + 1
- elseif string.find(desc, "fighting art") then
- bag_toLoad.takeObject({
- position = {fa_pos.x, fa_pos.y + offsets.fa, fa_pos.z},
- rotation = {0, 180, 0},
- smooth = false,
- guid = obj.guid
- })
- offsets.fa = offsets.fa + 1
- elseif string.find(desc, "secret fighting art") then
- bag_toLoad.takeObject({
- position = {fa_pos.x, fa_pos.y + offsets.sfa, fa_pos.z},
- rotation = {0, 180, 0},
- smooth = false,
- guid = obj.guid
- })
- offsets.sfa = offsets.sfa + 1
- elseif string.find(desc, "strange") then
- bag_toLoad.takeObject({
- position = {strange_pos.x, strange_pos.y + offsets.strange, strange_pos.z},
- rotation = {0, 180, 180},
- smooth = false,
- guid = obj.guid
- })
- offsets.strange = offsets.strange + 1
- elseif string.find(desc, "innovation") then
- bag_toLoad.takeObject({
- position = {inn_pos.x, inn_pos.y + offsets.innovation, inn_pos.z},
- rotation = {0, 180, 180},
- smooth = false,
- guid = obj.guid
- })
- offsets.innovation = offsets.innovation + 1
- elseif string.find(desc, "terrain") then
- bag_toLoad.takeObject({
- position = {terr_pos.x, terr_pos.y + offsets.terrain, terr_pos.z},
- rotation = {0, 180, 180},
- smooth = false,
- guid = obj.guid
- })
- offsets.terrain = offsets.terrain + 1
- elseif string.find(desc, "tactics") then
- bag_toLoad.takeObject({
- position = {tact_pos.x, tact_pos.y + offsets.tactics, tact_pos.z},
- rotation = {0, 180, 180},
- smooth = false,
- guid = obj.guid
- })
- offsets.tactics = offsets.tactics + 1
- elseif desc == "settlement event" then
- bag_toLoad.takeObject({
- position = {se_pos.x, se_pos.y + offsets.se, se_pos.z},
- rotation = {10.89, 180, 180},
- smooth = false,
- guid = obj.guid
- })
- offsets.se = offsets.se + 1
- -- loads Gorm Climate next to SE deck
- elseif desc == "settlement event 2" then
- bag_toLoad.takeObject({
- position = { - 75.94, 7.37, 19.66},
- rotation = {10.89, 180, 0},
- smooth = false,
- guid = obj.guid
- })
- end
- end
- local event_label_rot = {32.00, 180.00, 0.00}
- for _, obj in ipairs(bag_toLoad.getObjects()) do
- local name = obj.name
- if name == "The Approaching Storm" then
- bag_toLoad.takeObject({position = { - 4.11, 21.67, 72.63}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "Young Rivals" then
- bag_toLoad.takeObject({position = { - 4.13, 21.42, 72.01}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "A Crone's Tale" then
- bag_toLoad.takeObject({position = { - 4.65, 20.46, 70.57}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "The Hanged Man" then
- bag_toLoad.takeObject({position = { - 1.03, 20.46, 70.57}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "It's Already Here" then
- bag_toLoad.takeObject({position = { - 6.39, 20.10, 70.11}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "An Uninvited Guest" then
- bag_toLoad.takeObject({position = { - 2.68, 20.10, 70.11}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "Glowing Crater" then
- bag_toLoad.takeObject({position = { - 7.11, 19.46, 69.10}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "Promise Under the Sun" then
- bag_toLoad.takeObject({position = { - 3.55, 19.46, 69.10}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "Rumbling in the Dark" then
- bag_toLoad.takeObject({position = {0.06, 19.46, 69.10}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "Silver City" then
- bag_toLoad.takeObject({position = { - 1.97, 17.90, 66.55}, rotation = event_label_rot, smooth = false, guid = obj.guid}).lock()
- elseif name == "Object of Desire" then
- bag_toLoad.takeObject({position = {24.93, 0.99, - 14.32}, rotation = {0, 180, 180}, smooth = false, guid = obj.guid})
- end
- end
- end
- function promo(player, value, id)
- print(value)
- end
- function theme(player, value, id)
- local objs = getAllObjects()
- for _, obj in ipairs(objs) do
- if obj.getDescription() ~= nil then
- if string.find(obj.getDescription(), "theme") then
- obj.AssetBundle.playLoopingEffect(tonumber(value))
- end
- end
- end
- local tok = getObjectFromGUID(Global.getTable('user_settings').current_theme.guid)
- tok.setDescription(value)
- end
- function font(player, value, id)
- local fonts = {Croz = 0, Duer = 1, Gob = 2, God = 3, Haunt = 4, Hit = 5, Just = 6, Mag = 7, Mid = 8, Morph = 9, Pap = 10, Silv = 11, Star = 12, Stone = 13}
- local bag = getObjectFromGUID(Global.getTable('bags').fontBox.guid)
- local objs = getAllObjects()
- local states = {reaction = 0, wound = 0}
- for _, obj in ipairs(objs) do
- local desc = obj.getDescription()
- local name = obj.getName()
- if string.find(desc, "font") then
- if string.find(name, "Reactions") then
- states.reaction = obj.AssetBundle.getLoopingEffectIndex()
- bag.putObject(obj)
- elseif string.find(name, "Wound") then
- states.wound = obj.AssetBundle.getLoopingEffectIndex()
- bag.putObject(obj)
- else
- obj.AssetBundle.playLoopingEffect(fonts[value])
- end
- end
- end
- Wait.time(
- function()
- for _, font in ipairs(bag.getObjects()) do
- if string.find(font.name, value) then
- if string.find(font.name, "Wounds") then
- local obj = bag.takeObject({position = {0, 0.8, 0}, rotation = {0, 0, 0}, smooth = false, guid = font.guid})
- obj.lock()
- Wait.condition(function() obj.AssetBundle.playLoopingEffect(states.wound) end, function() return checkLoaded(obj) end)
- elseif string.find(font.name, "Reactions") then
- local obj = bag.takeObject({position = {0, 0.8, 0}, rotation = {0, 0, 0}, smooth = false, guid = font.guid})
- obj.lock()
- Wait.condition(function() obj.AssetBundle.playLoopingEffect(states.reaction) end, function() return checkLoaded(obj) end)
- end
- end
- end
- end,
- 1)
- local tok = getObjectFromGUID(Global.getTable('user_settings').current_font.guid)
- tok.setDescription(fonts[value])
- -- local zone = getObjectFromGUID(Global.getTable('zonesDestruct').zoneShowdown.guid)
- -- for _, font in ipairs(zone.getObjects()) do
- --
- -- end
- end
- function gameMode(player, value, id)
- local current_difficulty = getObjectFromGUID(Global.getTable('user_settings').current_mode.guid)
- if value == "Easy Mode" then
- -- monster starts showdown with 2 wounds
- -- extra resources
- -- survivors die at 7 bleeding tokens instead of 5
- extraBleed1 = "d7a48a"
- extraBleed2 = "4de12c"
- extraBleed3 = "e51595"
- extraBleed4 = "a40619"
- remove_death_mode_irreplaceable()
- current_difficulty.setDescription("easy mode")
- elseif value == "Quick Mode" then
- -- each survivor starts with +1 str -- in function add
- -- monster starts with +1 dmg at start of showdown -- in function startShowdown
- -- survivors die when they have 3 bleeding tokens -- in function onObjectEnterZone > on common grid code
- -- when the monster suffers a wound it suffers an additional wound -- NOT DONE YET
- remove_death_mode_irreplaceable()
- current_difficulty.setDescription("quick mode")
- elseif value == "Death Mode" then
- -- all gear is irreplaceable -- in function onObjectEnterZone > on common grid code
- -- monster gains +1 dmg at start of showdown -- in function startShowdown
- current_difficulty.setDescription("death mode")
- elseif value == "Hero Mode" then
- end
- end
- function remove_death_mode_irreplaceable()
- -- Iterate over all player zones
- local playerZones = {
- red = getObjectFromGUID(Global.getTable('zones').zoneP1.guid),
- yellow = getObjectFromGUID(Global.getTable('zones').zoneP2.guid),
- green = getObjectFromGUID(Global.getTable('zones').zoneP3.guid),
- blue = getObjectFromGUID(Global.getTable('zones').zoneP4.guid)
- }
- for zoneKey, zoneGUIDtable in pairs(playerZones) do
- local zoneGUID = zoneGUIDtable.guid
- local zone = getObjectFromGUID(zoneGUID)
- local objectsInZone = zone.getObjects()
- for _, obj in ipairs(objectsInZone) do
- local desc = obj.getDescription()
- if string.find(desc, "death mode irreplaceable") then
- local new_desc = string.gsub(desc, "death mode irreplaceable", "")
- obj.setDescription(new_desc)
- end
- end
- end
- end
- function avatar(player, value, id)
- print(value)
- end
- function sigil(player, value, id)
- print(value)
- end
- function lighting(player, value, id)
- local found = value:find("|")
- if found == nil then
- return
- end
- local lightBox = getObjectFromGUID(Global.getTable('bags').lightBox.guid)
- local zoneShowdown = getObjectFromGUID(Global.getTable('zonesDestruct').zoneShowdown.guid)
- local gameBox = getObjectFromGUID(Global.getTable('bags').gameBox.guid)
- local category = value:sub(1, found - 1)
- local option = value:sub(found + 1)
- local pos = lightBox.getPosition()
- if category == "main" then
- store_current_light("Main Lighting Color")
- for _, light in ipairs(lightBox.getObjects()) do
- if light.name == option
- and string.find(light.description, option) then
- main_light = lightBox.takeObject({
- position = {pos.x, pos.y + 10, pos.z},
- rotation = {0, 0, 0},
- smooth = false,
- guid = light.guid,
- })
- set_light_position(main_light)
- end
- end
- broadcastToAll("Main Lights set to " .. option, {1, 1, 1})
- elseif category == "dice" then
- store_current_light("Dice Tray Lighting Color")
- for _, light in ipairs(lightBox.getObjects()) do
- if light.name == option
- and string.find(light.description, option) then
- main_light = lightBox.takeObject({
- position = {pos.x, pos.y + 10, pos.z},
- rotation = {0, 0, 0},
- smooth = false,
- guid = light.guid,
- })
- set_light_position(main_light)
- end
- end
- broadcastToAll("Dice Tray Lights set to " .. option, {1, 1, 1})
- elseif category == "lighting" then
- broadcastToAll("Lighting is Turned " .. option, {1,1,1})
- if option == "off" then
- for _, light in ipairs(zoneShowdown.getObjects()) do
- if string.find(light.getDescription(), "light bundle") then
- light.setPosition({pos.x, pos.y + 2, pos.z})
- lightBox.putObject(light)
- end
- end
- else
- -- Lighting on HERE
- end
- elseif category == "effects" then
- -- Effects on and off--- on and off is in the option variable
- end
- end
- function store_current_light(light_toStore)
- local zoneShowdown = getObjectFromGUID(Global.getTable('zonesDestruct').zoneShowdown.guid)
- local lightBox = getObjectFromGUID(Global.getTable('bags').lightBox.guid)
- local pos = lightBox.getPosition()
- for _, light in ipairs(zoneShowdown.getObjects()) do
- if light.getName() == light_toStore and string.find(light.getDescription(), "light bundle") then
- light.setPosition({pos.x, pos.y + 2, pos.z})
- lightBox.putObject(light)
- end
- end
- end
- function set_light_position(main_light)
- if main_light ~= nil then
- local current_phase = getObjectFromGUID(Global.getTable('user_settings').current_phase.guid)
- main_light.setPosition({0,0.8,0})
- main_light.setLock(true)
- if main_light.getName() == "Main Lighting Color" then
- local desc = current_phase.getDescription()
- if desc == "hunt phase" then
- main_light.AssetBundle.playLoopingEffect(1)
- elseif desc == "showdown phase" then
- main_light.AssetBundle.playLoopingEffect(2)
- elseif desc == "settlement phase" then
- main_light.AssetBundle.playLoopingEffect(3)
- else
- main_light.AssetBundle.playLoopingEffect(0)
- end
- elseif main_light.getName() == "Dice Tray Lighting Color" then
- main_light.AssetBundle.playLoopingEffect(0)
- end
- end
- end
- -- Check if an object is fully loaded
- function checkLoaded(obj)
- if not obj.loading_custom and not obj.spawning then
- return true
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement