Proper fake events (#11452)

This commit is contained in:
Doxxmedearly
2021-03-15 16:07:36 -05:00
committed by GitHub
parent 462e800945
commit 06ed6b64fa
11 changed files with 37 additions and 21 deletions

View File

@@ -49,7 +49,7 @@
"Advertising is legalized lying! But don't let that put you off our great deals!", \ "Advertising is legalized lying! But don't let that put you off our great deals!", \
"You don't want to buy anything? Yeah, well I didn't want to buy your mom either.")) "You don't want to buy anything? Yeah, well I didn't want to buy your mom either."))
/datum/event/brand_intelligence/end() /datum/event/brand_intelligence/end(var/faked)
for(var/obj/machinery/vending/infectedMachine in infectedVendingMachines) for(var/obj/machinery/vending/infectedMachine in infectedVendingMachines)
infectedMachine.shut_up = 1 infectedMachine.shut_up = 1
infectedMachine.shoot_inventory = 0 infectedMachine.shoot_inventory = 0

View File

@@ -90,7 +90,7 @@
CHECK_TICK CHECK_TICK
i++ i++
/datum/event/carp_migration/end() /datum/event/carp_migration/end(var/faked)
for (var/carp_ref in spawned_carp) for (var/carp_ref in spawned_carp)
var/datum/weakref/carp_weakref = carp_ref var/datum/weakref/carp_weakref = carp_ref
var/mob/living/simple_animal/hostile/carp/fish = carp_weakref.resolve() var/mob/living/simple_animal/hostile/carp/fish = carp_weakref.resolve()

View File

@@ -107,7 +107,8 @@
//the activeFor variable. //the activeFor variable.
//For example: if(activeFor == myOwnVariable + 30) doStuff() //For example: if(activeFor == myOwnVariable + 30) doStuff()
//Only called once. //Only called once.
/datum/event/proc/end() //faked indicates this is a false alarm. Used to prevent announcements and other things from happening during false alarms.
/datum/event/proc/end(var/faked)
return return
//Returns the latest point of event processing. //Returns the latest point of event processing.

View File

@@ -6,15 +6,16 @@
/datum/event/false_alarm /datum/event/false_alarm
announceWhen = 0 announceWhen = 0
endWhen = 90 endWhen = 90
no_fake = TRUE //Can't fake itself
var/datum/event_meta/EM var/datum/event_meta/EM
var/eventname var/eventname
var/datum/event/E = null var/datum/event/E = null
/datum/event/false_alarm/end() /datum/event/false_alarm/end(var/faked)
command_announcement.Announce("Error, It appears our previous announcement about [eventname] was a sensor glitch. There is no cause for alarm, please return to your stations.", "False Alarm", new_sound = 'sound/AI/falsealarm.ogg') command_announcement.Announce("Error, It appears our previous announcement about [eventname] was a sensor glitch. There is no cause for alarm, please return to your stations.", "False Alarm", new_sound = 'sound/AI/falsealarm.ogg')
if(two_part) if(two_part)
E.end() E.end() //This does not return TRUE for var/faked because two-part events like radiation storms need to do things such as revoking maint access
if (EM) if (EM)
qdel(EM) qdel(EM)
EM = null EM = null
@@ -31,14 +32,13 @@
var/fake_allowed = 0 var/fake_allowed = 0
while (!fake_allowed) while (!fake_allowed)
if (E) if (E)
E.end() E.end(TRUE)
E.kill() E.kill()
qdel(E) qdel(E)
E = null E = null
EM = pick(EC.available_events) EM = pick(EC.available_events)
E = new EM.event_type(EM,1) E = new EM.event_type(EM,1)
fake_allowed = !E.no_fake fake_allowed = !E.no_fake
if (E.ic_name) if (E.ic_name)
eventname = E.ic_name eventname = E.ic_name
else else
@@ -47,6 +47,6 @@
two_part = 1 two_part = 1
E.start() E.start()
E.end() E.end(TRUE)
E.kill() E.kill()
E.announce() E.announce()

View File

@@ -92,7 +92,7 @@
if(prob(botEmagChance)) if(prob(botEmagChance))
bot.emag_act(1) bot.emag_act(1)
/datum/event/ionstorm/end() /datum/event/ionstorm/end(var/faked)
spawn(rand(5000,8000)) spawn(rand(5000,8000))
if(prob(50)) if(prob(50))
ion_storm_announcement() ion_storm_announcement()

View File

