Replaces a bunch of obj vars (and emagged on machinery/items) with obj_flags (#34078)

* It works, but is it worth it?

* bitfield helpers take 1

* Would this work?

* remove dangling debug code

* rebase & fixes

* vv bitfield stuff, reading

* DNM oceans of shitcode DNM

* honk

* honk2

* plonk

* rebase & fix
This commit is contained in:
vuonojenmustaturska
2018-01-22 20:19:46 +01:00
committed by AnturK
parent 70bec96f9c
commit 6406896df1
110 changed files with 624 additions and 447 deletions
+10 -10
View File
@@ -90,7 +90,7 @@
var/list/data = list()
data["default_programs"] = program_cache
if(emagged)
if(obj_flags & EMAGGED)
data["emagged"] = TRUE
data["emag_programs"] = emag_programs
data["program"] = program
@@ -111,10 +111,10 @@
if(A)
load_program(A)
if("safety")
emagged = !emagged
if(emagged && program && emag_programs[program.name])
obj_flags ^= EMAGGED
if((obj_flags & EMAGGED) && program && emag_programs[program.name])
emergency_shutdown()
nerf(emagged)
nerf(obj_flags & EMAGGED)
/obj/machinery/computer/holodeck/process()
if(damaged && prob(10))
@@ -138,7 +138,7 @@
T.ex_act(EXPLODE_LIGHT)
T.hotspot_expose(1000,500,1)
if(!emagged)
if(!(obj_flags & EMAGGED))
for(var/item in spawned)
if(!(get_turf(item) in linked))
derez(item, 0)
@@ -149,17 +149,17 @@
active_power_usage = 50 + spawned.len * 3 + effects.len * 5
/obj/machinery/computer/holodeck/emag_act(mob/user)
if(emagged)
if(obj_flags & EMAGGED)
return
if(!LAZYLEN(emag_programs))
to_chat(user, "[src] does not seem to have a card swipe port. It must be an inferior model.")
return
playsound(src, "sparks", 75, 1)
emagged = TRUE
obj_flags |= EMAGGED
to_chat(user, "<span class='warning'>You vastly increase projector power and override the safety and security protocols.</span>")
to_chat(user, "Warning. Automatic shutoff and derezing protocols have been corrupted. Please call Nanotrasen maintenance and do not use the simulator.")
log_game("[key_name(user)] emagged the Holodeck Control Console")
nerf(!emagged)
nerf(!(obj_flags & EMAGGED))
/obj/machinery/computer/holodeck/emp_act(severity)
emergency_shutdown()
@@ -245,7 +245,7 @@
// note nerfing does not yet work on guns, should
// should also remove/limit/filter reagents?
// this is an exercise left to others I'm afraid. -Sayu
spawned = A.copy_contents_to(linked, 1, nerf_weapons = !emagged)
spawned = A.copy_contents_to(linked, 1, nerf_weapons = !(obj_flags & EMAGGED))
for(var/obj/machinery/M in spawned)
M.flags_1 |= NODECONSTRUCT_1
for(var/obj/structure/S in spawned)
@@ -270,7 +270,7 @@
/obj/machinery/computer/holodeck/proc/derez(obj/O, silent = TRUE, forced = FALSE)
// Emagging a machine creates an anomaly in the derez systems.
if(O && emagged && !stat && !forced)
if(O && (obj_flags & EMAGGED) && !stat && !forced)
if((ismob(O) || ismob(O.loc)) && prob(50))
addtimer(CALLBACK(src, .proc/derez, O, silent), 50) // may last a disturbingly long time
return