From 2736f498f30220b858fc6fac23e7ddc4a597df6d Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 30 May 2016 14:42:09 -0400 Subject: Inital commit --- gamemode/events/antidote_shortage.lua | 51 +++++++++++++++++++++ gamemode/events/fallout.lua | 84 +++++++++++++++++++++++++++++++++++ gamemode/events/radio_blackout.lua | 38 ++++++++++++++++ gamemode/events/radioblackout.lua | 38 ++++++++++++++++ gamemode/events/scientist.lua | 38 ++++++++++++++++ gamemode/events/supply_crate.lua | 40 +++++++++++++++++ gamemode/events/supplycrate.lua | 40 +++++++++++++++++ gamemode/events/weather_event.lua | 39 ++++++++++++++++ 8 files changed, 368 insertions(+) create mode 100644 gamemode/events/antidote_shortage.lua create mode 100644 gamemode/events/fallout.lua create mode 100644 gamemode/events/radio_blackout.lua create mode 100644 gamemode/events/radioblackout.lua create mode 100644 gamemode/events/scientist.lua create mode 100644 gamemode/events/supply_crate.lua create mode 100644 gamemode/events/supplycrate.lua create mode 100644 gamemode/events/weather_event.lua (limited to 'gamemode/events') diff --git a/gamemode/events/antidote_shortage.lua b/gamemode/events/antidote_shortage.lua new file mode 100644 index 0000000..829709b --- /dev/null +++ b/gamemode/events/antidote_shortage.lua @@ -0,0 +1,51 @@ + +local EVENT = {} + +EVENT.Chance = 0.75 +EVENT.Type = EVENT_BAD +EVENT.TimeText = { "1 minute", "2 minutes", "3 minutes" } +EVENT.Times = { 60, 120, 180 } + +function EVENT:Start() + + local num = math.random(1,3) + + EVENT.EndTime = CurTime() + EVENT.Times[ num ] + EVENT.ThinkTime = 0 + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + v:Notice( "Antidote supplies will be low for " .. EVENT.TimeText[ num ], GAMEMODE.Colors.Red, 5 ) + v:Notice( "The antidote shortage has ended", GAMEMODE.Colors.White, 5, EVENT.Times[ num ] ) + + end + +end + +function EVENT:Think() + + if EVENT.ThinkTime < CurTime() then + + EVENT.ThinkTime = CurTime() + 3 + + if IsValid( GAMEMODE.Antidote ) and GAMEMODE.Antidote:CuresLeft() > 1 then + + GAMEMODE.Antidote:SetCures( 1 ) + + end + + end + +end + +function EVENT:EndThink() + + return EVENT.EndTime < CurTime() // true ends this immediately + +end + +function EVENT:End() + +end + +event.Register( EVENT ) diff --git a/gamemode/events/fallout.lua b/gamemode/events/fallout.lua new file mode 100644 index 0000000..b316523 --- /dev/null +++ b/gamemode/events/fallout.lua @@ -0,0 +1,84 @@ + +local EVENT = {} + +EVENT.Chance = 0.50 +EVENT.Type = EVENT_BAD +EVENT.TimeText = { "30 seconds", "1 minute" } +EVENT.Times = { 30, 60 } + +function EVENT:Start() + + local num = math.random(1,2) + + EVENT.Delay = CurTime() + 15 + EVENT.RadTime = CurTime() + EVENT.Times[ num ] + 15 + EVENT.RadDelay = 0 + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + v:Notice( "Nuclear fallout contamination is imminent", GAMEMODE.Colors.White, 7 ) + v:Notice( "Enter a building to avoid radiation poisoning", GAMEMODE.Colors.White, 7, 2 ) + v:Notice( "The atmospheric fallout will subside in " .. EVENT.TimeText[ num ], GAMEMODE.Colors.White, 7, 15 ) + v:Notice( "Atmospheric radioactivity levels are now safe", GAMEMODE.Colors.White, 7, EVENT.Times[ num ] + 15 ) + + end + + timer.Simple( 15, function() SetGlobalBool( "Radiation", true ) end ) + +end + +function EVENT:Think() + + if EVENT.Delay < CurTime() then + + if EVENT.RadDelay < CurTime() then + + EVENT.RadDelay = CurTime() + 1 + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + if not v:IsIndoors() then + + if math.random(1,2) == 1 then + + v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random(90,110) ) + + end + + if math.random(1,5) == 1 then + + v:AddRadiation( 1 ) + + end + + else + + if math.random(1,6) == 1 then + + v:EmitSound( table.Random( GAMEMODE.Geiger ), 100, math.random(120,140) ) + + end + + end + + end + + end + + end + +end + +function EVENT:EndThink() + + return EVENT.RadTime < CurTime() + +end + +function EVENT:End() + + SetGlobalBool( "Radiation", false ) + +end + +event.Register( EVENT ) diff --git a/gamemode/events/radio_blackout.lua b/gamemode/events/radio_blackout.lua new file mode 100644 index 0000000..27c5344 --- /dev/null +++ b/gamemode/events/radio_blackout.lua @@ -0,0 +1,38 @@ + +local EVENT = {} + +EVENT.Chance = 0.75 +EVENT.Type = EVENT_BAD +EVENT.TimeText = { "30 seconds", "1 minute", "90 seconds" } +EVENT.Times = { 30, 60, 90 } + +function EVENT:Start() + + local num = math.random(1,3) + + GAMEMODE.RadioBlock = CurTime() + EVENT.Times[ num ] + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + v:Notice( "Radio communications will be down for " .. EVENT.TimeText[ num ], GAMEMODE.Colors.Red, 5 ) + v:Notice( "Radio communications are back online", GAMEMODE.Colors.White, 5, EVENT.Times[ num ] ) + + end + +end + +function EVENT:Think() + +end + +function EVENT:EndThink() + + return true // true ends this immediately + +end + +function EVENT:End() + +end + +event.Register( EVENT ) diff --git a/gamemode/events/radioblackout.lua b/gamemode/events/radioblackout.lua new file mode 100644 index 0000000..27c5344 --- /dev/null +++ b/gamemode/events/radioblackout.lua @@ -0,0 +1,38 @@ + +local EVENT = {} + +EVENT.Chance = 0.75 +EVENT.Type = EVENT_BAD +EVENT.TimeText = { "30 seconds", "1 minute", "90 seconds" } +EVENT.Times = { 30, 60, 90 } + +function EVENT:Start() + + local num = math.random(1,3) + + GAMEMODE.RadioBlock = CurTime() + EVENT.Times[ num ] + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + v:Notice( "Radio communications will be down for " .. EVENT.TimeText[ num ], GAMEMODE.Colors.Red, 5 ) + v:Notice( "Radio communications are back online", GAMEMODE.Colors.White, 5, EVENT.Times[ num ] ) + + end + +end + +function EVENT:Think() + +end + +function EVENT:EndThink() + + return true // true ends this immediately + +end + +function EVENT:End() + +end + +event.Register( EVENT ) diff --git a/gamemode/events/scientist.lua b/gamemode/events/scientist.lua new file mode 100644 index 0000000..ce58fdf --- /dev/null +++ b/gamemode/events/scientist.lua @@ -0,0 +1,38 @@ + +local EVENT = {} + +EVENT.Chance = 0.75 +EVENT.Type = EVENT_BONUS + +function EVENT:Start() + + local spawns = ents.FindByClass( "info_evac" ) + local evac = table.Random( spawns ) + + local ent = ents.Create( "npc_scientist" ) + ent:SetPos( evac:GetPos() + Vector(0,0,10) ) + ent:Spawn() + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + v:Notice( "A surviving field researcher has been sighted", GAMEMODE.Colors.White, 5 ) + + end + +end + +function EVENT:Think() + +end + +function EVENT:EndThink() + + return true // true ends this immediately + +end + +function EVENT:End() + +end + +event.Register( EVENT ) diff --git a/gamemode/events/supply_crate.lua b/gamemode/events/supply_crate.lua new file mode 100644 index 0000000..35ca974 --- /dev/null +++ b/gamemode/events/supply_crate.lua @@ -0,0 +1,40 @@ + +local EVENT = {} + +EVENT.Chance = 0.95 +EVENT.Type = EVENT_BONUS + +function EVENT:Start() + + local spawns = ents.FindByClass( "info_lootspawn" ) + local loot = table.Random( spawns ) + + if not IsValid( loot ) then MsgN( "ERROR: Unable to locate loot spawns. Map not configured?" ) return end + + local ent = ents.Create( "sent_bonuscrate" ) + ent:SetPos( loot:GetPos() + Vector(0,0,10) ) + ent:Spawn() + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + v:Notice( "Keep an eye out for a civilian weapon cache", GAMEMODE.Colors.White, 5 ) + + end + +end + +function EVENT:Think() + +end + +function EVENT:EndThink() + + return true // true ends this immediately + +end + +function EVENT:End() + +end + +event.Register( EVENT ) diff --git a/gamemode/events/supplycrate.lua b/gamemode/events/supplycrate.lua new file mode 100644 index 0000000..35ca974 --- /dev/null +++ b/gamemode/events/supplycrate.lua @@ -0,0 +1,40 @@ + +local EVENT = {} + +EVENT.Chance = 0.95 +EVENT.Type = EVENT_BONUS + +function EVENT:Start() + + local spawns = ents.FindByClass( "info_lootspawn" ) + local loot = table.Random( spawns ) + + if not IsValid( loot ) then MsgN( "ERROR: Unable to locate loot spawns. Map not configured?" ) return end + + local ent = ents.Create( "sent_bonuscrate" ) + ent:SetPos( loot:GetPos() + Vector(0,0,10) ) + ent:Spawn() + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + v:Notice( "Keep an eye out for a civilian weapon cache", GAMEMODE.Colors.White, 5 ) + + end + +end + +function EVENT:Think() + +end + +function EVENT:EndThink() + + return true // true ends this immediately + +end + +function EVENT:End() + +end + +event.Register( EVENT ) diff --git a/gamemode/events/weather_event.lua b/gamemode/events/weather_event.lua new file mode 100644 index 0000000..f7640fe --- /dev/null +++ b/gamemode/events/weather_event.lua @@ -0,0 +1,39 @@ + +local EVENT = {} + +EVENT.Chance = 0.95 +EVENT.Type = EVENT_WEATHER + +EVENT.Types = {} +EVENT.Types[1] = "rain" +EVENT.Types[2] = "thunder" +EVENT.Types[3] = "lightning" +EVENT.Types[4] = "strong winds" + +function EVENT:Start() + + GAMEMODE:RandomizeWeather( true ) + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + v:Notice( "The weather conditions are worsening", GAMEMODE.Colors.White, 5 ) + + end + +end + +function EVENT:Think() + +end + +function EVENT:EndThink() + + return true // true ends this immediately + +end + +function EVENT:End() + +end + +event.Register( EVENT ) -- cgit v1.2.3-70-g09d2