Files
Timothy TeakettleandGitHub 56475d6021 fix a handful of bad references to player_levels (#7559)
## About The Pull Request
<img width="391" height="54" alt="image"
src="https://github.com/user-attachments/assets/109044e2-a68c-4353-988e-e1747156387b"
/>

also a few events are fixed

## Why It's Good For The Game
fixes stuff

## Changelog
🆑
fix: fix a handful of bad references to player_levels
/🆑
2026-03-28 15:21:22 -04:00

54 lines
1.7 KiB
Plaintext

/datum/event/apc_damage
var/apcSelectionRange = 25
/datum/event/apc_damage/start()
var/obj/machinery/power/apc/A = acquire_random_apc()
var/severity_range = 0
switch(severity)
if(EVENT_LEVEL_MUNDANE)
severity_range = 0
if(EVENT_LEVEL_MODERATE)
severity_range = 7
if(EVENT_LEVEL_MAJOR)
severity_range = 15
for(var/obj/machinery/power/apc/apc in range(severity_range,A))
if(is_valid_apc(apc)) //This event "****s up" the "id authenticator" on APCs, emagging and unlocking them.
apc.emagged = 1 //It used to just blue screen the APC and make it so it had to be hacked to unlock,
apc.locked = 0 //but most people ignored it. Now it has an actual effect on the round and opens
apc.update_icon() //a small possibility for traitors. To fix, remove power cell and apply multitool.
/datum/event/apc_damage/proc/acquire_random_apc()
var/list/possibleEpicentres = list()
var/list/apcs = list()
for(var/obj/landmark/newEpicentre in GLOB.landmarks_list)
if(newEpicentre.name == "lightsout")
possibleEpicentres += newEpicentre
if(!possibleEpicentres.len)
return
var/epicentre = pick(possibleEpicentres)
for(var/obj/machinery/power/apc/apc in range(epicentre,apcSelectionRange))
if(is_valid_apc(apc))
apcs += apc
// Greatly increase the chance for APCs in maintenance areas to be selected
var/area/A = get_area(apc)
if(istype(A,/area/maintenance))
apcs += apc
apcs += apc
if(istype(A,/area/main_map/maintenance))
apcs += apc
apcs += apc
if(!apcs.len)
return
return pick(apcs)
/datum/event/apc_damage/proc/is_valid_apc(var/obj/machinery/power/apc/apc)
var/turf/T = get_turf(apc)
return !apc.is_critical && !apc.emagged && T && (T.z in (LEGACY_MAP_DATUM).station_levels)