diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm
index d2705a33259..14f13439d00 100644
--- a/code/__DEFINES/dcs/signals.dm
+++ b/code/__DEFINES/dcs/signals.dm
@@ -269,6 +269,8 @@
///called when the movable is added to a disposal holder object for disposal movement: (obj/structure/disposalholder/holder, obj/machinery/disposal/source)
#define COMSIG_MOVABLE_DISPOSING "movable_disposing"
+///called when the movable sucessfully has it's anchored var changed, from base atom/movable/set_anchored(): (value)
+#define COMSIG_MOVABLE_SET_ANCHORED "movable_set_anchored"
// /mob signals
@@ -413,8 +415,6 @@
///from base of obj/deconstruct(): (disassembled)
#define COMSIG_OBJ_DECONSTRUCT "obj_deconstruct"
-///called in /obj/structure/setAnchored(): (value)
-#define COMSIG_OBJ_SETANCHORED "obj_setanchored"
///from base of code/game/machinery
#define COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH "obj_default_unfasten_wrench"
///from base of /turf/proc/levelupdate(). (intact) true to hide and false to unhide
diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm
index a2c47addd33..7deeda4c140 100644
--- a/code/__DEFINES/is_helpers.dm
+++ b/code/__DEFINES/is_helpers.dm
@@ -218,3 +218,10 @@ GLOBAL_LIST_INIT(glass_sheet_types, typecacheof(list(
#define isblobmonster(O) (istype(O, /mob/living/simple_animal/hostile/blob))
#define isshuttleturf(T) (length(T.baseturfs) && (/turf/baseturf_skipover/shuttle in T.baseturfs))
+
+#define isbook(O) (is_type_in_typecache(O, GLOB.book_types))
+
+GLOBAL_LIST_INIT(book_types, typecacheof(list(
+ /obj/item/book,
+ /obj/item/spellbook,
+ /obj/item/storage/book)))
diff --git a/code/datums/elements/undertile.dm b/code/datums/elements/undertile.dm
index 3f3be0423c6..3ce11d48764 100644
--- a/code/datums/elements/undertile.dm
+++ b/code/datums/elements/undertile.dm
@@ -41,7 +41,7 @@
if(use_alpha)
source.alpha = ALPHA_UNDERTILE
if(use_anchor)
- source.anchored = TRUE
+ source.set_anchored(TRUE)
else
if(invisibility_trait)
@@ -51,7 +51,7 @@
if(use_alpha)
source.alpha = 255
if(use_anchor)
- source.anchored = FALSE
+ source.set_anchored(FALSE)
/datum/element/undertile/Detach(atom/movable/AM, visibility_trait, invisibility_level = INVISIBILITY_MAXIMUM)
. = ..()
diff --git a/code/datums/wires/roulette.dm b/code/datums/wires/roulette.dm
index f775808f908..657d19d5846 100644
--- a/code/datums/wires/roulette.dm
+++ b/code/datums/wires/roulette.dm
@@ -36,7 +36,7 @@
if(WIRE_BOLTS) // Pulse to toggle bolts (but only raise if power is on).
if(!R.on)
return
- R.anchored = !R.anchored
+ R.set_anchored(!R.anchored)
if(WIRE_RESETOWNER)
R.my_card = null
R.audible_message("Owner reset!")
@@ -62,7 +62,7 @@
if(WIRE_BOLTS) // Always drop
if(!R.on)
return
- R.anchored = TRUE
+ R.set_anchored(TRUE)
if(WIRE_RESETOWNER)
if(isliving(usr))
R.shock(usr, 70)
diff --git a/code/datums/wires/syndicatebomb.dm b/code/datums/wires/syndicatebomb.dm
index fa777eefcba..8732a0a21d7 100644
--- a/code/datums/wires/syndicatebomb.dm
+++ b/code/datums/wires/syndicatebomb.dm
@@ -69,7 +69,7 @@
if(!mend && B.anchored)
holder.visible_message("[icon2html(B, viewers(holder))] The bolts lift out of the ground!")
playsound(B, 'sound/effects/stealthoff.ogg', 30, TRUE)
- B.anchored = FALSE
+ B.set_anchored(FALSE)
if(WIRE_PROCEED)
if(!mend && B.active)
holder.visible_message("[icon2html(B, viewers(holder))] An alarm sounds! It's go-")
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index 158fad6526c..57aac129045 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -127,6 +127,9 @@
if((var_name in careful_edits) && (var_value % world.icon_size) != 0)
return FALSE
switch(var_name)
+ if(NAMEOF(src, anchored))
+ set_anchored(var_value)
+ return TRUE
if(NAMEOF(src, x))
var/turf/T = locate(var_value, y, z)
if(T)
@@ -456,6 +459,15 @@
return
A.Bumped(src)
+///Sets the anchored var and returns if it was sucessfully changed or not.
+/atom/movable/proc/set_anchored(anchorvalue)
+ SHOULD_CALL_PARENT(TRUE)
+ if(anchored == anchorvalue)
+ return
+ . = anchored
+ anchored = anchorvalue
+ SEND_SIGNAL(src, COMSIG_MOVABLE_SET_ANCHORED, anchorvalue)
+
/atom/movable/proc/forceMove(atom/destination)
. = FALSE
if(destination)
diff --git a/code/game/gamemodes/sandbox/airlock_maker.dm b/code/game/gamemodes/sandbox/airlock_maker.dm
index ddb622ab08c..eca72611d31 100644
--- a/code/game/gamemodes/sandbox/airlock_maker.dm
+++ b/code/game/gamemodes/sandbox/airlock_maker.dm
@@ -28,7 +28,7 @@
/datum/airlock_maker/New(var/atom/target_loc)
linked = new(target_loc)
linked.maker = src
- linked.anchored = FALSE
+ linked.set_anchored(FALSE)
access_used = list()
interact()
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 394f39f250f..a508b8e8e10 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -409,7 +409,7 @@ Class Procs:
/obj/machinery/proc/spawn_frame(disassembled)
var/obj/structure/frame/machine/M = new /obj/structure/frame/machine(loc)
. = M
- M.setAnchored(anchored)
+ M.set_anchored(anchored)
if(!disassembled)
M.obj_integrity = M.max_integrity * 0.5 //the frame is already half broken
transfer_fingerprints_to(M)
@@ -482,7 +482,7 @@ Class Procs:
//as long as we're the same anchored state and we're either on a floor or are anchored, toggle our anchored state
if(I.use_tool(src, user, time, extra_checks = CALLBACK(src, .proc/unfasten_wrench_check, prev_anchored, user)))
to_chat(user, "You [anchored ? "un" : ""]secure [src].")
- setAnchored(!anchored)
+ set_anchored(!anchored)
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
SEND_SIGNAL(src, COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH, anchored)
return SUCCESSFUL_UNFASTEN
diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm
index fa3ccf256de..251f51e26df 100644
--- a/code/game/machinery/camera/camera_assembly.dm
+++ b/code/game/machinery/camera/camera_assembly.dm
@@ -126,7 +126,7 @@
if(W.tool_behaviour == TOOL_WELDER)
if(weld(W, user))
to_chat(user, "You weld [src] securely into place.")
- setAnchored(TRUE)
+ set_anchored(TRUE)
state = STATE_WELDED
return
@@ -146,7 +146,7 @@
if(weld(W, user))
to_chat(user, "You unweld [src] from its place.")
state = STATE_WRENCHED
- setAnchored(TRUE)
+ set_anchored(TRUE)
return
if(STATE_WIRED) // Upgrades!
diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm
index 549dc40e7c1..e3c3b0966cd 100644
--- a/code/game/machinery/computer/_computer.dm
+++ b/code/game/machinery/computer/_computer.dm
@@ -100,7 +100,7 @@
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer(src.loc)
A.setDir(dir)
A.circuit = circuit
- A.setAnchored(TRUE)
+ A.set_anchored(TRUE)
if(machine_stat & BROKEN)
if(user)
to_chat(user, "The broken glass falls out.")
diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm
index 24f26f80410..4aa36f998c6 100644
--- a/code/game/machinery/computer/buildandrepair.dm
+++ b/code/game/machinery/computer/buildandrepair.dm
@@ -11,7 +11,7 @@
to_chat(user, "You start wrenching the frame into place...")
if(P.use_tool(src, user, 20, volume=50))
to_chat(user, "You wrench the frame into place.")
- setAnchored(TRUE)
+ set_anchored(TRUE)
state = 1
return
if(P.tool_behaviour == TOOL_WELDER)
@@ -30,7 +30,7 @@
to_chat(user, "You start to unfasten the frame...")
if(P.use_tool(src, user, 20, volume=50))
to_chat(user, "You unfasten the frame.")
- setAnchored(FALSE)
+ set_anchored(FALSE)
state = 0
return
if(istype(P, /obj/item/circuitboard/computer) && !circuit)
diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm
index 9293e9c8e76..f196fc6dc77 100644
--- a/code/game/machinery/constructable_frame.dm
+++ b/code/game/machinery/constructable_frame.dm
@@ -106,7 +106,7 @@
if(P.use_tool(src, user, 40, volume=75))
if(state == 1)
to_chat(user, "You [anchored ? "un" : ""]secure [src].")
- setAnchored(!anchored)
+ set_anchored(!anchored)
return
if(2)
@@ -114,7 +114,7 @@
to_chat(user, "You start [anchored ? "un" : ""]securing [src]...")
if(P.use_tool(src, user, 40, volume=75))
to_chat(user, "You [anchored ? "un" : ""]secure [src].")
- setAnchored(!anchored)
+ set_anchored(!anchored)
return
if(istype(P, /obj/item/circuitboard/machine))
@@ -172,7 +172,7 @@
to_chat(user, "You start [anchored ? "un" : ""]securing [src]...")
if(P.use_tool(src, user, 40, volume=75))
to_chat(user, "You [anchored ? "un" : ""]secure [src].")
- setAnchored(!anchored)
+ set_anchored(!anchored)
return
if(P.tool_behaviour == TOOL_SCREWDRIVER)
@@ -187,7 +187,7 @@
if(new_machine.circuit)
QDEL_NULL(new_machine.circuit)
new_machine.circuit = circuit
- new_machine.setAnchored(anchored)
+ new_machine.set_anchored(anchored)
new_machine.on_construction()
for(var/obj/O in new_machine.component_parts)
qdel(O)
diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm
index 4a1d449244a..8c90197d889 100644
--- a/code/game/machinery/dance_machine.dm
+++ b/code/game/machinery/dance_machine.dm
@@ -70,10 +70,10 @@
if(O.tool_behaviour == TOOL_WRENCH)
if(!anchored && !isinspace())
to_chat(user,"You secure [src] to the floor.")
- setAnchored(TRUE)
+ set_anchored(TRUE)
else if(anchored)
to_chat(user,"You unsecure and disconnect [src].")
- setAnchored(FALSE)
+ set_anchored(FALSE)
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
return
return ..()
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 7ebceb9d820..86257fc6670 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -1263,7 +1263,7 @@
A = new /obj/structure/door_assembly(loc)
//If you come across a null assemblytype, it will produce the default assembly instead of disintegrating.
A.heat_proof_finished = heat_proof //tracks whether there's rglass in
- A.setAnchored(TRUE)
+ A.set_anchored(TRUE)
A.glass = glass
A.state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS
A.created_name = name
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index 59018c13b98..f9429a546aa 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -248,7 +248,7 @@
if("rightsecure")
WA.facing = "r"
WA.secure = TRUE
- WA.setAnchored(TRUE)
+ WA.set_anchored(TRUE)
WA.state= "02"
WA.setDir(dir)
WA.ini_dir = dir
diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm
index 680a87b0637..a86a27d74b8 100644
--- a/code/game/machinery/doppler_array.dm
+++ b/code/game/machinery/doppler_array.dm
@@ -20,6 +20,7 @@
/obj/machinery/doppler_array/Initialize()
. = ..()
RegisterSignal(SSdcs, COMSIG_GLOB_EXPLOSION, .proc/sense_explosion)
+ RegisterSignal(src, COMSIG_MOVABLE_SET_ANCHORED, .proc/power_change)
printer_ready = world.time + PRINTER_TIMEOUT
/obj/machinery/doppler_array/ComponentInitialize()
@@ -114,12 +115,10 @@
/obj/machinery/doppler_array/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_WRENCH)
if(!anchored && !isinspace())
- anchored = TRUE
- power_change()
+ set_anchored(TRUE)
to_chat(user, "You fasten [src].")
else if(anchored)
- anchored = FALSE
- power_change()
+ set_anchored(FALSE)
to_chat(user, "You unfasten [src].")
I.play_tool_sound(src)
return
diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm
index dcc36d24dbf..70692c75f81 100644
--- a/code/game/machinery/flasher.dm
+++ b/code/game/machinery/flasher.dm
@@ -174,13 +174,13 @@
if (!anchored && !isinspace())
to_chat(user, "[src] is now secured.")
add_overlay("[base_state]-s")
- setAnchored(TRUE)
+ set_anchored(TRUE)
power_change()
proximity_monitor.SetRange(range)
else
to_chat(user, "[src] can now be moved.")
cut_overlays()
- setAnchored(FALSE)
+ set_anchored(FALSE)
power_change()
proximity_monitor.SetRange(0)
diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm
index 1f3edcfa4c7..bd974da88d9 100644
--- a/code/game/machinery/hologram.dm
+++ b/code/game/machinery/hologram.dm
@@ -406,7 +406,7 @@ obj/machinery/holopad/secure/Initialize()
Hologram.mouse_opacity = MOUSE_OPACITY_TRANSPARENT//So you can't click on it.
Hologram.layer = FLY_LAYER//Above all the other objects/mobs. Or the vast majority of them.
- Hologram.setAnchored(TRUE)//So space wind cannot drag it.
+ Hologram.set_anchored(TRUE)//So space wind cannot drag it.
Hologram.name = "[user.name] (Hologram)"//If someone decides to right click.
Hologram.set_light(2) //hologram lighting
move_hologram()
@@ -564,7 +564,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
holder.selected_language = record.language
Hologram.mouse_opacity = MOUSE_OPACITY_TRANSPARENT//So you can't click on it.
Hologram.layer = FLY_LAYER//Above all the other objects/mobs. Or the vast majority of them.
- Hologram.setAnchored(TRUE)//So space wind cannot drag it.
+ Hologram.set_anchored(TRUE)//So space wind cannot drag it.
Hologram.name = "[record.caller_name] (Hologram)"//If someone decides to right click.
Hologram.set_light(2) //hologram lighting
visible_message("A holographic image of [record.caller_name] flickers to life before your eyes!")
diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm
index 3231e7a10df..a8e1a879254 100644
--- a/code/game/machinery/porta_turret/portable_turret.dm
+++ b/code/game/machinery/porta_turret/portable_turret.dm
@@ -299,7 +299,7 @@
//This code handles moving the turret around. After all, it's a portable turret!
if(!anchored && !isinspace())
- setAnchored(TRUE)
+ set_anchored(TRUE)
invisibility = INVISIBILITY_MAXIMUM
update_icon()
to_chat(user, "You secure the exterior bolts on the turret.")
@@ -307,7 +307,7 @@
cover = new /obj/machinery/porta_turret_cover(loc) //create a new turret. While this is handled in process(), this is to workaround a bug where the turret becomes invisible for a split second
cover.parent_turret = src //make the cover's parent src
else if(anchored)
- setAnchored(FALSE)
+ set_anchored(FALSE)
to_chat(user, "You unsecure the exterior bolts on the turret.")
power_change()
invisibility = 0
diff --git a/code/game/machinery/porta_turret/portable_turret_construct.dm b/code/game/machinery/porta_turret/portable_turret_construct.dm
index f2164d03bf3..3cf94c1a5e0 100644
--- a/code/game/machinery/porta_turret/portable_turret_construct.dm
+++ b/code/game/machinery/porta_turret/portable_turret_construct.dm
@@ -26,7 +26,7 @@
if(I.tool_behaviour == TOOL_WRENCH && !anchored)
I.play_tool_sound(src, 100)
to_chat(user, "You secure the external bolts.")
- setAnchored(TRUE)
+ set_anchored(TRUE)
build_step = PTURRET_BOLTED
return
@@ -51,7 +51,7 @@
else if(I.tool_behaviour == TOOL_WRENCH)
I.play_tool_sound(src, 75)
to_chat(user, "You unfasten the external bolts.")
- setAnchored(FALSE)
+ set_anchored(FALSE)
build_step = PTURRET_UNSECURED
return
diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm
index 0da5ba09fe6..9508f0158db 100644
--- a/code/game/machinery/porta_turret/portable_turret_cover.dm
+++ b/code/game/machinery/porta_turret/portable_turret_cover.dm
@@ -41,12 +41,12 @@
return
if(!parent_turret.anchored)
- parent_turret.setAnchored(TRUE)
+ parent_turret.set_anchored(TRUE)
to_chat(user, "You secure the exterior bolts on the turret.")
parent_turret.invisibility = 0
parent_turret.update_icon()
else
- parent_turret.setAnchored(FALSE)
+ parent_turret.set_anchored(FALSE)
to_chat(user, "You unsecure the exterior bolts on the turret.")
parent_turret.invisibility = INVISIBILITY_MAXIMUM
parent_turret.update_icon()
diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm
index 06c91991d95..0ffed0d203e 100755
--- a/code/game/machinery/recharger.dm
+++ b/code/game/machinery/recharger.dm
@@ -57,7 +57,7 @@
if(charging)
to_chat(user, "Remove the charging item first!")
return
- setAnchored(!anchored)
+ set_anchored(!anchored)
power_change()
to_chat(user, "You [anchored ? "attached" : "detached"] [src].")
G.play_tool_sound(src)
diff --git a/code/game/machinery/roulette_machine.dm b/code/game/machinery/roulette_machine.dm
index e217aea39de..b7f1b6fac7b 100644
--- a/code/game/machinery/roulette_machine.dm
+++ b/code/game/machinery/roulette_machine.dm
@@ -90,7 +90,7 @@
return
switch(action)
if("anchor")
- anchored = !anchored
+ set_anchored(!anchored)
. = TRUE
if("ChangeBetAmount")
chosen_bet_amount = clamp(text2num(params["amount"]), 10, 500)
diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm
index 9c6fa7c7b03..09fbfc48021 100644
--- a/code/game/machinery/shieldgen.dm
+++ b/code/game/machinery/shieldgen.dm
@@ -210,14 +210,14 @@
if(!anchored && !isinspace())
W.play_tool_sound(src, 100)
to_chat(user, "You secure \the [src] to the floor!")
- setAnchored(TRUE)
+ set_anchored(TRUE)
else if(anchored)
W.play_tool_sound(src, 100)
to_chat(user, "You unsecure \the [src] from the floor!")
if(active)
to_chat(user, "\The [src] shuts off!")
shields_down()
- setAnchored(FALSE)
+ set_anchored(FALSE)
else if(W.GetID())
if(allowed(user) && !(obj_flags & EMAGGED))
diff --git a/code/game/machinery/syndicatebeacon.dm b/code/game/machinery/syndicatebeacon.dm
index bb2bb614c53..7bf0681ae9c 100644
--- a/code/game/machinery/syndicatebeacon.dm
+++ b/code/game/machinery/syndicatebeacon.dm
@@ -62,7 +62,7 @@
return
if(anchored)
- setAnchored(FALSE)
+ set_anchored(FALSE)
to_chat(user, "You unbolt \the [src] from the floor and detach it from the cable.")
disconnect_from_network()
return
@@ -70,7 +70,7 @@
if(!connect_to_network())
to_chat(user, "\The [src] must be placed over an exposed, powered cable node!")
return
- setAnchored(TRUE)
+ set_anchored(TRUE)
to_chat(user, "You bolt \the [src] to the floor and attach it to the cable.")
return
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm
index 48f7ae799c5..54f0643a89a 100644
--- a/code/game/machinery/syndicatebomb.dm
+++ b/code/game/machinery/syndicatebomb.dm
@@ -117,14 +117,14 @@
else
to_chat(user, "You firmly wrench the bomb to the floor.")
I.play_tool_sound(src)
- setAnchored(TRUE)
+ set_anchored(TRUE)
if(active)
to_chat(user, "The bolts lock in place.")
else
if(!active)
to_chat(user, "You wrench the bomb from the floor.")
I.play_tool_sound(src)
- setAnchored(FALSE)
+ set_anchored(FALSE)
else
to_chat(user, "The bolts are locked down!")
diff --git a/code/game/mecha/equipment/tools/work_tools.dm b/code/game/mecha/equipment/tools/work_tools.dm
index 9f028a65f80..11d282f3b59 100644
--- a/code/game/mecha/equipment/tools/work_tools.dm
+++ b/code/game/mecha/equipment/tools/work_tools.dm
@@ -61,15 +61,15 @@
if(!O.anchored)
if(cargo_holder.cargo.len < cargo_holder.cargo_capacity)
chassis.visible_message("[chassis] lifts [target] and starts to load it into cargo compartment.")
- O.anchored = TRUE
+ O.set_anchored(TRUE)
if(do_after_cooldown(target))
cargo_holder.cargo += O
O.forceMove(chassis)
- O.anchored = FALSE
+ O.set_anchored(FALSE)
occupant_message("[target] successfully loaded.")
log_message("Loaded [O]. Cargo compartment capacity: [cargo_holder.cargo_capacity - cargo_holder.cargo.len]", LOG_MECHA)
else
- O.anchored = initial(O.anchored)
+ O.set_anchored(initial(O.anchored))
else
occupant_message("Not enough room in cargo compartment!")
else
@@ -121,15 +121,15 @@
if(!O.anchored)
if(cargo_holder.cargo.len < cargo_holder.cargo_capacity)
chassis.visible_message("[chassis] lifts [target] and starts to load it into cargo compartment.")
- O.anchored = TRUE
+ O.set_anchored(TRUE)
if(do_after_cooldown(target))
cargo_holder.cargo += O
O.forceMove(chassis)
- O.anchored = FALSE
+ O.set_anchored(FALSE)
occupant_message("[target] successfully loaded.")
log_message("Loaded [O]. Cargo compartment capacity: [cargo_holder.cargo_capacity - cargo_holder.cargo.len]", LOG_MECHA)
else
- O.anchored = initial(O.anchored)
+ O.set_anchored(initial(O.anchored))
else
occupant_message("Not enough room in cargo compartment!")
else
diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm
index 8a0a8b342cd..504bcf37bae 100644
--- a/code/game/objects/buckling.dm
+++ b/code/game/objects/buckling.dm
@@ -115,7 +115,7 @@
if(istype(buckled_mob) && buckled_mob.buckled == src && (buckled_mob.can_unbuckle() || force))
. = buckled_mob
buckled_mob.buckled = null
- buckled_mob.anchored = initial(buckled_mob.anchored)
+ buckled_mob.set_anchored(initial(buckled_mob.anchored))
buckled_mob.update_mobility()
buckled_mob.clear_alert("buckled")
buckled_mobs -= buckled_mob
diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm
index ce424c3076e..aab94e012b7 100644
--- a/code/game/objects/items/devices/powersink.dm
+++ b/code/game/objects/items/devices/powersink.dm
@@ -29,6 +29,10 @@
/obj/item/powersink/update_icon_state()
icon_state = "powersink[mode == OPERATING]"
+/obj/item/powersink/set_anchored(anchorvalue)
+ . = ..()
+ density = anchorvalue
+
/obj/item/powersink/proc/set_mode(value)
if(value == mode)
return
@@ -37,23 +41,20 @@
attached = null
if(mode == OPERATING)
STOP_PROCESSING(SSobj, src)
- anchored = FALSE
- density = FALSE
+ set_anchored(FALSE)
if(CLAMPED_OFF)
if(!attached)
return
if(mode == OPERATING)
STOP_PROCESSING(SSobj, src)
- anchored = TRUE
- density = TRUE
+ set_anchored(TRUE)
if(OPERATING)
if(!attached)
return
START_PROCESSING(SSobj, src)
- anchored = TRUE
- density = TRUE
+ set_anchored(TRUE)
mode = value
update_icon()
diff --git a/code/game/objects/items/etherealdiscoball.dm b/code/game/objects/items/etherealdiscoball.dm
index 571b1043fb5..db35c246db2 100644
--- a/code/game/objects/items/etherealdiscoball.dm
+++ b/code/game/objects/items/etherealdiscoball.dm
@@ -38,12 +38,8 @@
/obj/structure/etherealball/AltClick(mob/living/carbon/human/user)
. = ..()
- if(anchored)
- to_chat(user, "You unlock the disco ball.")
- anchored = FALSE
- else
- to_chat(user, "You lock the disco ball.")
- anchored = TRUE
+ set_anchored(!anchored)
+ to_chat(user, "You [anchored ? null : "un"]lock the disco ball.")
/obj/structure/etherealball/proc/TurnOn()
TurnedOn = TRUE //Same
diff --git a/code/game/objects/items/puzzle_pieces.dm b/code/game/objects/items/puzzle_pieces.dm
index 4b92921d087..f45dadda293 100644
--- a/code/game/objects/items/puzzle_pieces.dm
+++ b/code/game/objects/items/puzzle_pieces.dm
@@ -140,7 +140,7 @@
/obj/item/pressure_plate/hologrid/Crossed(atom/movable/AM)
. = ..()
if(trigger_item && istype(AM, specific_item) && !claimed)
- AM.anchored = TRUE
+ AM.set_anchored(TRUE)
flick("laserbox_burn", AM)
trigger()
sleep(15)
diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm
index 93c7f8e02b3..9f1ebd71400 100644
--- a/code/game/objects/items/robot/robot_upgrades.dm
+++ b/code/game/objects/items/robot/robot_upgrades.dm
@@ -527,7 +527,7 @@
R.notransform = TRUE
var/prev_lockcharge = R.lockcharge
R.SetLockdown(1)
- R.anchored = TRUE
+ R.set_anchored(TRUE)
var/datum/effect_system/smoke_spread/smoke = new
smoke.set_up(1, R.loc)
smoke.start()
@@ -537,7 +537,7 @@
sleep(12)
if(!prev_lockcharge)
R.SetLockdown(0)
- R.anchored = FALSE
+ R.set_anchored(FALSE)
R.notransform = FALSE
R.resize = 2
R.hasExpanded = TRUE
diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm
index 1d4cf432a5d..ccc8ddd1856 100644
--- a/code/game/objects/objs.dm
+++ b/code/game/objects/objs.dm
@@ -43,13 +43,9 @@
vis_flags = VIS_INHERIT_PLANE //when this be added to vis_contents of something it inherit something.plane, important for visualisation of obj in openspace.
/obj/vv_edit_var(vname, vval)
- switch(vname)
- if("anchored")
- setAnchored(vval)
- return TRUE
- if(NAMEOF(src, obj_flags))
- if ((obj_flags & DANGEROUS_POSSESSION) && !(vval & DANGEROUS_POSSESSION))
- return FALSE
+ if(vname == NAMEOF(src, obj_flags))
+ if ((obj_flags & DANGEROUS_POSSESSION) && !(vval & DANGEROUS_POSSESSION))
+ return FALSE
return ..()
/obj/Initialize()
@@ -83,9 +79,6 @@
SStgui.close_uis(src)
. = ..()
-/obj/proc/setAnchored(anchorvalue)
- SEND_SIGNAL(src, COMSIG_OBJ_SETANCHORED, anchorvalue)
- anchored = anchorvalue
/obj/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, gentle = FALSE, quickstart = TRUE)
..()
diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm
index 5e5eab92743..72639c20ce0 100644
--- a/code/game/objects/structures/crates_lockers/closets.dm
+++ b/code/game/objects/structures/crates_lockers/closets.dm
@@ -284,7 +284,7 @@
else if(W.tool_behaviour == TOOL_WRENCH && anchorable)
if(isinspace() && !anchored)
return
- setAnchored(!anchored)
+ set_anchored(!anchored)
W.play_tool_sound(src, 75)
user.visible_message("[user] [anchored ? "anchored" : "unanchored"] \the [src] [anchored ? "to" : "from"] the ground.", \
"You [anchored ? "anchored" : "unanchored"] \the [src] [anchored ? "to" : "from"] the ground.", \
diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm
index fc9365abe5f..9271a048521 100644
--- a/code/game/objects/structures/displaycase.dm
+++ b/code/game/objects/structures/displaycase.dm
@@ -541,7 +541,7 @@
to_chat(user, "You unsecure [src].")
else
to_chat(user, "You secure [src].")
- anchored = !anchored
+ set_anchored(!anchored)
return
else if(!open && user.a_intent == INTENT_HELP)
to_chat(user, "[src] must be open to move it.")
diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm
index 6e70a13a261..66f6dd9f3a4 100644
--- a/code/game/objects/structures/door_assembly.dm
+++ b/code/game/objects/structures/door_assembly.dm
@@ -106,7 +106,7 @@
return
to_chat(user, "You secure the airlock assembly.")
name = "secured airlock assembly"
- setAnchored(TRUE)
+ set_anchored(TRUE)
else
to_chat(user, "There is another door here!")
@@ -119,7 +119,7 @@
return
to_chat(user, "You unsecure the airlock assembly.")
name = "airlock assembly"
- setAnchored(FALSE)
+ set_anchored(FALSE)
else if(istype(W, /obj/item/stack/cable_coil) && state == AIRLOCK_ASSEMBLY_NEEDS_WIRES && anchored )
if(!W.tool_start_check(user, amount=1))
@@ -295,7 +295,7 @@
target.heat_proof_finished = source.heat_proof_finished
target.created_name = source.created_name
target.state = source.state
- target.setAnchored(source.anchored)
+ target.set_anchored(source.anchored)
if(previous)
target.previous_assembly = source.type
if(electronics)
diff --git a/code/game/objects/structures/dresser.dm b/code/game/objects/structures/dresser.dm
index f7eb4c0a29d..a87a11fbec8 100644
--- a/code/game/objects/structures/dresser.dm
+++ b/code/game/objects/structures/dresser.dm
@@ -11,7 +11,7 @@
to_chat(user, "You begin to [anchored ? "unwrench" : "wrench"] [src].")
if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "You successfully [anchored ? "unwrench" : "wrench"] [src].")
- setAnchored(!anchored)
+ set_anchored(!anchored)
else
return ..()
diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm
index 38db8dceefa..ba60b1ab8b7 100644
--- a/code/game/objects/structures/grille.dm
+++ b/code/game/objects/structures/grille.dm
@@ -67,7 +67,7 @@
return FALSE
to_chat(user, "You construct the window.")
var/obj/structure/window/WD = new the_rcd.window_type(drop_location())
- WD.setAnchored(TRUE)
+ WD.set_anchored(TRUE)
return TRUE
return FALSE
@@ -136,7 +136,7 @@
else if((W.tool_behaviour == TOOL_SCREWDRIVER) && (isturf(loc) || anchored))
if(!shock(user, 90))
W.play_tool_sound(src, 100)
- setAnchored(!anchored)
+ set_anchored(!anchored)
user.visible_message("[user] [anchored ? "fastens" : "unfastens"] [src].", \
"You [anchored ? "fasten [src] to" : "unfasten [src] from"] the floor.")
return
@@ -185,7 +185,7 @@
WD = new/obj/structure/window/fulltile(drop_location()) //normal window
WD.setDir(dir_to_set)
WD.ini_dir = dir_to_set
- WD.setAnchored(FALSE)
+ WD.set_anchored(FALSE)
WD.state = 0
ST.use(2)
to_chat(user, "You place [WD] on [src].")
diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm
index 3bb560eedf9..6fae6636001 100644
--- a/code/game/objects/structures/mineral_doors.dm
+++ b/code/game/objects/structures/mineral_doors.dm
@@ -130,7 +130,7 @@
else
return ..()
-/obj/structure/mineral_door/setAnchored(anchorvalue) //called in default_unfasten_wrench() chain
+/obj/structure/mineral_door/set_anchored(anchorvalue) //called in default_unfasten_wrench() chain
. = ..()
set_opacity(anchored ? !door_opened : FALSE)
air_update_turf(TRUE)
diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm
index 7e9746423e4..f1c7125da5f 100644
--- a/code/game/objects/structures/plasticflaps.dm
+++ b/code/game/objects/structures/plasticflaps.dm
@@ -32,7 +32,7 @@
var/uraction = anchored ? "unscrew [src] from " : "screw [src] to"
user.visible_message("[user] [action] the floor.", "You start to [uraction] the floor...", "You hear rustling noises.")
if(W.use_tool(src, user, 100, volume=100, extra_checks = CALLBACK(src, .proc/check_anchored_state, anchored)))
- setAnchored(!anchored)
+ set_anchored(!anchored)
to_chat(user, "You [anchored ? "unscrew" : "screw"] [src] from the floor.")
return TRUE
else
diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm
index d7b0958e8c5..27ef38a70d2 100644
--- a/code/game/objects/structures/railings.dm
+++ b/code/game/objects/structures/railings.dm
@@ -62,7 +62,7 @@
return
to_chat(user, "You begin to [anchored ? "unfasten the railing from":"fasten the railing to"] the floor...")
if(I.use_tool(src, user, volume = 75, extra_checks = CALLBACK(src, .proc/check_anchored, anchored)))
- setAnchored(!anchored)
+ set_anchored(!anchored)
to_chat(user, "You [anchored ? "fasten the railing to":"unfasten the railing from"] the floor.")
return TRUE
diff --git a/code/game/objects/structures/reflector.dm b/code/game/objects/structures/reflector.dm
index 1b009ee6e4a..f831afd5d2a 100644
--- a/code/game/objects/structures/reflector.dm
+++ b/code/game/objects/structures/reflector.dm
@@ -113,7 +113,7 @@
"You start to weld [src] to the floor...",
"You hear welding.")
if (W.use_tool(src, user, 20, volume=50))
- setAnchored(TRUE)
+ set_anchored(TRUE)
to_chat(user, "You weld [src] to the floor.")
else
if(!W.tool_start_check(user, amount=0))
@@ -123,7 +123,7 @@
"You start to cut [src] free from the floor...",
"You hear welding.")
if (W.use_tool(src, user, 20, volume=50))
- setAnchored(FALSE)
+ set_anchored(FALSE)
to_chat(user, "You cut [src] free from the floor.")
//Finishing the frame
diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm
index 3739cb7aaf5..d630d1dcede 100644
--- a/code/game/objects/structures/windoor_assembly.dm
+++ b/code/game/objects/structures/windoor_assembly.dm
@@ -121,7 +121,7 @@
to_chat(user, "There is already a windoor in that location!")
return
to_chat(user, "You secure the windoor assembly.")
- setAnchored(TRUE)
+ set_anchored(TRUE)
if(secure)
name = "secure anchored windoor assembly"
else
@@ -136,7 +136,7 @@
if(!anchored)
return
to_chat(user, "You unsecure the windoor assembly.")
- setAnchored(FALSE)
+ set_anchored(FALSE)
if(secure)
name = "secure windoor assembly"
else
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index ac088f62ea2..6a6ddddf2dd 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -180,7 +180,7 @@
if(I.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "You begin to [anchored ? "unscrew the window from":"screw the window to"] the floor...")
if(I.use_tool(src, user, decon_speed, volume = 75, extra_checks = CALLBACK(src, .proc/check_anchored, anchored)))
- setAnchored(!anchored)
+ set_anchored(!anchored)
to_chat(user, "You [anchored ? "fasten the window to":"unfasten the window from"] the floor.")
return
else if(I.tool_behaviour == TOOL_WRENCH && !anchored)
@@ -201,7 +201,7 @@
return ..()
-/obj/structure/window/setAnchored(anchorvalue)
+/obj/structure/window/set_anchored(anchorvalue)
..()
air_update_turf(TRUE)
update_nearby_icons()
@@ -417,7 +417,7 @@
if(I.use_tool(src, user, 40, volume = 50))
to_chat(user, "You unscrew the bolts from the frame and the window pops loose.")
state = WINDOW_OUT_OF_FRAME
- setAnchored(FALSE)
+ set_anchored(FALSE)
return
return ..()
@@ -542,7 +542,7 @@
if(I.use_tool(src, user, 50, volume = 50))
to_chat(user, "You unfasten the bolts from the frame and the window pops loose.")
state = WINDOW_OUT_OF_FRAME
- setAnchored(FALSE)
+ set_anchored(FALSE)
return
return ..()
diff --git a/code/game/turfs/open/floor.dm b/code/game/turfs/open/floor.dm
index 4809789e21b..c2077af79dd 100644
--- a/code/game/turfs/open/floor.dm
+++ b/code/game/turfs/open/floor.dm
@@ -288,7 +288,7 @@
return FALSE
to_chat(user, "You construct the grille.")
var/obj/structure/grille/G = new(src)
- G.anchored = TRUE
+ G.set_anchored(TRUE)
return TRUE
if(RCD_MACHINE)
if(locate(/obj/structure/frame/machine) in src)
@@ -296,13 +296,13 @@
var/obj/structure/frame/machine/M = new(src)
M.state = 2
M.icon_state = "box_1"
- M.anchored = TRUE
+ M.set_anchored(TRUE)
return TRUE
if(RCD_COMPUTER)
if(locate(/obj/structure/frame/computer) in src)
return FALSE
var/obj/structure/frame/computer/C = new(src)
- C.anchored = TRUE
+ C.set_anchored(TRUE)
C.state = 1
C.setDir(the_rcd.computer_dir)
return TRUE
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index a5eacf48a21..3d8ad9fa0fd 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -594,10 +594,10 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
for(var/obj/machinery/field/generator/F in GLOB.machines)
if(F.active == 0)
+ F.set_anchored(TRUE)
F.active = 1
F.state = 2
F.power = 250
- F.anchored = TRUE
F.warming_up = 3
F.start_fields()
F.update_icon()
diff --git a/code/modules/antagonists/cult/cult_structures.dm b/code/modules/antagonists/cult/cult_structures.dm
index 2f51431f6dd..596d996ee07 100644
--- a/code/modules/antagonists/cult/cult_structures.dm
+++ b/code/modules/antagonists/cult/cult_structures.dm
@@ -54,14 +54,19 @@
else
..()
+/obj/structure/destructible/cult/set_anchored(anchorvalue)
+ . = ..()
+ if(isnull(.))
+ return
+ update_icon()
+
+/obj/structure/destructible/cult/update_icon_state()
+ icon_state = "[initial(icon_state)][anchored ? null : "_off"]"
+
/obj/structure/destructible/cult/attackby(obj/I, mob/user, params)
if(istype(I, /obj/item/melee/cultblade/dagger) && iscultist(user))
- anchored = !anchored
+ set_anchored(!anchored)
to_chat(user, "You [anchored ? "":"un"]secure \the [src] [anchored ? "to":"from"] the floor.")
- if(!anchored)
- icon_state = "[initial(icon_state)]_off"
- else
- icon_state = initial(icon_state)
else
return ..()
diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
index 2e3a17defc3..64dfc71b740 100644
--- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
+++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm
@@ -393,7 +393,7 @@
if(isinspace() && !anchored)
to_chat(usr, "There is nothing to anchor to!")
else
- anchored = !anchored
+ set_anchored(!anchored)
/obj/machinery/nuclearbomb/proc/set_safety()
safety = !safety
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
index c164dc5ae30..2fbfea08574 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
@@ -86,7 +86,7 @@
/obj/machinery/atmospherics/components/binary/circulator/wrench_act(mob/living/user, obj/item/I)
if(!panel_open)
return
- anchored = !anchored
+ set_anchored(!anchored)
I.play_tool_sound(src)
if(generator)
disconnectFromGenerator()
diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm
index e9aad6d08ce..5cafed8516c 100644
--- a/code/modules/awaymissions/capture_the_flag.dm
+++ b/code/modules/awaymissions/capture_the_flag.dm
@@ -71,7 +71,7 @@
if(!user.put_in_active_hand(src))
dropped(user)
return
- user.anchored = TRUE
+ user.set_anchored(TRUE)
user.status_flags &= ~CANPUSH
for(var/mob/M in GLOB.player_list)
var/area/mob_area = get_area(M)
@@ -82,7 +82,7 @@
/obj/item/ctf/dropped(mob/user)
..()
- user.anchored = FALSE
+ user.set_anchored(FALSE)
user.status_flags |= CANPUSH
reset_cooldown = world.time + 200 //20 seconds
START_PROCESSING(SSobj, src)
diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm
index c9e7e0f5a09..9dfb52c557b 100644
--- a/code/modules/clothing/spacesuits/chronosuit.dm
+++ b/code/modules/clothing/spacesuits/chronosuit.dm
@@ -95,7 +95,7 @@
user.update_atom_colour()
user.animate_movement = FORWARD_STEPS
user.notransform = 0
- user.anchored = FALSE
+ user.set_anchored(FALSE)
teleporting = 0
for(var/obj/item/I in user.held_items)
REMOVE_TRAIT(I, TRAIT_NODROP, CHRONOSUIT_TRAIT)
@@ -137,7 +137,7 @@
user.animate_movement = NO_STEPS
user.changeNext_move(8 + phase_in_ds)
user.notransform = 1
- user.anchored = TRUE
+ user.set_anchored(TRUE)
user.Stun(INFINITY)
animate(user, color = "#00ccee", time = 3)
diff --git a/code/modules/detectivework/evidence.dm b/code/modules/detectivework/evidence.dm
index ead5bd6309a..1e0c5df0c3d 100644
--- a/code/modules/detectivework/evidence.dm
+++ b/code/modules/detectivework/evidence.dm
@@ -25,7 +25,7 @@
desc = initial(desc)
/obj/item/evidencebag/proc/evidencebagEquip(obj/item/I, mob/user)
- if(!istype(I) || I.anchored == 1)
+ if(!istype(I) || I.anchored)
return
if(SEND_SIGNAL(loc, COMSIG_CONTAINS_STORAGE) && SEND_SIGNAL(I, COMSIG_CONTAINS_STORAGE))
diff --git a/code/modules/events/shuttle_loan.dm b/code/modules/events/shuttle_loan.dm
index e24eac6d922..bf68ea98ce0 100644
--- a/code/modules/events/shuttle_loan.dm
+++ b/code/modules/events/shuttle_loan.dm
@@ -260,7 +260,7 @@
/obj/machinery/syndicatebomb/shuttle_loan/Initialize()
. = ..()
- setAnchored(TRUE)
+ set_anchored(TRUE)
timer_set = rand(480, 600) //once the supply shuttle docks (after 5 minutes travel time), players have between 3-5 minutes to defuse the bomb
activate()
update_icon()
diff --git a/code/modules/hydroponics/beekeeping/beebox.dm b/code/modules/hydroponics/beekeeping/beebox.dm
index b0bb30efb46..b290f07b79b 100644
--- a/code/modules/hydroponics/beekeeping/beebox.dm
+++ b/code/modules/hydroponics/beekeeping/beebox.dm
@@ -265,4 +265,4 @@
qdel(src)
/obj/structure/beebox/unwrenched
- anchored = FALSE
+ anchored = FALSE
diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm
index 13d9aa4a19b..6a1a3b6fabd 100644
--- a/code/modules/library/lib_items.dm
+++ b/code/modules/library/lib_items.dm
@@ -1,3 +1,7 @@
+#define BOOKCASE_UNANCHORED 0
+#define BOOKCASE_ANCHORED 1
+#define BOOKCASE_FINISHED 2
+
/* Library Items
*
* Contains:
@@ -21,8 +25,7 @@
resistance_flags = FLAMMABLE
max_integrity = 200
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 0)
- var/state = 0
- var/list/allowed_books = list(/obj/item/book, /obj/item/spellbook, /obj/item/storage/book) //Things allowed in the bookcase
+ var/state = BOOKCASE_UNANCHORED
/// When enabled, books_to_load number of random books will be generated for this bookcase when first interacted with.
var/load_random_books = FALSE
/// The category of books to pick from when populating random books.
@@ -37,55 +40,66 @@
else
. += "It's secured in place with bolts."
switch(state)
- if(0)
+ if(BOOKCASE_UNANCHORED)
. += "There's a small crack visible on the back panel."
- if(1)
+ if(BOOKCASE_ANCHORED)
. += "There's space inside for a wooden shelf."
- if(2)
+ if(BOOKCASE_FINISHED)
. += "There's a small crack visible on the shelf."
/obj/structure/bookcase/Initialize(mapload)
. = ..()
if(!mapload)
return
- state = 2
- icon_state = "book-0"
- anchored = TRUE
+ set_anchored(TRUE)
+ state = BOOKCASE_FINISHED
for(var/obj/item/I in loc)
- if(istype(I, /obj/item/book))
- I.forceMove(src)
+ if(!isbook(I))
+ continue
+ I.forceMove(src)
+ update_icon()
+
+/obj/structure/bookcase/set_anchored(anchorvalue)
+ . = ..()
+ if(isnull(.))
+ return
+ state = anchorvalue
+ if(!anchorvalue) //in case we were vareditted or uprooted by a hostile mob, ensure we drop all our books instead of having them disappear till we're rebuild.
+ var/atom/Tsec = drop_location()
+ for(var/obj/I in contents)
+ if(!isbook(I))
+ continue
+ I.forceMove(Tsec)
update_icon()
/obj/structure/bookcase/attackby(obj/item/I, mob/user, params)
switch(state)
- if(0)
+ if(BOOKCASE_UNANCHORED)
if(I.tool_behaviour == TOOL_WRENCH)
if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "You wrench the frame into place.")
- anchored = TRUE
- state = 1
- if(I.tool_behaviour == TOOL_CROWBAR)
+ set_anchored(TRUE)
+ else if(I.tool_behaviour == TOOL_CROWBAR)
if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "You pry the frame apart.")
deconstruct(TRUE)
- if(1)
+ if(BOOKCASE_ANCHORED)
if(istype(I, /obj/item/stack/sheet/mineral/wood))
var/obj/item/stack/sheet/mineral/wood/W = I
if(W.get_amount() >= 2)
W.use(2)
to_chat(user, "You add a shelf.")
- state = 2
- icon_state = "book-0"
- if(I.tool_behaviour == TOOL_WRENCH)
+ state = BOOKCASE_FINISHED
+ update_icon()
+ else if(I.tool_behaviour == TOOL_WRENCH)
I.play_tool_sound(src, 100)
to_chat(user, "You unwrench the frame.")
- anchored = FALSE
- state = 0
+ set_anchored(FALSE)
- if(2)
+ if(BOOKCASE_FINISHED)
var/datum/component/storage/STR = I.GetComponent(/datum/component/storage)
- if(is_type_in_list(I, allowed_books))
+ if(isbook(I))
if(!user.transferItemToLoc(I, src))
return
update_icon()
@@ -113,8 +127,8 @@
I.play_tool_sound(src, 100)
to_chat(user, "You pry the shelf out.")
new /obj/item/stack/sheet/mineral/wood(drop_location(), 2)
- state = 1
- icon_state = "bookempty"
+ state = BOOKCASE_ANCHORED
+ update_icon()
else
return ..()
@@ -142,17 +156,24 @@
/obj/structure/bookcase/deconstruct(disassembled = TRUE)
- new /obj/item/stack/sheet/mineral/wood(loc, 4)
- for(var/obj/item/book/B in contents)
- B.forceMove(get_turf(src))
- qdel(src)
+ var/atom/Tsec = drop_location()
+ new /obj/item/stack/sheet/mineral/wood(Tsec, 4)
+ for(var/obj/item/I in contents)
+ if(!isbook(I))
+ continue
+ I.forceMove(Tsec)
+ return ..()
/obj/structure/bookcase/update_icon_state()
+ if(state == BOOKCASE_UNANCHORED)
+ icon_state = "bookempty"
+ return
+
var/amount = contents.len
if(load_random_books)
amount += books_to_load
- icon_state = "book-[amount < 5 ? amount : 5]"
+ icon_state = "book-[clamp(amount, 0, 5)]"
/obj/structure/bookcase/manuals/engineering
@@ -351,3 +372,8 @@
else
to_chat(user, "No associated computer found. Only local scans will function properly.")
to_chat(user, "\n")
+
+
+#undef BOOKCASE_UNANCHORED
+#undef BOOKCASE_ANCHORED
+#undef BOOKCASE_FINISHED
diff --git a/code/modules/mining/abandoned_crates.dm b/code/modules/mining/abandoned_crates.dm
index 7b17fa03820..17af647cc64 100644
--- a/code/modules/mining/abandoned_crates.dm
+++ b/code/modules/mining/abandoned_crates.dm
@@ -218,7 +218,7 @@
new /obj/item/banhammer(src)
for(var/i in 1 to 3)
var/obj/effect/mine/sound/bwoink/mine = new (src)
- mine.anchored = FALSE
+ mine.set_anchored(FALSE)
mine.move_resist = MOVE_RESIST_DEFAULT
if(97)
for(var/i in 1 to 4)
diff --git a/code/modules/mining/fulton.dm b/code/modules/mining/fulton.dm
index ed3dd4fa207..1f970b121a0 100644
--- a/code/modules/mining/fulton.dm
+++ b/code/modules/mining/fulton.dm
@@ -81,7 +81,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons)
M.Paralyze(320) // Keep them from moving during the duration of the extraction
M.buckled = 0 // Unbuckle them to prevent anchoring problems
else
- A.anchored = TRUE
+ A.set_anchored(TRUE)
A.density = FALSE
var/obj/effect/extraction_holder/holder_obj = new(A.loc)
holder_obj.appearance = A.appearance
@@ -132,7 +132,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons)
holder_obj.add_overlay(balloon3)
sleep(4)
holder_obj.cut_overlay(balloon3)
- A.anchored = FALSE // An item has to be unanchored to be extracted in the first place.
+ A.set_anchored(FALSE) // An item has to be unanchored to be extracted in the first place.
A.density = initial(A.density)
animate(holder_obj, pixel_z = 0, time = 5)
sleep(5)
diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm
index 3a848165d13..8db514ba47b 100644
--- a/code/modules/mob/living/silicon/robot/robot_modules.dm
+++ b/code/modules/mob/living/silicon/robot/robot_modules.dm
@@ -218,7 +218,7 @@
flick("[cyborg_base_icon]_transform", R)
R.notransform = TRUE
R.SetLockdown(1)
- R.anchored = TRUE
+ R.set_anchored(TRUE)
sleep(1)
for(var/i in 1 to 4)
playsound(R, pick('sound/items/drill_use.ogg', 'sound/items/jaws_cut.ogg', 'sound/items/jaws_pry.ogg', 'sound/items/welder.ogg', 'sound/items/ratchet.ogg'), 80, TRUE, -1)
@@ -226,7 +226,7 @@
if(!prev_lockcharge)
R.SetLockdown(0)
R.setDir(SOUTH)
- R.anchored = FALSE
+ R.set_anchored(FALSE)
R.notransform = FALSE
R.updatehealth()
R.update_headlamp(FALSE, BORG_LAMP_CD_RESET)
diff --git a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm
index 518572b1449..4fb39e54783 100644
--- a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm
+++ b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm
@@ -77,7 +77,7 @@
if(Adjacent(target) && isturf(target.loc)) // if right next to perp
target_lastloc = target.loc //stun_attack() can clear the target if they're dead, so this needs to be set first
stun_attack(target)
- anchored = TRUE
+ set_anchored(TRUE)
return
else // not next to perp
var/turf/olddist = get_dist(src, target)
diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm
index d825667116d..62fcac4897c 100644
--- a/code/modules/mob/living/simple_animal/bot/floorbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm
@@ -148,7 +148,7 @@
if("autotile")
autotile = !autotile
if("anchor")
- anchored = !anchored
+ set_anchored(!anchored)
if("eject")
if(specialtiles && tiletype != null)
empty_tiles()
@@ -235,7 +235,7 @@
repair(target)
else if(emagged == 2 && isfloorturf(target))
var/turf/open/floor/F = target
- anchored = TRUE
+ set_anchored(TRUE)
mode = BOT_REPAIRING
F.ReplaceWithLattice()
audible_message("[src] makes an excited booping sound.")
@@ -283,11 +283,11 @@
if(HULL_BREACH) //The most common job, patching breaches in the station's hull.
if(is_hull_breach(scan_target)) //Ensure that the targeted space turf is actually part of the station, and not random space.
result = scan_target
- anchored = TRUE //Prevent the floorbot being blown off-course while trying to reach a hull breach.
+ set_anchored(TRUE) //Prevent the floorbot being blown off-course while trying to reach a hull breach.
if(LINE_SPACE_MODE) //Space turfs in our chosen direction are considered.
if(get_dir(src, scan_target) == targetdirection)
result = scan_target
- anchored = TRUE
+ set_anchored(TRUE)
if(PLACE_TILE)
F = scan_target
if(isplatingturf(F)) //The floor must not already have a tile.
@@ -318,7 +318,7 @@
else if(!isfloorturf(target_turf))
return
if(isspaceturf(target_turf)) //If we are fixing an area not part of pure space, it is
- anchored = TRUE
+ set_anchored(TRUE)
icon_state = "[toolbox_color]floorbot-c"
visible_message("[targetdirection ? "[src] begins installing a bridge plating." : "[src] begins to repair the hole."] ")
mode = BOT_REPAIRING
@@ -333,7 +333,7 @@
var/turf/open/floor/F = target_turf
if(F.type != initial(tiletype.turf_type) && (F.broken || F.burnt || isplatingturf(F)) || F.type == (initial(tiletype.turf_type) && (F.broken || F.burnt)))
- anchored = TRUE
+ set_anchored(TRUE)
icon_state = "[toolbox_color]floorbot-c"
mode = BOT_REPAIRING
visible_message("[src] begins repairing the floor.")
@@ -344,7 +344,7 @@
F.PlaceOnTop(/turf/open/floor/plasteel, flags = CHANGETURF_INHERIT_AIR)
if(replacetiles && F.type != initial(tiletype.turf_type) && specialtiles && !isplatingturf(F))
- anchored = TRUE
+ set_anchored(TRUE)
icon_state = "[toolbox_color]floorbot-c"
mode = BOT_REPAIRING
visible_message("[src] begins replacing the floor tiles.")
diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm
index 73feb8384a5..1c097e736df 100644
--- a/code/modules/mob/living/simple_animal/bot/honkbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm
@@ -250,7 +250,7 @@ Maintenance panel panel is [open ? "opened" : "closed"]"},
if(threatlevel >= 6)
set waitfor = 0
stun_attack(target)
- anchored = FALSE
+ set_anchored(FALSE)
target_lastloc = target.loc
return
diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm
index 557c3135938..5975700e3a6 100644
--- a/code/modules/mob/living/simple_animal/bot/secbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/secbot.dm
@@ -325,7 +325,7 @@ Auto Patrol: []"},
stun_attack(target)
mode = BOT_PREP_ARREST
- anchored = TRUE
+ set_anchored(TRUE)
target_lastloc = target.loc
return
@@ -359,7 +359,7 @@ Auto Patrol: []"},
if(BOT_ARREST)
if(!target)
- anchored = FALSE
+ set_anchored(FALSE)
mode = BOT_IDLE
last_found = world.time
frustration = 0
@@ -377,7 +377,7 @@ Auto Patrol: []"},
return
else //Try arresting again if the target escapes.
mode = BOT_PREP_ARREST
- anchored = FALSE
+ set_anchored(FALSE)
if(BOT_START_PATROL)
look_for_perp()
diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm
index e4a9f8168dc..2ce129daa0d 100644
--- a/code/modules/paperwork/filingcabinet.dm
+++ b/code/modules/paperwork/filingcabinet.dm
@@ -50,7 +50,7 @@
to_chat(user, "You begin to [anchored ? "unwrench" : "wrench"] [src].")
if(P.use_tool(src, user, 20, volume=50))
to_chat(user, "You successfully [anchored ? "unwrench" : "wrench"] [src].")
- anchored = !anchored
+ set_anchored(!anchored)
else if(P.w_class < WEIGHT_CLASS_NORMAL)
if(!user.transferItemToLoc(P, src))
return
diff --git a/code/modules/plumbing/ducts.dm b/code/modules/plumbing/ducts.dm
index d57dec29d5b..cb94f281dba 100644
--- a/code/modules/plumbing/ducts.dm
+++ b/code/modules/plumbing/ducts.dm
@@ -41,7 +41,7 @@ All the important duct code:
if(no_anchor)
active = FALSE
- anchored = FALSE
+ set_anchored(FALSE)
else if(!can_anchor())
qdel(src)
CRASH("Overlapping ducts detected")
@@ -152,8 +152,9 @@ All the important duct code:
return TRUE
///we disconnect ourself from our neighbours. we also destroy our ductnet and tell our neighbours to make a new one
-/obj/machinery/duct/proc/disconnect_duct()
- anchored = FALSE
+/obj/machinery/duct/proc/disconnect_duct(skipanchor)
+ if(!skipanchor) //since set_anchored calls us too.
+ set_anchored(FALSE)
active = FALSE
if(duct)
duct.remove_duct(src)
@@ -272,24 +273,26 @@ All the important duct code:
pixel_y = offset
+/obj/machinery/duct/set_anchored(anchorvalue)
+ . = ..()
+ if(isnull(.))
+ return
+ if(anchorvalue)
+ active = TRUE
+ attempt_connect()
+ else
+ disconnect_duct(TRUE)
+
/obj/machinery/duct/wrench_act(mob/living/user, obj/item/I) //I can also be the RPD
..()
add_fingerprint(user)
I.play_tool_sound(src)
- if(anchored)
+ if(anchored || can_anchor())
+ set_anchored(!anchored)
user.visible_message( \
- "[user] unfastens \the [src].", \
- "You unfasten \the [src].", \
+ "[user] [anchored ? null : "un"]fastens \the [src].", \
+ "You [anchored ? null : "un"]fasten \the [src].", \
"You hear ratcheting.")
- disconnect_duct()
- else if(can_anchor())
- anchored = TRUE
- active = TRUE
- user.visible_message( \
- "[user] fastens \the [src].", \
- "You fasten \the [src].", \
- "You hear ratcheting.")
- attempt_connect()
return TRUE
///collection of all the sanity checks to prevent us from stacking ducts that shouldn't be stacked
/obj/machinery/duct/proc/can_anchor(turf/T)
diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm
index e5940e2ad84..5f723f72c6e 100644
--- a/code/modules/power/generator.dm
+++ b/code/modules/power/generator.dm
@@ -189,7 +189,7 @@
. = ..()
if(!panel_open)
return
- anchored = !anchored
+ set_anchored(!anchored)
I.play_tool_sound(src)
if(!anchored)
kill_circs()
diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm
index 47ca16f3a2a..636ad2b3488 100644
--- a/code/modules/power/port_gen.dm
+++ b/code/modules/power/port_gen.dm
@@ -172,6 +172,15 @@
/obj/machinery/power/port_gen/pacman/proc/overheat()
explosion(src.loc, 2, 5, 2, -1)
+/obj/machinery/power/port_gen/pacman/set_anchored(anchorvalue)
+ . = ..()
+ if(isnull(.))
+ return //no need to process if we didn't change anything.
+ if(anchorvalue)
+ connect_to_network()
+ else
+ disconnect_from_network()
+
/obj/machinery/power/port_gen/pacman/attackby(obj/item/O, mob/user, params)
if(istype(O, sheet_path))
var/obj/item/stack/addstack = O
@@ -186,12 +195,10 @@
else if(!active)
if(O.tool_behaviour == TOOL_WRENCH)
if(!anchored && !isinspace())
- anchored = TRUE
- connect_to_network()
+ set_anchored(TRUE)
to_chat(user, "You secure the generator to the floor.")
else if(anchored)
- anchored = FALSE
- disconnect_from_network()
+ set_anchored(FALSE)
to_chat(user, "You unsecure the generator from the floor.")
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index a2f6603ef47..369224af6dc 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -23,8 +23,9 @@
var/drainratio = 1
var/powerproduction_drain = 0.001
-/obj/machinery/power/rad_collector/anchored
- anchored = TRUE
+/obj/machinery/power/rad_collector/anchored/Initialize()
+ . = ..()
+ set_anchored(TRUE)
/obj/machinery/power/rad_collector/anchored/delta //Deltastation's engine is shared by engineers and atmos techs
desc = "A device which uses Hawking Radiation and plasma to produce power. This model allows access by Atmospheric Technicians."
@@ -77,13 +78,14 @@
return FAILED_UNFASTEN
return ..()
-/obj/machinery/power/rad_collector/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
+/obj/machinery/power/rad_collector/set_anchored(anchorvalue)
. = ..()
- if(. == SUCCESSFUL_UNFASTEN)
- if(anchored)
- connect_to_network()
- else
- disconnect_from_network()
+ if(isnull(.))
+ return //no need to process if we didn't change anything.
+ if(anchorvalue)
+ connect_to_network()
+ else
+ disconnect_from_network()
/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/tank/internals/plasma))
diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm
index 59e49a35ef7..3d0fe96f2a7 100644
--- a/code/modules/power/singularity/emitter.dm
+++ b/code/modules/power/singularity/emitter.dm
@@ -60,7 +60,7 @@
wires = new /datum/wires/emitter(src)
if(welded)
if(!anchored)
- setAnchored(TRUE)
+ set_anchored(TRUE)
connect_to_network()
sparks = new
@@ -71,7 +71,7 @@
. = ..()
AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
-/obj/machinery/power/emitter/setAnchored(anchorvalue)
+/obj/machinery/power/emitter/set_anchored(anchorvalue)
. = ..()
if(!anchored && welded) //make sure they're keep in sync in case it was forcibly unanchored by badmins or by a megafauna.
welded = FALSE
@@ -168,7 +168,7 @@
/obj/machinery/power/emitter/attack_animal(mob/living/simple_animal/M)
if(ismegafauna(M) && anchored)
- setAnchored(FALSE)
+ set_anchored(FALSE)
M.visible_message("[M] rips [src] free from its moorings!")
else
. = ..()
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index 45172ba50e0..4eb625c73ea 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -61,7 +61,7 @@ field_generator power level display
/obj/machinery/field/generator/anchored/Initialize()
. = ..()
- setAnchored(TRUE)
+ set_anchored(TRUE)
/obj/machinery/field/generator/ComponentInitialize()
. = ..()
@@ -88,8 +88,10 @@ field_generator power level display
else
to_chat(user, "[src] needs to be firmly secured to the floor first!")
-/obj/machinery/field/generator/setAnchored(anchorvalue)
+/obj/machinery/field/generator/set_anchored(anchorvalue)
. = ..()
+ if(isnull(.))
+ return
if(active)
turn_off()
state = anchorvalue ? FG_SECURED : FG_UNSECURED
@@ -147,7 +149,7 @@ field_generator power level display
/obj/machinery/field/generator/attack_animal(mob/living/simple_animal/M)
if(M.environment_smash & ENVIRONMENT_SMASH_RWALLS && active == FG_OFFLINE && state != FG_UNSECURED)
- setAnchored(FALSE)
+ set_anchored(FALSE)
M.visible_message("[M] rips [src] free from its moorings!")
else
..()
diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
index a37aa2a2ca3..816fa750795 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm
@@ -59,6 +59,14 @@
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
+/obj/structure/particle_accelerator/set_anchored(anchorvalue)
+ . = ..()
+ if(isnull(.))
+ return
+ construction_state = anchorvalue ? PA_CONSTRUCTION_UNWIRED : PA_CONSTRUCTION_UNSECURED
+ update_state()
+ update_icon()
+
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params)
var/did_something = FALSE
@@ -66,19 +74,19 @@
if(PA_CONSTRUCTION_UNSECURED)
if(W.tool_behaviour == TOOL_WRENCH && !isinspace())
W.play_tool_sound(src, 75)
- anchored = TRUE
+ set_anchored(TRUE)
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
- construction_state = PA_CONSTRUCTION_UNWIRED
- did_something = TRUE
+ user.changeNext_move(CLICK_CD_MELEE)
+ return //set_anchored handles the rest of the stuff we need to do.
if(PA_CONSTRUCTION_UNWIRED)
if(W.tool_behaviour == TOOL_WRENCH)
W.play_tool_sound(src, 75)
- anchored = FALSE
+ set_anchored(FALSE)
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
- construction_state = PA_CONSTRUCTION_UNSECURED
- did_something = TRUE
+ user.changeNext_move(CLICK_CD_MELEE)
+ return //set_anchored handles the rest of the stuff we need to do.
else if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/CC = W
if(CC.use(1))
diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm
index f26edda43fc..d5a3179731b 100644
--- a/code/modules/power/singularity/particle_accelerator/particle_control.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm
@@ -199,6 +199,14 @@
if(PA_CONSTRUCTION_PANEL_OPEN)
. += "The panel is open."
+/obj/machinery/particle_accelerator/control_box/set_anchored(anchorvalue)
+ . = ..()
+ if(isnull(.))
+ return
+ construction_state = anchorvalue ? PA_CONSTRUCTION_UNWIRED : PA_CONSTRUCTION_UNSECURED
+ update_state()
+ update_icon()
+
/obj/machinery/particle_accelerator/control_box/attackby(obj/item/W, mob/user, params)
var/did_something = FALSE
@@ -206,19 +214,19 @@
if(PA_CONSTRUCTION_UNSECURED)
if(W.tool_behaviour == TOOL_WRENCH && !isinspace())
W.play_tool_sound(src, 75)
- anchored = TRUE
+ set_anchored(TRUE)
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
- construction_state = PA_CONSTRUCTION_UNWIRED
- did_something = TRUE
+ user.changeNext_move(CLICK_CD_MELEE)
+ return //set_anchored handles the rest of the stuff we need to do.
if(PA_CONSTRUCTION_UNWIRED)
if(W.tool_behaviour == TOOL_WRENCH)
W.play_tool_sound(src, 75)
- anchored = FALSE
+ set_anchored(FALSE)
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
- construction_state = PA_CONSTRUCTION_UNSECURED
- did_something = TRUE
+ user.changeNext_move(CLICK_CD_MELEE)
+ return //set_anchored handles the rest of the stuff we need to do.
else if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/CC = W
if(CC.use(1))
@@ -250,7 +258,7 @@
update_icon()
return
- ..()
+ return ..()
/obj/machinery/particle_accelerator/control_box/blob_act(obj/structure/blob/B)
if(prob(50))
diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm
index c8bdb7831f6..57c23691f1a 100644
--- a/code/modules/power/solar.dm
+++ b/code/modules/power/solar.dm
@@ -59,7 +59,7 @@
if(!S)
S = new /obj/item/solar_assembly(src)
S.glass_type = /obj/item/stack/sheet/glass
- S.anchored = TRUE
+ S.set_anchored(TRUE)
else
S.forceMove(src)
if(S.glass_type == /obj/item/stack/sheet/rglass) //if the panel is in reinforced glass
@@ -235,7 +235,7 @@
if(isinspace())
to_chat(user, "You can't secure [src] here.")
return
- anchored = !anchored
+ set_anchored(!anchored)
if(anchored)
user.visible_message("[user] wrenches the solar assembly into place.", "You wrench the solar assembly into place.")
W.play_tool_sound(src, 75)
@@ -414,7 +414,7 @@
A.circuit = M
A.state = 3
A.icon_state = "3"
- A.anchored = TRUE
+ A.set_anchored(TRUE)
qdel(src)
else
to_chat(user, "You disconnect the monitor.")
@@ -425,7 +425,7 @@
A.circuit = M
A.state = 4
A.icon_state = "4"
- A.anchored = TRUE
+ A.set_anchored(TRUE)
qdel(src)
else if(user.a_intent != INTENT_HARM && !(I.item_flags & NOBLUDGEON))
attack_hand(user)
diff --git a/code/modules/power/tracker.dm b/code/modules/power/tracker.dm
index 577014b1832..9619a3a73fb 100644
--- a/code/modules/power/tracker.dm
+++ b/code/modules/power/tracker.dm
@@ -50,7 +50,7 @@
S = new /obj/item/solar_assembly(src)
S.glass_type = /obj/item/stack/sheet/glass
S.tracker = 1
- S.anchored = TRUE
+ S.set_anchored(TRUE)
S.forceMove(src)
/obj/machinery/power/tracker/crowbar_act(mob/user, obj/item/I)
diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm
index f8eb5607209..db07523ef1a 100644
--- a/code/modules/recycling/disposal/bin.dm
+++ b/code/modules/recycling/disposal/bin.dm
@@ -228,7 +228,7 @@
if(stored)
stored.forceMove(T)
src.transfer_fingerprints_to(stored)
- stored.anchored = FALSE
+ stored.set_anchored(FALSE)
stored.density = TRUE
stored.update_icon()
for(var/atom/movable/AM in src) //out, out, darned crowbar!
diff --git a/code/modules/recycling/disposal/construction.dm b/code/modules/recycling/disposal/construction.dm
index b97d3a77b5f..a548e699b6a 100644
--- a/code/modules/recycling/disposal/construction.dm
+++ b/code/modules/recycling/disposal/construction.dm
@@ -13,12 +13,18 @@
var/obj/pipe_type = /obj/structure/disposalpipe/segment
var/pipename
+/obj/structure/disposalconstruct/set_anchored(anchorvalue)
+ . = ..()
+ if(isnull(.))
+ return
+ density = anchorvalue ? initial(pipe_type.density) : FALSE
+
/obj/structure/disposalconstruct/Initialize(loc, _pipe_type, _dir = SOUTH, flip = FALSE, obj/make_from)
. = ..()
if(make_from)
pipe_type = make_from.type
setDir(make_from.dir)
- anchored = TRUE
+ set_anchored(TRUE)
else
if(_pipe_type)
@@ -104,8 +110,7 @@
/obj/structure/disposalconstruct/wrench_act(mob/living/user, obj/item/I)
..()
if(anchored)
- anchored = FALSE
- density = FALSE
+ set_anchored(FALSE)
to_chat(user, "You detach the [pipename] from the underfloor.")
else
var/ispipe = is_pipe() // Indicates if we should change the level of this pipe
@@ -140,8 +145,7 @@
to_chat(user, "The [pipename] requires a trunk underneath it in order to work!")
return TRUE
- anchored = TRUE
- density = initial(pipe_type.density)
+ set_anchored(TRUE)
to_chat(user, "You attach the [pipename] to the underfloor.")
I.play_tool_sound(src, 100)
update_icon()
diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm
index 144f38ec681..006ce3abaa4 100644
--- a/code/modules/spells/spell.dm
+++ b/code/modules/spells/spell.dm
@@ -331,7 +331,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
var/obj/effect/overlay/spell = new /obj/effect/overlay(location)
spell.icon = overlay_icon
spell.icon_state = overlay_icon_state
- spell.anchored = TRUE
+ spell.set_anchored(TRUE)
spell.density = FALSE
QDEL_IN(spell, overlay_lifespan)
diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm
index e9b8d039cc3..34f006110f4 100644
--- a/code/modules/station_goals/shield.dm
+++ b/code/modules/station_goals/shield.dm
@@ -102,6 +102,19 @@
/obj/machinery/satellite/interact(mob/user)
toggle(user)
+/obj/machinery/satellite/set_anchored(anchorvalue)
+ . = ..()
+ if(isnull(.))
+ return //no need to process if we didn't change anything.
+ active = anchorvalue
+ if(anchorvalue)
+ begin_processing()
+ animate(src, pixel_y = 2, time = 10, loop = -1)
+ else
+ end_processing()
+ animate(src, pixel_y = 0, time = 10)
+ update_icon()
+
/obj/machinery/satellite/proc/toggle(mob/user)
if(!active && !isinspace())
if(user)
@@ -109,16 +122,7 @@
return FALSE
if(user)
to_chat(user, "You [active ? "deactivate": "activate"] [src].")
- active = !active
- if(active)
- begin_processing()
- animate(src, pixel_y = 2, time = 10, loop = -1)
- anchored = TRUE
- else
- end_processing()
- animate(src, pixel_y = 0, time = 10)
- anchored = FALSE
- update_icon()
+ set_anchored(!anchored)
/obj/machinery/satellite/update_icon_state()
icon_state = active ? "sat_active" : "sat_inactive"