@@ -39,7 +39,9 @@
else else
endWhen = next_wave + wave_delay endWhen = next_wave + wave_delay
/datum/event/meteor_wave/end() /datum/event/meteor_wave/end(var/faked)
if(faked)
return
spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station
command_announcement.Announce("The station has survived the meteor storm, it is now safe to commence repairs.", "Meteor Alert") command_announcement.Announce("The station has survived the meteor storm, it is now safe to commence repairs.", "Meteor Alert")
@@ -61,7 +63,9 @@
command_announcement.Announce("Meteors have reached the station. Please stay away from outer areas until the shower has passed.", "Meteor Alert") command_announcement.Announce("Meteors have reached the station. Please stay away from outer areas until the shower has passed.", "Meteor Alert")
/datum/event/meteor_wave/shower/end() /datum/event/meteor_wave/shower/end(var/faked)
if(faked)
return
spawn(100) spawn(100)
command_announcement.Announce("The station has cleared the meteor shower, please return to your stations.", "Meteor Alert") command_announcement.Announce("The station has cleared the meteor shower, please return to your stations.", "Meteor Alert")
@@ -83,6 +87,8 @@
/datum/event/meteor_wave/downed_ship/start() /datum/event/meteor_wave/downed_ship/start()
command_announcement.Announce("Ship debris colliding now, all hands brace for impact.", "Ship Debris Alert") command_announcement.Announce("Ship debris colliding now, all hands brace for impact.", "Ship Debris Alert")
/datum/event/meteor_wave/downed_ship/end() /datum/event/meteor_wave/downed_ship/end(var/faked)
if(faked)
return
spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station spawn(100)//We give 10 seconds before announcing, for the last wave of meteors to hit the station
command_announcement.Announce("The last of the ship debris has hit or passed by the station, it is now safe to commence repairs.", "Ship Debris Alert") command_announcement.Announce("The last of the ship debris has hit or passed by the station, it is now safe to commence repairs.", "Ship Debris Alert")

View File

@@ -31,9 +31,9 @@
else else
endWhen = activeFor + 10 endWhen = activeFor + 10
/datum/event/money_hacker/end() /datum/event/money_hacker/end(var/faked)
var/message var/message
if(affected_account && !affected_account.suspended) if(affected_account && !affected_account.suspended && !faked)
//hacker wins //hacker wins
message = "The hack attempt has succeeded." message = "The hack attempt has succeeded."

View File

@@ -68,6 +68,6 @@
L.flicker(10) L.flicker(10)
/datum/event/prison_break/end() /datum/event/prison_break/end(var/faked)
for(var/area/A in shuffle(areas)) for(var/area/A in shuffle(areas))
A.prison_break() A.prison_break()

View File

@@ -36,7 +36,9 @@
C.apply_radiation_effects() C.apply_radiation_effects()
/datum/event/radiation_storm/end() /datum/event/radiation_storm/end(var/faked)
if(faked)
return
revoke_maint_all_access() revoke_maint_all_access()
/datum/event/radiation_storm/syndicate/radiate() /datum/event/radiation_storm/syndicate/radiate()

View File

@@ -27,7 +27,7 @@
msg = "Unidentified hackers have targetted a combat drone wing deployed from the NDV Icarus. If any are sighted in the area, approach with caution." msg = "Unidentified hackers have targetted a combat drone wing deployed from the NDV Icarus. If any are sighted in the area, approach with caution."
command_announcement.Announce(msg, "Rogue drone alert", new_sound = 'sound/AI/combatdrones.ogg') command_announcement.Announce(msg, "Rogue drone alert", new_sound = 'sound/AI/combatdrones.ogg')
/datum/event/rogue_drone/end() /datum/event/rogue_drone/end(var/faked)
var/num_recovered = 0 var/num_recovered = 0
for(var/drone in drones_list) for(var/drone in drones_list)
var/mob/living/simple_animal/hostile/icarus_drone/malf/D = drone var/mob/living/simple_animal/hostile/icarus_drone/malf/D = drone
@@ -35,6 +35,7 @@
D.beam_out() D.beam_out()
num_recovered++ num_recovered++
if(!faked)
if(num_recovered > length(drones_list) * 0.75) if(num_recovered > length(drones_list) * 0.75)
command_announcement.Announce("Icarus drone control reports the malfunctioning wing has been recovered safely.", "Rogue drone alert") command_announcement.Announce("Icarus drone control reports the malfunctioning wing has been recovered safely.", "Rogue drone alert")
else else

View File

@@ -0,0 +1,6 @@
author: Doxxmedearly
delete-after: True
changes:
- bugfix: "Fixed the false alarm event causing it to seem like some events (including itself) were ending as soon as they began."