Files
Bubberstation/code/modules/events/electrical_storm.dm
BurgerLUA e87045b377 Tweaks some instances of get_safe_turf so things like the nuclear disk doesn't accidentally teleport to the Icebox Syndicate Base (#83012)
Yes, I know preventing the nuke disk teleporting to the icebox syndicate
base (or possibly the wendigo arena) is removing soul. Please don't kill
me :(

## About The Pull Request

Adds some missing variables to instances of get_safe_turf() so they will
only teleport to the given z-level.
Replaces some instances of get_safe_turf() with
get_safe_random_station_turf().

## Why It's Good For The Game

First, the differences between get_safe_turf() and
get_safe_random_station_turf():

### get_safe_turf()
- gets a random safe turf on a z-level (usually any of the staiton
z-levels), not accounting for the /area/
- should be used if you don't care if it spawns on the station or not,
or if you need to specifically teleport to a z-level
- not very expensive performance wise

###  get_safe_random_station_turf()
- gets a random safe turf that will always be a station area, ignoring
z-level.
- should be used if you NEED the turf to be on a station's area
- slightly more expensive performance wise than get_safe_turf, but still
very cheap

Some code was using get_safe_turf() when it should've been using
get_safe_random_station_turf(), and some code that should be using
get_safe_turf() were incorrectly using the zlevels arg instead of zlevel
arg (Yes, there is a difference), or didn't include it at all.

All the changes were made to my best judgement. If you're curious about
a change, please ask and I will explain why I did it.

## Changelog

🆑 BurgerBB
fix: Tweaks some instances of get_safe_turf so things like the nuclear
disk doesn't accidentally teleport to the Icebox Syndicate Base
/🆑

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2024-06-14 21:57:33 +01:00

36 lines
1.1 KiB
Plaintext

/datum/round_event_control/electrical_storm
name = "Electrical Storm"
typepath = /datum/round_event/electrical_storm
earliest_start = 10 MINUTES
min_players = 5
weight = 20
category = EVENT_CATEGORY_ENGINEERING
description = "Destroys all lights in a large area."
min_wizard_trigger_potency = 0
max_wizard_trigger_potency = 4
/datum/round_event/electrical_storm
var/lightsoutAmount = 1
var/lightsoutRange = 25
announce_when = 1
/datum/round_event/electrical_storm/announce(fake)
priority_announce("An electrical storm has been detected in your area, please repair potential electronic overloads.", "Electrical Storm Alert")
/datum/round_event/electrical_storm/start()
var/list/epicentreList = list()
for(var/i in 1 to lightsoutAmount)
var/turf/T = get_safe_random_station_turf()
if(istype(T))
epicentreList += T
if(!epicentreList.len)
return
for(var/centre in epicentreList)
for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc))
if(get_dist(centre, apc) <= lightsoutRange)
apc.overload_lighting()