Merge pull request #14398 from LetterN/post-hardsync1.5
post-hardsync1.5
This commit is contained in:
@@ -137,7 +137,7 @@ Class Procs:
|
||||
GLOB.machines += src
|
||||
|
||||
if(ispath(circuit, /obj/item/circuitboard))
|
||||
circuit = new circuit
|
||||
circuit = new circuit(src)
|
||||
circuit.apply_default_parts(src)
|
||||
|
||||
if(!speed_process && init_process)
|
||||
@@ -361,11 +361,11 @@ Class Procs:
|
||||
/obj/machinery/deconstruct(disassembled = TRUE)
|
||||
if(!(flags_1 & NODECONSTRUCT_1))
|
||||
on_deconstruction()
|
||||
if(component_parts && component_parts.len)
|
||||
if(LAZYLEN(component_parts))
|
||||
spawn_frame(disassembled)
|
||||
for(var/obj/item/I in component_parts)
|
||||
I.forceMove(loc)
|
||||
component_parts.Cut()
|
||||
LAZYCLEARLIST(component_parts)
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/proc/spawn_frame(disassembled)
|
||||
@@ -539,12 +539,17 @@ Class Procs:
|
||||
|
||||
/obj/machinery/Exited(atom/movable/AM, atom/newloc)
|
||||
. = ..()
|
||||
// if(AM == occupant)
|
||||
// set_occupant(null)
|
||||
if (AM == occupant)
|
||||
SEND_SIGNAL(src, COMSIG_MACHINE_EJECT_OCCUPANT, occupant)
|
||||
occupant = null
|
||||
if(AM == circuit && circuit.loc != src)
|
||||
component_parts -= AM //TODO: make the cmp part functions use lazyX
|
||||
circuit = null
|
||||
|
||||
/obj/machinery/proc/adjust_item_drop_location(atom/movable/AM) // Adjust item drop location to a 3x3 grid inside the tile, returns slot id from 0 to 8
|
||||
var/md5 = md5(AM.name) // Oh, and it's deterministic too. A specific item will always drop from the same slot.
|
||||
/obj/machinery/proc/adjust_item_drop_location(atom/movable/AM) // Adjust item drop location to a 3x3 grid inside the tile, returns slot id from 0 to 8
|
||||
var/md5 = md5(AM.name) // Oh, and it's deterministic too. A specific item will always drop from the same slot.
|
||||
for (var/i in 1 to 32)
|
||||
. += hex2num(md5[i])
|
||||
. = . % 9
|
||||
|
||||
@@ -17,20 +17,16 @@
|
||||
|
||||
/obj/machinery/computer/Initialize(mapload, obj/item/circuitboard/C)
|
||||
. = ..()
|
||||
|
||||
power_change()
|
||||
if(!QDELETED(C))
|
||||
qdel(circuit)
|
||||
circuit = C
|
||||
C.moveToNullspace()
|
||||
|
||||
/obj/machinery/computer/Destroy()
|
||||
QDEL_NULL(circuit)
|
||||
return ..()
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/computer/process()
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return 0
|
||||
return 1
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/ratvar_act()
|
||||
if(!clockwork)
|
||||
@@ -87,25 +83,32 @@
|
||||
switch(damage_type)
|
||||
if(BRUTE)
|
||||
if(stat & BROKEN)
|
||||
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
|
||||
playsound(src.loc, 'sound/effects/hit_on_shattered_glass.ogg', 70, TRUE)
|
||||
else
|
||||
playsound(src.loc, 'sound/effects/glasshit.ogg', 75, 1)
|
||||
playsound(src.loc, 'sound/effects/glasshit.ogg', 75, TRUE)
|
||||
if(BURN)
|
||||
playsound(src.loc, 'sound/items/welder.ogg', 100, 1)
|
||||
playsound(src.loc, 'sound/items/welder.ogg', 100, TRUE)
|
||||
|
||||
/obj/machinery/computer/obj_break(damage_flag)
|
||||
if(circuit && !(flags_1 & NODECONSTRUCT_1)) //no circuit, no breaking
|
||||
if(!(stat & BROKEN))
|
||||
playsound(loc, 'sound/effects/glassbr3.ogg', 100, 1)
|
||||
stat |= BROKEN
|
||||
update_icon()
|
||||
set_light(0)
|
||||
if(!circuit) //no circuit, no breaking
|
||||
return
|
||||
. = ..()
|
||||
if(. && !(stat & BROKEN))
|
||||
stat |= BROKEN
|
||||
playsound(loc, 'sound/effects/glassbr3.ogg', 100, TRUE)
|
||||
set_light(0)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/computer/emp_act(severity)
|
||||
. = ..()
|
||||
if (!(. & EMP_PROTECT_SELF))
|
||||
if(prob(severity/1.8))
|
||||
obj_break("energy")
|
||||
switch(severity)
|
||||
if(1)
|
||||
if(prob(50))
|
||||
obj_break("energy")
|
||||
if(2)
|
||||
if(prob(10))
|
||||
obj_break("energy")
|
||||
|
||||
/obj/machinery/computer/deconstruct(disassembled = TRUE, mob/user)
|
||||
on_deconstruction()
|
||||
@@ -114,12 +117,14 @@
|
||||
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer(src.loc)
|
||||
A.setDir(dir)
|
||||
A.circuit = circuit
|
||||
A.setAnchored(TRUE)
|
||||
// Circuit removal code is handled in /obj/machinery/Exited()
|
||||
circuit.forceMove(A)
|
||||
A.set_anchored(TRUE)
|
||||
if(stat & BROKEN)
|
||||
if(user)
|
||||
to_chat(user, "<span class='notice'>The broken glass falls out.</span>")
|
||||
else
|
||||
playsound(src, 'sound/effects/hit_on_shattered_glass.ogg', 70, 1)
|
||||
playsound(src, 'sound/effects/hit_on_shattered_glass.ogg', 70, TRUE)
|
||||
new /obj/item/shard(drop_location())
|
||||
new /obj/item/shard(drop_location())
|
||||
A.state = 3
|
||||
@@ -129,8 +134,11 @@
|
||||
to_chat(user, "<span class='notice'>You disconnect the monitor.</span>")
|
||||
A.state = 4
|
||||
A.icon_state = "4"
|
||||
circuit = null
|
||||
for(var/obj/C in src)
|
||||
C.forceMove(loc)
|
||||
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/computer/AltClick(mob/user)
|
||||
. = ..()
|
||||
if(!user.canUseTopic(src, !issilicon(user)) || !(stat & (NOPOWER|BROKEN)))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user