From eb0fcf6473783be7d7a5ff78bd28977387fadfc6 Mon Sep 17 00:00:00 2001 From: TheDarkBatman <87569239+TheDarkBatman2@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:48:38 +0330 Subject: [PATCH 1/6] initial idea implemented --- Lua/config/baseconfig.lua | 1 + Lua/config/pointshop/clown.lua | 23 ++++++-- Lua/config/randomevents/wombocombo.lua | 82 ++++++++++++++++++++++++++ Lua/language/english.lua | 3 + 4 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 Lua/config/randomevents/wombocombo.lua diff --git a/Lua/config/baseconfig.lua b/Lua/config/baseconfig.lua index 6d6eaa7e..9b6609c3 100644 --- a/Lua/config/baseconfig.lua +++ b/Lua/config/baseconfig.lua @@ -312,6 +312,7 @@ config.RandomEventConfig = { dofile(Traitormod.Path .. "/Lua/config/randomevents/prisoner.lua"), dofile(Traitormod.Path .. "/Lua/config/randomevents/randomlights.lua"), dofile(Traitormod.Path .. "/Lua/config/randomevents/clownmagic.lua"), + dofile(Traitormod.Path .. "/Lua/config/randomevents/wombocombo.lua"), } } diff --git a/Lua/config/pointshop/clown.lua b/Lua/config/pointshop/clown.lua index 96b9c91a..9844af0d 100644 --- a/Lua/config/pointshop/clown.lua +++ b/Lua/config/pointshop/clown.lua @@ -2,11 +2,11 @@ local category = {} category.Identifier = "clown" category.Decoration = "cultist" -category.FadeToBlack = true +-- category.FadeToBlack = true -category.CanAccess = function(client) - return client.Character and not client.Character.IsDead and Traitormod.RoleManager.HasRole(client.Character, "Clown") -end +-- category.CanAccess = function(client) +-- return client.Character and not client.Character.IsDead and Traitormod.RoleManager.HasRole(client.Character, "Clown") +-- end category.Init = function () local spawnInstallation = function (submarine, position, prefab) @@ -233,6 +233,21 @@ category.Products = { Items = {"detonator"}, }, + { + Identifier = "wombocombo", + Price = 450, + Limit = 4, + IsLimitGlobal = true, + + CanBuy = function (client, product) + return not Traitormod.RoundEvents.IsEventActive("WomboCombo") + end, + + Action = function () + Traitormod.RoundEvents.TriggerEvent("WomboCombo") + end + }, + { Identifier = "clownmagic", Price = 450, diff --git a/Lua/config/randomevents/wombocombo.lua b/Lua/config/randomevents/wombocombo.lua new file mode 100644 index 00000000..6a97fea4 --- /dev/null +++ b/Lua/config/randomevents/wombocombo.lua @@ -0,0 +1,82 @@ +local event = {} + +event.Name = "WomboCombo" +event.ChancePerMinute = 0 +event.OnlyOncePerRound = true + +event.Time = 1 + +event.FlickerAmount = 3 -- one cycle of On and Off + +event.Lights = {} -- (key=item, value=originalLightComponentColor) + +event.Start = function () + + -- Applying afflications + local function GiveWombo(character) + if character.Submarine ~= Submarine.MainSub then return end + if character.IsDead then return end + + local poison = AfflictionPrefab.Prefabs["deliriuminepoisoning"] + character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, poison.Instantiate(100)) + local psychosis = AfflictionPrefab.Prefabs["psychosis"] + character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, psychosis.Instantiate(100)) + local hallucination = AfflictionPrefab.Prefabs["hallucinating"] + character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, hallucination.Instantiate(100)) + end + for key, value in pairs(Character.CharacterList) do + GiveWombo(value) + end + + + -- Disabling comms + if not Traitormod.RoundEvents.IsEventActive("CommunicationsOffline") then + Traitormod.RoundEvents.TriggerEvent("CommunicationsOffline") + end + + + -- Finding all LightComponents and their original color + for k, v in pairs(Submarine.MainSub.GetItems(true)) do + local c = v.GetComponentString('LightComponent') + if c and not v.Prefab.CanBeBought then + event.Lights[v] = c.LightColor + end + end + + -- turn lights off and on depending on the current flickering state + local function setlightscolor(color) + for item, originalColor in pairs(event.Lights) do + Timer.Wait(function () + local c = item.GetComponentString('LightComponent') + -- if color is nil it will revert it back to the original color + c.LightColor = color or originalColor + local prop = c.SerializableProperties[Identifier("LightColor")] + Networking.CreateEntityEvent(item, Item.ChangePropertyEventData(prop, c)) + end, math.random(0, 1000)) -- delay shouldnt be greater then Time/(FlickerAmount*2) + end + end + + -- flicker the lights + for i = 0, event.FlickerAmount-1, 1 do + Timer.Wait( + function() + setlightscolor(Color(0, 0, 0, 128)) + + Timer.Wait(function() + setlightscolor(nil) + end, event.Time/event.FlickerAmount * 60000 / 2) + end, i * event.Time/event.FlickerAmount * 60000) + end + + -- end this event + Timer.Wait(event.End, event.Time * 60000) +end + + +event.End = function () + for item, _ in pairs(event.Lights) do + event.Lights[item] = nil + end +end + +return event \ No newline at end of file diff --git a/Lua/language/english.lua b/Lua/language/english.lua index d04dc148..3bd669f6 100644 --- a/Lua/language/english.lua +++ b/Lua/language/english.lua @@ -180,6 +180,8 @@ language.WreckPirate = "There have been reports about a notorious pirate with a language.PirateInside = "Attention! A dangerous PUCS pirate has been detected inside the main submarine!" language.PirateKilled = "The PUCS pirate has been killed, the crew has received a reward of %s points." +language.WomboCombo = "Your mind is shattering into fragments of emptiness and your soul is imploding on itself." +language.WomboCombo = "Then Clown said, “Let there be chaos,” and there was chaos." language.ClownMagic = "You feel a strange sensation, and suddenly you're somewhere else." language.CommunicationsOffline = "Something is interfering with all our communications systems. It's been estimated that communications will be offline for atleast %s minutes." language.CommunicationsBack = "Communications are back online." @@ -256,6 +258,7 @@ language.Pointshop = { clowntalenttree = "Clown Talent Tree", invisibilitygear = "Invisibility Gear", clownmagic = "Clown Magic (Randomly swaps places of people)", + wombocombo = "Wombo Combo (Causes chaos)", randomizelights = "Randomize Lights", fuelrodlowquality = "Low Quality Fuel Rod", gardeningkit = "Gardening Kit", From 8bae315913a5dcccc4e731322cd1bcb346421f5d Mon Sep 17 00:00:00 2001 From: TheDarkBatman <87569239+TheDarkBatman2@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:57:02 +0330 Subject: [PATCH 2/6] you cant activate wombo combo when other light related events are active to avoid bugs --- Lua/config/pointshop/clown.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lua/config/pointshop/clown.lua b/Lua/config/pointshop/clown.lua index 9844af0d..3f339123 100644 --- a/Lua/config/pointshop/clown.lua +++ b/Lua/config/pointshop/clown.lua @@ -240,7 +240,10 @@ category.Products = { IsLimitGlobal = true, CanBuy = function (client, product) - return not Traitormod.RoundEvents.IsEventActive("WomboCombo") + return not (Traitormod.RoundEvents.IsEventActive("WomboCombo") or + Traitormod.RoundEvents.IsEventActive("CommunicationsOffline") or + Traitormod.RoundEvents.IsEventActive("RandomLights") or + Traitormod.RoundEvents.IsEventActive("LightsOff")) end, Action = function () From eb33773121916668aa84d5c4c2dd202740355cca Mon Sep 17 00:00:00 2001 From: TheDarkBatman <87569239+TheDarkBatman2@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:59:21 +0330 Subject: [PATCH 3/6] fixed bug with randomlights event if it gets activated with lightsoff event it can cause some bugs --- Lua/config/pointshop/clown.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lua/config/pointshop/clown.lua b/Lua/config/pointshop/clown.lua index 3f339123..ef563e3b 100644 --- a/Lua/config/pointshop/clown.lua +++ b/Lua/config/pointshop/clown.lua @@ -273,7 +273,8 @@ category.Products = { IsLimitGlobal = true, CanBuy = function (client, product) - return not Traitormod.RoundEvents.IsEventActive("RandomLights") + return not (Traitormod.RoundEvents.IsEventActive("RandomLights") or + Traitormod.RoundEvents.IsEventActive("LightsOff")) end, Action = function () From 09e11d657d5b65fb7b474715943783ee44c5ff8f Mon Sep 17 00:00:00 2001 From: TheDarkBatman <87569239+TheDarkBatman2@users.noreply.github.com> Date: Wed, 14 Jun 2023 20:12:17 +0330 Subject: [PATCH 4/6] cant have lightsevent when randomlights is on --- Lua/config/pointshop/traitor.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lua/config/pointshop/traitor.lua b/Lua/config/pointshop/traitor.lua index 03f1451f..ef4e2669 100644 --- a/Lua/config/pointshop/traitor.lua +++ b/Lua/config/pointshop/traitor.lua @@ -263,7 +263,8 @@ category.Products = { IsLimitGlobal = true, CanBuy = function (client, product) - return not Traitormod.RoundEvents.IsEventActive("LightsOff") + return not (Traitormod.RoundEvents.IsEventActive("LightsOff") or + Traitormod.RoundEvents.IsEventActive("RandomLights")) end, Action = function () From 666146b1e7ad5e76681760456207239ffcebed55 Mon Sep 17 00:00:00 2001 From: TheDarkBatman <87569239+TheDarkBatman2@users.noreply.github.com> Date: Mon, 19 Jun 2023 01:52:30 +0330 Subject: [PATCH 5/6] optimized wombcombo by a little big and removed dev test --- Lua/config/pointshop/clown.lua | 8 ++++---- Lua/config/randomevents/wombocombo.lua | 17 +++++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Lua/config/pointshop/clown.lua b/Lua/config/pointshop/clown.lua index ef563e3b..7c5dd91d 100644 --- a/Lua/config/pointshop/clown.lua +++ b/Lua/config/pointshop/clown.lua @@ -2,11 +2,11 @@ local category = {} category.Identifier = "clown" category.Decoration = "cultist" --- category.FadeToBlack = true +category.FadeToBlack = true --- category.CanAccess = function(client) --- return client.Character and not client.Character.IsDead and Traitormod.RoleManager.HasRole(client.Character, "Clown") --- end +category.CanAccess = function(client) + return client.Character and not client.Character.IsDead and Traitormod.RoleManager.HasRole(client.Character, "Clown") +end category.Init = function () local spawnInstallation = function (submarine, position, prefab) diff --git a/Lua/config/randomevents/wombocombo.lua b/Lua/config/randomevents/wombocombo.lua index 6a97fea4..d2c93034 100644 --- a/Lua/config/randomevents/wombocombo.lua +++ b/Lua/config/randomevents/wombocombo.lua @@ -11,17 +11,17 @@ event.FlickerAmount = 3 -- one cycle of On and Off event.Lights = {} -- (key=item, value=originalLightComponentColor) event.Start = function () - -- Applying afflications + local poison = AfflictionPrefab.Prefabs["deliriuminepoisoning"] + local psychosis = AfflictionPrefab.Prefabs["psychosis"] + local hallucination = AfflictionPrefab.Prefabs["hallucinating"] + local function GiveWombo(character) if character.Submarine ~= Submarine.MainSub then return end if character.IsDead then return end - - local poison = AfflictionPrefab.Prefabs["deliriuminepoisoning"] + character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, poison.Instantiate(100)) - local psychosis = AfflictionPrefab.Prefabs["psychosis"] character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, psychosis.Instantiate(100)) - local hallucination = AfflictionPrefab.Prefabs["hallucinating"] character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, hallucination.Instantiate(100)) end for key, value in pairs(Character.CharacterList) do @@ -68,7 +68,7 @@ event.Start = function () end, i * event.Time/event.FlickerAmount * 60000) end - -- end this event + -- end the event Timer.Wait(event.End, event.Time * 60000) end @@ -77,6 +77,11 @@ event.End = function () for item, _ in pairs(event.Lights) do event.Lights[item] = nil end + if not isEndRound then + local text = Traitormod.Language.OxygenSafe + + Traitormod.RoundEvents.SendEventMessage(text, "GameModeIcon.multiplayercampaign") + end end return event \ No newline at end of file From 868440c32f4bf798c20bec751fa6b14f620f228e Mon Sep 17 00:00:00 2001 From: TheDarkBatman <87569239+TheDarkBatman2@users.noreply.github.com> Date: Mon, 19 Jun 2023 01:53:51 +0330 Subject: [PATCH 6/6] optimized other events by a little bit --- Lua/config/randomevents/oxygengenhusk.lua | 2 +- Lua/config/randomevents/oxygengenpoison.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lua/config/randomevents/oxygengenhusk.lua b/Lua/config/randomevents/oxygengenhusk.lua index 292caa0f..27b9addf 100644 --- a/Lua/config/randomevents/oxygengenhusk.lua +++ b/Lua/config/randomevents/oxygengenhusk.lua @@ -12,6 +12,7 @@ event.Start = function () local text = Traitormod.Language.OxygenHusk Traitormod.RoundEvents.SendEventMessage(text, "GameModeIcon.pvp", Color.DarkMagenta) + local poison = AfflictionPrefab.Prefabs["huskinfection"] local function GivePoison(character) if character.Submarine ~= Submarine.MainSub then return end if character.IsDead then return end @@ -20,7 +21,6 @@ event.Start = function () if headGear ~= nil and headGear.Prefab.Identifier == "divingmask" then return end if headGear ~= nil and headGear.Prefab.Identifier == "clowndivingmask" then return end - local poison = AfflictionPrefab.Prefabs["huskinfection"] character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, poison.Instantiate(50)) end diff --git a/Lua/config/randomevents/oxygengenpoison.lua b/Lua/config/randomevents/oxygengenpoison.lua index 47643a66..d8d52f78 100644 --- a/Lua/config/randomevents/oxygengenpoison.lua +++ b/Lua/config/randomevents/oxygengenpoison.lua @@ -12,6 +12,7 @@ event.Start = function () local text = Traitormod.Language.OxygenPoison Traitormod.RoundEvents.SendEventMessage(text, "GameModeIcon.pvp", Color.Red) + local poison = AfflictionPrefab.Prefabs["sufforinpoisoning"] local function GivePoison(character) if character.Submarine ~= Submarine.MainSub then return end if character.IsDead then return end @@ -20,7 +21,6 @@ event.Start = function () if headGear ~= nil and headGear.Prefab.Identifier == "divingmask" then return end if headGear ~= nil and headGear.Prefab.Identifier == "clowndivingmask" then return end - local poison = AfflictionPrefab.Prefabs["sufforinpoisoning"] character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, poison.Instantiate(20)) end