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..7c5dd91d 100644 --- a/Lua/config/pointshop/clown.lua +++ b/Lua/config/pointshop/clown.lua @@ -233,6 +233,24 @@ category.Products = { Items = {"detonator"}, }, + { + Identifier = "wombocombo", + Price = 450, + Limit = 4, + IsLimitGlobal = true, + + CanBuy = function (client, product) + return not (Traitormod.RoundEvents.IsEventActive("WomboCombo") or + Traitormod.RoundEvents.IsEventActive("CommunicationsOffline") or + Traitormod.RoundEvents.IsEventActive("RandomLights") or + Traitormod.RoundEvents.IsEventActive("LightsOff")) + end, + + Action = function () + Traitormod.RoundEvents.TriggerEvent("WomboCombo") + end + }, + { Identifier = "clownmagic", Price = 450, @@ -255,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 () 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 () 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 diff --git a/Lua/config/randomevents/wombocombo.lua b/Lua/config/randomevents/wombocombo.lua new file mode 100644 index 00000000..d2c93034 --- /dev/null +++ b/Lua/config/randomevents/wombocombo.lua @@ -0,0 +1,87 @@ +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 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 + + character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, poison.Instantiate(100)) + character.CharacterHealth.ApplyAffliction(character.AnimController.MainLimb, psychosis.Instantiate(100)) + 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 the event + Timer.Wait(event.End, event.Time * 60000) +end + + +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 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",