diff --git a/code/__DEFINES/dcs/signals/signals_movable.dm b/code/__DEFINES/dcs/signals/signals_movable.dm index 87b6b97c4a587..077ef19d0b78d 100644 --- a/code/__DEFINES/dcs/signals/signals_movable.dm +++ b/code/__DEFINES/dcs/signals/signals_movable.dm @@ -39,13 +39,16 @@ #define HEARING_SPANS 6 #define HEARING_MESSAGE_MODE 7 -#define COMSIG_MOVABLE_DISPOSING "movable_disposing" //! called when the movable is added to a disposal holder object for disposal movement: (obj/structure/disposalholder/holder, obj/machinery/disposal/source) +///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" ///from base of atom/movable/setGrabState(): (newstate) #define COMSIG_MOVABLE_SET_GRAB_STATE "living_set_grab_state" // called when movable is expelled from a disposal pipe, bin or outlet on obj/pipe_eject: (direction) #define COMSIG_MOVABLE_PIPE_EJECTING "movable_pipe_ejecting" +///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" ///from base of atom/movable/newtonian_move(): (inertia_direction) #define COMSIG_MOVABLE_NEWTONIAN_MOVE "movable_newtonian_move" diff --git a/code/__DEFINES/dcs/signals/signals_obj/signals_object.dm b/code/__DEFINES/dcs/signals/signals_obj/signals_object.dm index 8f6afe47b29ba..638cb96e503c2 100644 --- a/code/__DEFINES/dcs/signals/signals_obj/signals_object.dm +++ b/code/__DEFINES/dcs/signals/signals_obj/signals_object.dm @@ -5,7 +5,6 @@ // /obj signals #define COMSIG_OBJ_DEFAULT_UNFASTEN_WRENCH "obj_default_unfasten_wrench" #define COMSIG_OBJ_DECONSTRUCT "obj_deconstruct" //! from base of obj/deconstruct(): (disassembled) -#define COMSIG_OBJ_SETANCHORED "obj_setanchored" //! called in /obj/structure/setAnchored(): (value) #define COMSIG_OBJ_HIDE "obj_hide" //from base of /turf/proc/levelupdate(). (intact) true to hide and false to unhide /// from /obj/proc/make_unfrozen() diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 6aad1fe121de4..a5707b237f125 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -295,6 +295,13 @@ GLOBAL_LIST_INIT(glass_sheet_types, typecacheof(list( #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))) + /// isnum() returns TRUE for NaN. Also, NaN != NaN. Checkmate, BYOND. #define isnan(x) ( (x) != (x) ) @@ -302,8 +309,6 @@ GLOBAL_LIST_INIT(glass_sheet_types, typecacheof(list( #define isProbablyWallMounted(O) (O.pixel_x > 20 || O.pixel_x < -20 || O.pixel_y > 20 || O.pixel_y < -20) -#define isbook(O) (is_type_in_typecache(O, GLOB.book_types)) - /// NaN isn't a number, damn it. Infinity is a problem too. #define isnum_safe(x) ( isnum((x)) && !isnan((x)) && !isinf((x)) ) diff --git a/code/datums/components/cult_ritual_item.dm b/code/datums/components/cult_ritual_item.dm index 418f2b3edbbf1..05dee4e7ad90b 100644 --- a/code/datums/components/cult_ritual_item.dm +++ b/code/datums/components/cult_ritual_item.dm @@ -191,7 +191,7 @@ */ /datum/component/cult_ritual_item/proc/do_unanchor_structure(obj/structure/cult_structure, mob/living/cultist) playsound(cult_structure, 'sound/items/deconstruct.ogg', 30, TRUE, ignore_walls = FALSE) - cult_structure.anchored = !cult_structure.anchored + cult_structure.set_anchored(!cult_structure.anchored) to_chat(cultist, "You [cult_structure.anchored ? "":"un"]secure \the [cult_structure] [cult_structure.anchored ? "to":"from"] the floor.") /* diff --git a/code/datums/elements/undertile.dm b/code/datums/elements/undertile.dm index 1be1dcf7f2eb1..24c3d246fe70f 100644 --- a/code/datums/elements/undertile.dm +++ b/code/datums/elements/undertile.dm @@ -55,7 +55,7 @@ if(use_alpha) source.alpha = ALPHA_UNDERTILE if(use_anchor) - source.anchored = TRUE + source.set_anchored(TRUE) else if(invisibility_trait) @@ -65,7 +65,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/syndicatebomb.dm b/code/datums/wires/syndicatebomb.dm index c125a26515c76..7e6e5fd0d4e56 100644 --- a/code/datums/wires/syndicatebomb.dm +++ b/code/datums/wires/syndicatebomb.dm @@ -90,7 +90,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, 1) - 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 878bf3ca7e5f2..24fe65dfaaa5e 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -1,5 +1,8 @@ /atom/movable layer = OBJ_LAYER + glide_size = 8 + appearance_flags = TILE_BOUND|PIXEL_SCALE + var/move_stacks = 0 //how many times a this movable had movement procs called on it since Moved() was last called var/last_move = null var/last_move_time = 0 @@ -13,6 +16,7 @@ var/mob/pulledby = null var/initial_language_holder = /datum/language_holder var/datum/language_holder/language_holder // Mindless mobs and objects need language too, some times. Mind holder takes prescedence. + var/verb_say = "says" var/verb_ask = "asks" var/verb_exclaim = "exclaims" @@ -33,8 +37,6 @@ ///Holds information about any movement loops currently running/waiting to run on the movable. Lazy, will be null if nothing's going on var/datum/movement_packet/move_packet var/list/acted_explosions //for explosion dodging - glide_size = 8 - appearance_flags = TILE_BOUND|PIXEL_SCALE var/datum/forced_movement/force_moving = null //handled soley by forced_movement.dm var/movement_type = GROUND //Incase you have multiple types, you automatically use the most useful one. IE: Skating on ice, flippers on water, flying over chasm/space, etc. var/atom/movable/pulling @@ -115,7 +117,11 @@ return FALSE //PLEASE no. 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) @@ -577,6 +583,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 == null) //destination destroyed due to explosion @@ -696,7 +711,7 @@ if (pulledby) pulledby.stop_pulling() - + //They are moving! Wouldn't it be cool if we calculated their momentum and added it to the throw? if (thrower && thrower.last_move && thrower.client && thrower.client.move_delay >= world.time + world.tick_lag*2) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 1298e780a4a6c..ca03a01466159 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -547,7 +547,7 @@ Class Procs: new_frame.icon_state = "box_1" . = new_frame - new_frame.anchored = TRUE + new_frame.set_anchored(TRUE) if(!disassembled) new_frame.obj_integrity = new_frame.max_integrity * 0.5 //the frame is already half broken transfer_fingerprints_to(new_frame) @@ -639,7 +639,7 @@ Class Procs: to_chat(user, "You fail to secure [src].") return CANT_UNFASTEN 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 c888fb681bef0..ff1760bed9a6e 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -102,7 +102,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 @@ -122,7 +122,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 83276c600c132..2d35dad4b2ce2 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -147,7 +147,7 @@ A.circuit = circuit // Circuit removal code is handled in /obj/machinery/Exited() circuit.forceMove(A) - 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 e8c647db1ec4b..c2067e322ba41 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) @@ -29,7 +29,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) @@ -133,7 +133,7 @@ // Set anchor state and move the frame's parts over to the new machine. // Then refresh parts and call on_construction(). - new_computer.anchored = anchored + new_computer.set_anchored(anchored) new_computer.component_parts = list() circuit.forceMove(new_computer) diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index 7571844b4aaa7..5bde0c284e060 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -105,7 +105,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) @@ -113,7 +113,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)) @@ -168,7 +168,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) @@ -195,7 +195,7 @@ // Set anchor state and move the frame's parts over to the new machine. // Then refresh parts and call on_construction(). - new_machine.anchored = anchored + new_machine.set_anchored(anchored) new_machine.component_parts = list() circuit.forceMove(new_machine) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index 7ac02da9ddf47..fccd1f4a10010 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -72,10 +72,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, 1) return return ..() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 401bd0cdcfea9..bfcdbafd403ac 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1440,7 +1440,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 bbb3023c01af1..70d2c7d93b938 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -297,7 +297,7 @@ if("rightsecure") WA.facing = "r" WA.secure = TRUE - WA.setAnchored(TRUE) + WA.set_anchored(TRUE) WA.state= "02" WA.setDir(dir) WA.update_icon() diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index 661e22f4b26c6..74f93e38794c2 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -21,6 +21,7 @@ /obj/machinery/doppler_array/Initialize(mapload) . = ..() RegisterSignal(SSdcs, COMSIG_GLOB_EXPLOSION, PROC_REF(sense_explosion)) + RegisterSignal(src, COMSIG_MOVABLE_SET_ANCHORED, PROC_REF(power_change)) printer_ready = world.time + PRINTER_TIMEOUT /obj/machinery/doppler_array/ComponentInitialize() @@ -119,12 +120,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 da938b7ed2e6b..711cff80a07fe 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -184,13 +184,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 9dab74109d895..1816e51b1d651 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -399,7 +399,7 @@ Possible to do for anyone motivated enough: 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() @@ -562,7 +562,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 c644ab6a7b663..a451755784cbc 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -307,7 +307,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.") @@ -315,7 +315,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 1c9580239f298..163c46d1bb6ef 100644 --- a/code/game/machinery/porta_turret/portable_turret_construct.dm +++ b/code/game/machinery/porta_turret/portable_turret_construct.dm @@ -15,6 +15,7 @@ desc = "An unfinished covered turret frame." anchored = FALSE density = TRUE + use_power = NO_POWER_USE //why would it use power if its not even connected yet var/build_step = PTURRET_UNSECURED //the current step in the building process var/finish_name = "turret" //the name applied to the product turret var/obj/item/gun/installed_gun = null @@ -26,7 +27,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 +52,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 @@ -85,7 +86,6 @@ to_chat(user, "You add [I] to the turret.") build_step = PTURRET_GUN_EQUIPPED return - else if(I.tool_behaviour == TOOL_WRENCH) I.play_tool_sound(src, 100) to_chat(user, "You remove the turret's metal armor bolts.") diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm index 99db226937df2..14feee213eafd 100644 --- a/code/game/machinery/porta_turret/portable_turret_cover.dm +++ b/code/game/machinery/porta_turret/portable_turret_cover.dm @@ -43,20 +43,20 @@ if(I.tool_behaviour == TOOL_WRENCH && !parent_turret.on) if(parent_turret.raised) 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() + parent_turret.update_appearance() 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() + parent_turret.update_appearance() qdel(src) + return - else if(I.GetID()) + if(I.GetID()) if(parent_turret.allowed(user)) parent_turret.locked = !parent_turret.locked to_chat(user, "Controls are now [parent_turret.locked ? "locked" : "unlocked"].") diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index c20d5bea8b36b..199153ecb66e2 100755 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -61,7 +61,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/shieldgen.dm b/code/game/machinery/shieldgen.dm index 8b78128888462..b14641bbd0093 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -177,14 +177,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 7475dfece0258..61320e077e3b7 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 0ba8e43810637..b0431004d0a4b 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -129,14 +129,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 df3a11196660c..142a9d9bdadca 100644 --- a/code/game/mecha/equipment/tools/work_tools.dm +++ b/code/game/mecha/equipment/tools/work_tools.dm @@ -48,15 +48,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 it's 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) balloon_alert(chassis.occupant, "[target] has been 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 balloon_alert(chassis.occupant, "Not enough room in cargo compartment.") else @@ -108,15 +108,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 it's 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) balloon_alert(chassis.occupant, "[target] has been 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 balloon_alert(chassis.occupant, "Not enough room in cargo compartment.") else diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 1434c998ed1e5..42fcd1325332a 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -128,7 +128,7 @@ if(istype(buckled_mob) && buckled_mob.buckled == src && (buckled_mob.can_unbuckle() || force)) . = buckled_mob buckled_mob.set_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 759737932633d..f57c077bbdac2 100644 --- a/code/game/objects/items/devices/powersink.dm +++ b/code/game/objects/items/devices/powersink.dm @@ -14,6 +14,7 @@ righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi' w_class = WEIGHT_CLASS_BULKY flags_1 = CONDUCT_1 + item_flags = NO_PIXEL_RANDOM_DROP throwforce = 5 throw_speed = 1 throw_range = 2 @@ -24,13 +25,21 @@ var/mode = 0 // 0 = off, 1=clamped (off), 2=operating var/admins_warned = FALSE // stop spam, only warn the admins once that we are about to boom - var/obj/structure/cable/attached // the attached cable - item_flags = NO_PIXEL_RANDOM_DROP + var/obj/structure/cable/attached /obj/item/powersink/update_icon_state() icon_state = "powersink[mode == OPERATING]" return ..() +/obj/item/powersink/examine(mob/user) + . = ..() + if(mode) + . += "\The [src] is bolted to the floor." + +/obj/item/powersink/set_anchored(anchorvalue) + . = ..() + set_density(anchorvalue) + /obj/item/powersink/proc/set_mode(value) if(value == mode) return @@ -39,23 +48,20 @@ attached = null if(mode == OPERATING) STOP_PROCESSING(SSobj, src) - anchored = FALSE - set_density(FALSE) + set_anchored(FALSE) if(CLAMPED_OFF) if(!attached) return if(mode == OPERATING) STOP_PROCESSING(SSobj, src) - anchored = TRUE - set_density(TRUE) + set_anchored(TRUE) if(OPERATING) if(!attached) return START_PROCESSING(SSobj, src) - anchored = TRUE - set_density(TRUE) + set_anchored(TRUE) mode = value update_appearance() diff --git a/code/game/objects/items/etherealdiscoball.dm b/code/game/objects/items/etherealdiscoball.dm index 9bb1a5195e072..830e7245985c8 100644 --- a/code/game/objects/items/etherealdiscoball.dm +++ b/code/game/objects/items/etherealdiscoball.dm @@ -37,12 +37,9 @@ to_chat(user, "You turn the disco ball on!") /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/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index cf2e4387c7b50..1aeb1573a5a9b 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -582,7 +582,7 @@ R.notransform = TRUE var/prev_lockcharge = R.lockcharge R.SetLockdown(TRUE) - R.anchored = TRUE + R.set_anchored(TRUE) var/datum/effect_system/smoke_spread/smoke = new smoke.set_up(TRUE, R.loc) smoke.start() @@ -592,7 +592,7 @@ sleep(12) if(!prev_lockcharge) R.SetLockdown(FALSE) - 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 3eb114a652702..0aad652574df6 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -58,13 +58,9 @@ var/emag_toggleable = FALSE /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(mapload) @@ -111,9 +107,6 @@ SStgui.close_uis(src) . = ..() -/obj/proc/setAnchored(anchorvalue) - SEND_SIGNAL(src, COMSIG_OBJ_SETANCHORED, anchorvalue) - anchored = anchorvalue /obj/assume_air(datum/gas_mixture/giver) if(loc) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 57d75df9adef3..62fec0c853c3d 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -373,7 +373,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 12cf211047797..a21046bc2815a 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -583,7 +583,7 @@ to_chat(user, "You unsecure [src].") else to_chat(user, "You secure [src].") - anchored = !anchored + set_anchored(!anchored) return TRUE 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 c9d44b53a3419..82dd2f68be0aa 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -107,7 +107,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!") @@ -120,7 +120,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)) @@ -316,7 +316,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 79b91e3cb78b0..a808749429c33 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 0438519037599..62c2deb8ac6e4 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -79,7 +79,7 @@ to_chat(user, "You construct the window.") log_attack("[key_name(user)] has constructed a window at [loc_name(src)] using [format_text(initial(the_rcd.name))]") var/obj/structure/window/WD = new the_rcd.window_type(local_turf, user.dir) - WD.setAnchored(TRUE) + WD.set_anchored(TRUE) return TRUE return FALSE @@ -155,7 +155,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 @@ -203,7 +203,7 @@ else WD = new/obj/structure/window/fulltile(drop_location()) //normal window WD.setDir(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 de83e3d47ae59..4f07ad17c9067 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 d2f2fd0cd0071..899b0ea8597fc 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_REF(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 1340da4775c29..82af8d10404cd 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -77,7 +77,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, 1 SECONDS, volume = 75, extra_checks = CALLBACK(src, PROC_REF(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 e5c22c5417536..c55b152ab3394 100644 --- a/code/game/objects/structures/reflector.dm +++ b/code/game/objects/structures/reflector.dm @@ -121,7 +121,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)) @@ -131,7 +131,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 bdc4bb8cf90f4..6c0cc3e50c84b 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -130,7 +130,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 @@ -145,7 +145,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 174ccf95bc6dd..9c7374d0cec66 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -208,12 +208,12 @@ else if(state == WINDOW_OUT_OF_FRAME) to_chat(user, "You begin to [anchored ? "unscrew the frame from":"screw the frame to"] the floor...") if(I.use_tool(src, user, decon_speed, extra_checks = CALLBACK(src, PROC_REF(check_state_and_anchored), state, anchored))) - setAnchored(!anchored) + set_anchored(!anchored) to_chat(user, "You [anchored ? "fasten the frame to":"unfasten the frame from"] the floor.") else //if we're not reinforced, we don't need to check or update state 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, extra_checks = CALLBACK(src, PROC_REF(check_anchored), anchored))) - setAnchored(!anchored) + set_anchored(!anchored) to_chat(user, "You [anchored ? "fasten the window to":"unfasten the window from"] the floor.") return @@ -237,7 +237,7 @@ return return ..() -/obj/structure/window/setAnchored(anchorvalue) +/obj/structure/window/set_anchored(anchorvalue) ..() air_update_turf(TRUE) update_nearby_icons() diff --git a/code/game/turfs/open/floor.dm b/code/game/turfs/open/floor.dm index 942a0514a1ad7..1a6fa9f804c02 100644 --- a/code/game/turfs/open/floor.dm +++ b/code/game/turfs/open/floor.dm @@ -219,8 +219,8 @@ return TRUE if(RCD_LADDER) to_chat(user, "You build a ladder.") - var/obj/structure/ladder/Ladder = new(src) - Ladder.anchored = TRUE + var/obj/structure/ladder/L = new(src) + L.set_anchored(TRUE) return TRUE if(RCD_AIRLOCK) if(locate(/obj/machinery/door) in src) @@ -259,7 +259,7 @@ new_airlock.closeOtherId = new_airlock.electronics.passed_cycle_id new_airlock.update_other_id() new_airlock.autoclose = TRUE - new_airlock.update_icon() + new_airlock.update_appearance() return TRUE if(RCD_DECONSTRUCT) var/previous_turf = initial(name) @@ -274,7 +274,7 @@ to_chat(user, "You construct the grille.") log_attack("[key_name(user)] has constructed a grille at [loc_name(src)] using [format_text(initial(the_rcd.name))]") var/obj/structure/grille/new_grille = new(src) - new_grille.anchored = TRUE + new_grille.set_anchored(TRUE) return TRUE if(RCD_MACHINE) if(locate(/obj/structure/frame/machine) in src) @@ -282,13 +282,13 @@ var/obj/structure/frame/machine/new_machine = new(src) new_machine.state = 2 new_machine.icon_state = "box_1" - new_machine.anchored = TRUE + new_machine.set_anchored(TRUE) return TRUE if(RCD_COMPUTER) if(locate(/obj/structure/frame/computer) in src) return FALSE var/obj/structure/frame/computer/new_computer = new(src) - new_computer.anchored = TRUE + new_computer.set_anchored(TRUE) new_computer.state = 1 new_computer.setDir(the_rcd.computer_dir) return TRUE diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 5630e547bac8d..13167bfe99a39 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/admin/verbs/forcecryo.dm b/code/modules/admin/verbs/forcecryo.dm index 497d642628785..abd749eee6b74 100644 --- a/code/modules/admin/verbs/forcecryo.dm +++ b/code/modules/admin/verbs/forcecryo.dm @@ -23,7 +23,7 @@ target.mouse_opacity = MOUSE_OPACITY_TRANSPARENT target.Stun(INFINITY, ignore_canstun = TRUE) target.move_resist = INFINITY - target.anchored = TRUE + target.set_anchored(TRUE) target.status_flags |= GODMODE // ensure they're on a turf target.forceMove(target_turf) diff --git a/code/modules/antagonists/clock_cult/structure/gear_base.dm b/code/modules/antagonists/clock_cult/structure/gear_base.dm index 559a5ea32fa4f..ae04e92d446e4 100644 --- a/code/modules/antagonists/clock_cult/structure/gear_base.dm +++ b/code/modules/antagonists/clock_cult/structure/gear_base.dm @@ -27,7 +27,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) update_icon_state() return TRUE else diff --git a/code/modules/antagonists/fugitive/fugitive_ship.dm b/code/modules/antagonists/fugitive/fugitive_ship.dm index 9a609b98f890c..8f54ab72c2d7f 100644 --- a/code/modules/antagonists/fugitive/fugitive_ship.dm +++ b/code/modules/antagonists/fugitive/fugitive_ship.dm @@ -206,7 +206,7 @@ return playsound(src, 'sound/weapons/emitter.ogg', 50, TRUE) log_game("[key_name(user)] permanently captured the fugitive [key_name(prisoner)].") - chamber.occupant = null // remove the reference + chamber.set_occupant(null) // remove the reference antag.is_captured = TRUE antag.living_on_capture = prisoner.stat != DEAD to_chat(prisoner, "You are thrown into a vast void of bluespace, and as you fall further into oblivion the comparatively small entrance to reality gets smaller and smaller until you cannot see it anymore. You have failed to avoid capture.") diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index 1b44ed443dc23..9f79aaf5d78c7 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm @@ -421,7 +421,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 f00ab5cd9f7c6..5ab205e98b439 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -83,7 +83,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/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 4f0a1d78b63db..0e9d101d8b382 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -67,7 +67,7 @@ connected_port.connected_device = src connected_port.parents[1].update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED - anchored = TRUE //Prevent movement + set_anchored(TRUE) //Prevent movement pixel_x = new_port.pixel_x pixel_y = new_port.pixel_y diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 1f864ff1d9870..31581bd2fed07 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -68,10 +68,10 @@ /obj/item/ctf/attack_hand(mob/living/user) //pre normal check item stuff, this is for our special flag checks if(!is_ctf_target(user) && !anyonecanpickup) - to_chat(user, "Non players shouldn't be moving the flag!") + to_chat(user, "Non players shouldn't be moving the flag!") return if(team in user.faction) - to_chat(user, "You can't move your own flag!") + to_chat(user, "You can't move your own flag!") return if(loc == user) if(!user.dropItemToGround(src)) @@ -87,12 +87,12 @@ anchored = TRUE return //passing means the user picked up the flag so we can now apply this - user.anchored = TRUE + user.set_anchored(TRUE) user.status_flags &= ~CANPUSH /obj/item/ctf/dropped(mob/user) ..() - user.anchored = FALSE + user.set_anchored(FALSE) user.status_flags |= CANPUSH reset_cooldown = world.time + 20 SECONDS START_PROCESSING(SSobj, src) diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm index d6ebd698bdc13..1d2a6df1be4db 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 = FALSE - user.anchored = FALSE + user.set_anchored(FALSE) teleporting = FALSE 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 c2085de97634d..a706bdf8efb54 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(istype(I, /obj/item/evidencebag)) diff --git a/code/modules/events/shuttle_loan.dm b/code/modules/events/shuttle_loan.dm index c468ea71ff954..d0572e5cdd9d1 100644 --- a/code/modules/events/shuttle_loan.dm +++ b/code/modules/events/shuttle_loan.dm @@ -249,7 +249,7 @@ /obj/machinery/syndicatebomb/shuttle_loan/Initialize(mapload) . = ..() - 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/holoparasite/abilities/major/scout.dm b/code/modules/holoparasite/abilities/major/scout.dm index 9bd55af25eb24..50f47c1edc0c9 100644 --- a/code/modules/holoparasite/abilities/major/scout.dm +++ b/code/modules/holoparasite/abilities/major/scout.dm @@ -139,7 +139,7 @@ /datum/holoparasite_ability/major/scout/proc/on_post_manifest() SIGNAL_HANDLER if(scouting) - owner.anchored = TRUE + owner.set_anchored(TRUE) owner.incorporeal_move = INCORPOREAL_MOVE_BASIC owner.move_resist = INFINITY owner.set_density(FALSE) @@ -156,7 +156,7 @@ /datum/holoparasite_ability/major/scout/proc/on_recall() SIGNAL_HANDLER owner.incorporeal_move = FALSE - owner.anchored = FALSE + owner.set_anchored(FALSE) owner.move_resist = initial(owner.move_resist) owner.set_density(initial(owner.density)) owner.attack_sound = owner.theme.mob_info[HOLOPARA_THEME_ATTACK_SOUND] || initial(owner.attack_sound) @@ -372,7 +372,7 @@ to_chat(stalking, "You feel relief as the strange feeling of being watched fades away...") var/out_and_about = scouting && owner.is_manifested() owner.incorporeal_move = out_and_about ? INCORPOREAL_MOVE_BASIC : FALSE - owner.anchored = out_and_about + owner.set_anchored(out_and_about) UnregisterSignal(stalking, list(COMSIG_MOVABLE_MOVED, COMSIG_ATOM_DIR_CHANGE, COMSIG_PARENT_PREQDELETED)) stalking = null stalkee_was_notified = FALSE diff --git a/code/modules/hydroponics/beekeeping/beebox.dm b/code/modules/hydroponics/beekeeping/beebox.dm index 2876c7c2935ac..3b49a419221f5 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 bc914ba917f72..6e19dbf2f2a54 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,7 +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, STAMINA = 0) - var/state = 0 + var/state = BOOKCASE_UNANCHORED var/list/allowed_books = list(/obj/item/book, /obj/item/spellbook, /obj/item/storage/book, /obj/item/codex_cicatrix) //Things allowed in the bookcase /// When enabled, books_to_load number of random books will be generated for this bookcase when first interacted with. var/load_random_books = FALSE @@ -30,6 +34,19 @@ /// How many random books to generate. var/books_to_load = 0 +/obj/structure/bookcase/Initialize(mapload) + . = ..() + if(!mapload || QDELETED(src)) + return + // Only mapload from here on + set_anchored(TRUE) + state = BOOKCASE_FINISHED + for(var/obj/item/I in loc) + if(!isbook(I)) + continue + I.forceMove(src) + update_appearance() + /obj/structure/bookcase/examine(mob/user) . = ..() if(!anchored) @@ -37,64 +54,63 @@ 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) +/obj/structure/bookcase/set_anchored(anchorvalue) . = ..() - if(!mapload) + if(isnull(.)) return - state = 2 - icon_state = "book-0" - anchored = TRUE - for(var/obj/item/I in loc) - if(istype(I, /obj/item/book)) - I.forceMove(src) - update_icon() + 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_appearance() /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/wood)) var/obj/item/stack/sheet/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_appearance() + 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(!user.transferItemToLoc(I, src)) return - update_icon() + update_appearance() else if(STR) for(var/obj/item/T in I.contents) if(istype(T, /obj/item/book) || istype(T, /obj/item/spellbook)) STR.remove_from_storage(T, src) to_chat(user, "You empty \the [I] into \the [src].") - update_icon() + update_appearance() else if(istype(I, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on the side of [src]!") @@ -107,14 +123,14 @@ else name = "bookcase ([sanitize(newname)])" else if(I.tool_behaviour == TOOL_CROWBAR) - if(contents.len) + if(length(contents)) to_chat(user, "You need to remove the books first!") else I.play_tool_sound(src, 100) to_chat(user, "You pry the shelf out.") new /obj/item/stack/sheet/wood(drop_location(), 2) - state = 1 - icon_state = "bookempty" + state = BOOKCASE_ANCHORED + update_appearance() else return ..() @@ -125,6 +141,8 @@ return if(!istype(user)) return + if(!length(contents)) + return if(load_random_books) create_random_books(books_to_load, src, FALSE, random_category) load_random_books = FALSE @@ -140,19 +158,25 @@ choice.forceMove(drop_location()) update_icon() - /obj/structure/bookcase/deconstruct(disassembled = TRUE) - new /obj/item/stack/sheet/wood(loc, 4) - for(var/obj/item/book/B in contents) - B.forceMove(get_turf(src)) - qdel(src) - - -/obj/structure/bookcase/update_icon() + var/atom/Tsec = drop_location() + new /obj/item/stack/sheet/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 || state == BOOKCASE_ANCHORED) + 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)]" + return ..() /obj/structure/bookcase/manuals/medical @@ -366,3 +390,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/aux_base.dm b/code/modules/mining/aux_base.dm index d82aa41103019..848a74e0b792c 100644 --- a/code/modules/mining/aux_base.dm +++ b/code/modules/mining/aux_base.dm @@ -365,7 +365,7 @@ interface with the mining shuttle at the landing site if a mobile beacon is also aux_base_console.set_mining_mode() //Lets the colony park the shuttle there, now that it has a dock. to_chat(user, "Mining shuttle calibration successful! Shuttle interface available at base console.") - anchored = TRUE //Locks in place to mark the landing zone. + set_anchored(TRUE) //Locks in place to mark the landing zone. playsound(loc, 'sound/machines/ping.ogg', 50, 0) /obj/structure/mining_shuttle_beacon/proc/clear_cooldown() diff --git a/code/modules/mining/fulton.dm b/code/modules/mining/fulton.dm index 66c7764461056..d58ea86e8a85a 100644 --- a/code/modules/mining/fulton.dm +++ b/code/modules/mining/fulton.dm @@ -84,7 +84,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons) if(M.buckled) M.buckled.unbuckle_mob(M, TRUE) // Unbuckle them to prevent anchoring problems else - A.anchored = TRUE + A.set_anchored(TRUE) A.set_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.set_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 924f88431c2f6..5664f5acf722e 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -199,7 +199,7 @@ flick("[cyborg_base_icon]_transform", R) R.notransform = TRUE R.SetLockdown(TRUE) - R.anchored = TRUE + R.set_anchored(TRUE) R.logevent("Chassis configuration has been set to [name].") sleep(1) for(var/i in 1 to 4) @@ -208,7 +208,7 @@ if(!prev_lockcharge) R.SetLockdown(FALSE) R.setDir(SOUTH) - R.anchored = FALSE + R.set_anchored(FALSE) R.notransform = FALSE R.update_icons() R.notify_ai(NEW_MODULE) diff --git a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm index 671f5bf797887..dd4ced0668d32 100644 --- a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm +++ b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm @@ -89,7 +89,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/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 383af7d96c6ed..761743f4eca25 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -211,7 +211,7 @@ /mob/living/simple_animal/bot/cleanbot/UnarmedAttack(atom/A) if(ismopable(A)) - anchored = TRUE + set_anchored(TRUE) icon_state = "cleanbot-c" visible_message("[src] begins to clean up [A].") mode = BOT_CLEANING @@ -333,7 +333,7 @@ /mob/living/simple_animal/bot/cleanbot/larry/UnarmedAttack(atom/A) if(istype(A, /obj/effect/decal/cleanable)) - anchored = TRUE + set_anchored(TRUE) icon_state = "larry-c" visible_message("[src] begins to clean up [A].") mode = BOT_CLEANING diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm index 46fde6bc82bee..7c5ba0fff37ad 100644 --- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm +++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm @@ -249,7 +249,7 @@ stun_attack(target) mode = BOT_PREP_ARREST - anchored = TRUE + set_anchored(TRUE) target_lastloc = target.loc return @@ -283,7 +283,7 @@ if(BOT_ARREST) if(!target) - anchored = FALSE + set_anchored(FALSE) mode = BOT_IDLE last_found = world.time frustration = 0 @@ -298,7 +298,7 @@ return else mode = BOT_PREP_ARREST - anchored = FALSE + set_anchored(FALSE) if(BOT_START_PATROL) look_for_perp() diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 54a1cd0b48476..1e34a9a41e3d6 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -149,7 +149,7 @@ if("autotile") autotile = !autotile if("anchor") - anchored = !anchored + set_anchored(!anchored) if("eject") if(specialtiles && tiletype != null) empty_tiles() @@ -236,7 +236,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.") @@ -282,11 +282,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. @@ -317,7 +317,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 @@ -334,7 +334,7 @@ switch(process_type) // Other process types have no business here if(REPLACE_TILE) if(!isplatingturf(F) && F.type != initial(tiletype.turf_type)) - anchored = TRUE + set_anchored(TRUE) icon_state = "[toolbox_color]floorbot-c" mode = BOT_REPAIRING visible_message("[src] begins replacing the floor tiles.") @@ -349,7 +349,7 @@ speak("Requesting refill of custom floor tiles to continue replacing.") if(PLACE_TILE, FIX_TILE) if(isplatingturf(F) || 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.") diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index ba476701562af..1e3d1262e5bcc 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -251,7 +251,7 @@ 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 a53a04f99a3e2..97c85dece5750 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -292,7 +292,7 @@ stun_attack(target) mode = BOT_PREP_ARREST - anchored = TRUE + set_anchored(TRUE) target_lastloc = target.loc return @@ -326,7 +326,7 @@ if(BOT_ARREST) if(!target) - anchored = FALSE + set_anchored(FALSE) mode = BOT_IDLE last_found = world.time frustration = 0 @@ -341,7 +341,7 @@ 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/mob/living/simple_animal/hostile/floor_cluwne.dm b/code/modules/mob/living/simple_animal/hostile/floor_cluwne.dm index 72963f0934fd1..a3ac4a531dc78 100644 --- a/code/modules/mob/living/simple_animal/hostile/floor_cluwne.dm +++ b/code/modules/mob/living/simple_animal/hostile/floor_cluwne.dm @@ -365,8 +365,8 @@ GLOBAL_VAR_INIT(floor_cluwnes, 0) if(do_after(src, 50, target = H) && eating) H.become_blind() H.invisibility = INVISIBILITY_SPIRIT - H.density = FALSE - H.anchored = TRUE + H.set_density(FALSE) + H.set_anchored(TRUE) addtimer(CALLBACK(src, TYPE_PROC_REF(/mob/living/simple_animal/hostile/floor_cluwne, Kill), H), 100, TIMER_OVERRIDE|TIMER_UNIQUE) visible_message("[src] pulls [H] under!") to_chat(H, "[src] drags you underneath the floor!") @@ -401,7 +401,7 @@ GLOBAL_VAR_INIT(floor_cluwnes, 0) H.cure_blind(null) H.invisibility = initial(H.invisibility) H.density = initial(H.density) - H.anchored = initial(H.anchored) + H.set_anchored(initial(H.anchored)) H.blur_eyes(10) animate(H.client,color = old_color, time = 20) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm index a7cb565a2c6fa..efaaf316a8e3a 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/goliath.dm @@ -49,7 +49,7 @@ /mob/living/simple_animal/hostile/asteroid/goliath/revive(full_heal = 0, admin_revive = 0) if(..()) - anchored = TRUE + set_anchored(TRUE) . = 1 /mob/living/simple_animal/hostile/asteroid/goliath/death(gibbed) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index 58d3b27339ca0..ba160f639105a 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -58,7 +58,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(user.a_intent != INTENT_HARM) to_chat(user, "You can't put [P] in [src]!") else diff --git a/code/modules/plumbing/ducts.dm b/code/modules/plumbing/ducts.dm index 8f57404621cd5..20d192f5abf41 100644 --- a/code/modules/plumbing/ducts.dm +++ b/code/modules/plumbing/ducts.dm @@ -40,7 +40,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") @@ -150,8 +150,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) @@ -270,24 +271,25 @@ All the important duct code: pixel_x = offset 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) - user.visible_message( \ - "[user] unfastens \the [src].", \ - "You unfasten \the [src].", \ - "You hear ratcheting.") - disconnect_duct() - else if(can_anchor()) - anchored = TRUE - active = TRUE + if(anchored || can_anchor()) + set_anchored(!anchored) user.visible_message( \ - "[user] fastens \the [src].", \ - "You fasten \the [src].", \ - "You hear ratcheting.") - attempt_connect() + "[user] [anchored ? null : "un"]fastens \the [src].", \ + "You [anchored ? null : "un"]fasten \the [src].", \ + "You hear ratcheting.") 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 d63902f719e78..f40fe6e5364aa 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -197,7 +197,7 @@ /obj/machinery/power/generator/wrench_act(mob/living/user, obj/item/I) 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 bf8970200b08c..904f497ce06de 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -171,6 +171,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 @@ -185,12 +194,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 45b0105983adf..572611781c3dd 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -38,8 +38,9 @@ radio.canhear_range = 0 radio.recalculateChannels() -/obj/machinery/power/rad_collector/anchored - anchored = TRUE +/obj/machinery/power/rad_collector/anchored/Initialize() + . = ..() + set_anchored(TRUE) /obj/machinery/power/rad_collector/Destroy() QDEL_NULL(radio) @@ -99,13 +100,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 465d19876d16c..d7f3d8bed5093 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -69,7 +69,7 @@ wires = new /datum/wires/emitter(src) if(welded) if(!anchored) - setAnchored(TRUE) + set_anchored(TRUE) connect_to_network() sparks = new @@ -80,7 +80,7 @@ . = ..() AddElement(/datum/element/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 @@ -100,8 +100,6 @@ for(var/obj/item/stock_parts/manipulator/manipulator in component_parts) power_usage -= 50 * manipulator.rating active_power_usage = power_usage - //if(anchored && welded) - // state = EMITTER_WRENCHED /obj/machinery/power/emitter/examine(mob/user) . = ..() @@ -177,7 +175,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/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index 7a8f843c3ffb8..d09f453d60054 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -58,6 +58,13 @@ . = ..() 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 +73,19 @@ if(PA_CONSTRUCTION_UNSECURED) if(W.tool_behaviour == TOOL_WRENCH && !isinspace()) W.play_tool_sound(src, 75) - 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 + set_anchored(TRUE) + user.visible_message("[user.name] secures the [name] to the floor.", \ + "You secure the external bolts.") + 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 - user.visible_message("[user.name] detaches the [name] from the floor.", \ - "You remove the external bolts.") - construction_state = PA_CONSTRUCTION_UNSECURED - did_something = TRUE + set_anchored(FALSE) + user.visible_message("[user.name] detaches the [name] from the floor.", \ + "You remove the external bolts.") + 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 44fa6fc78412a..277af527edddf 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -200,6 +200,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 @@ -207,19 +215,19 @@ if(PA_CONSTRUCTION_UNSECURED) if(W.tool_behaviour == TOOL_WRENCH && !isinspace()) W.play_tool_sound(src, 75) - 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 + set_anchored(TRUE) + user.visible_message("[user.name] secures the [name] to the floor.", \ + "You secure the external bolts.") + 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 - user.visible_message("[user.name] detaches the [name] from the floor.", \ - "You remove the external bolts.") - construction_state = PA_CONSTRUCTION_UNSECURED - did_something = TRUE + set_anchored(FALSE) + user.visible_message("[user.name] detaches the [name] from the floor.", \ + "You remove the external bolts.") + 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)) @@ -252,7 +260,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 56664e489b062..14d1bc6776851 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -50,7 +50,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 @@ -206,7 +206,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) @@ -431,7 +431,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.") @@ -442,7 +442,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 f0f0d0719d6c5..64083fee19774 100644 --- a/code/modules/power/tracker.dm +++ b/code/modules/power/tracker.dm @@ -45,7 +45,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) update_icon() diff --git a/code/modules/recycling/disposal/construction.dm b/code/modules/recycling/disposal/construction.dm index 6797458bfa184..8ddcdd5b70b85 100644 --- a/code/modules/recycling/disposal/construction.dm +++ b/code/modules/recycling/disposal/construction.dm @@ -13,13 +13,18 @@ var/obj/pipe_type = /obj/structure/disposalpipe/segment var/pipename -/obj/structure/disposalconstruct/Initialize(mapload, _pipe_type, _dir = SOUTH, flip = FALSE, obj/make_from) +/obj/structure/disposalconstruct/set_anchored(anchorvalue) . = ..() + if(isnull(.)) + return + density = anchorvalue ? initial(pipe_type.density) : FALSE +/obj/structure/disposalconstruct/Initialize(mapload, _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) density = initial(pipe_type.density) make_from.transfer_fingerprints_to(src) @@ -30,6 +35,8 @@ pipename = initial(pipe_type.name) + AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) + if(flip) var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation) rotcomp.BaseRot(null,ROTATION_FLIP) @@ -45,21 +52,22 @@ setDir(old_dir) //pipes changing direction when moved is just annoying and buggy // update iconstate and dpdir due to dir and type +/obj/structure/disposalconstruct/update_icon_state() + if(ispath(pipe_type, /obj/machinery/disposal/bin)) + // Disposal bins receive special icon treating + icon_state = "[anchored ? "con" : null]disposal" + return ..() + + icon_state = "[is_pipe() ? "con" : null][initial(pipe_type.icon_state)]" + return ..() + +// Extra layer handling /obj/structure/disposalconstruct/update_icon() - icon_state = initial(pipe_type.icon_state) - if(is_pipe()) - icon_state = "con[icon_state]" - if(anchored) - layer = initial(pipe_type.layer) - else - layer = initial(layer) + . = ..() + if(!is_pipe()) + return - else if(ispath(pipe_type, /obj/machinery/disposal/bin)) - // Disposal bins receive special icon treating - if(anchored) - icon_state = "disposal" - else - icon_state = "condisposal" + layer = anchored ? initial(pipe_type.layer) : initial(layer) /obj/structure/disposalconstruct/proc/get_disposal_dir() if(!is_pipe()) @@ -107,8 +115,7 @@ // weldingtool: convert to real pipe /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 @@ -148,14 +155,14 @@ 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() + update_appearance() return TRUE /obj/structure/disposalconstruct/welder_act(mob/living/user, obj/item/I) + ..() if(anchored) if(!I.tool_start_check(user, amount=0)) return TRUE diff --git a/code/modules/research/xenobiology/crossbreeding/warping.dm b/code/modules/research/xenobiology/crossbreeding/warping.dm index b1a91f0c83eba..c6fe7296fa0a9 100644 --- a/code/modules/research/xenobiology/crossbreeding/warping.dm +++ b/code/modules/research/xenobiology/crossbreeding/warping.dm @@ -464,8 +464,8 @@ GLOBAL_DATUM(blue_storage, /obj/item/storage/backpack/holding/bluespace) holotile.name = "[holo_host.name] (Hologram)" holotile.add_atom_colour("#77abff", FIXED_COLOUR_PRIORITY) holotile.copy_overlays(holo_host, TRUE) - holotile.anchored = TRUE - holotile.density = FALSE + holotile.set_anchored(TRUE) + holotile.set_density(FALSE) //the code that follows is basically the code that changeling use to get people's last spoken sentences with a few tweaks. recent_speech = list() //resets the list from its previous sentences diff --git a/code/modules/shuttle/super_cruise/bluespace_beacon/bluespace_beacon.dm b/code/modules/shuttle/super_cruise/bluespace_beacon/bluespace_beacon.dm index 6f9e3c11ff00b..a0a056c5387ee 100644 --- a/code/modules/shuttle/super_cruise/bluespace_beacon/bluespace_beacon.dm +++ b/code/modules/shuttle/super_cruise/bluespace_beacon/bluespace_beacon.dm @@ -41,4 +41,4 @@ to_chat(user, "You unsecure [src].") else to_chat(user, "You secure [src].") - anchored = !anchored + set_anchored(!anchored) diff --git a/code/modules/shuttle/super_cruise/orbital_poi_generator/objective_types/recover_blackbox.dm b/code/modules/shuttle/super_cruise/orbital_poi_generator/objective_types/recover_blackbox.dm index e7fd53c0971b9..91cb7e7952105 100644 --- a/code/modules/shuttle/super_cruise/orbital_poi_generator/objective_types/recover_blackbox.dm +++ b/code/modules/shuttle/super_cruise/orbital_poi_generator/objective_types/recover_blackbox.dm @@ -70,7 +70,7 @@ return recovered = TRUE //Prevent picking up - parentobj.anchored = TRUE + parentobj.set_anchored(TRUE) //Drop to ground parentobj.forceMove(get_turf(parent)) //Complete objective diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index 7719b5bf30d12..e59332f984548 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -362,7 +362,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.set_density(FALSE) QDEL_IN(spell, overlay_lifespan) diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm index 4cd07790cd9ce..c1a85eb9bde21 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() icon_state = active ? "sat_active" : "sat_inactive" diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm index 9d4e6b4550e47..5b63391109655 100644 --- a/code/modules/surgery/organs/augments_internal.dm +++ b/code/modules/surgery/organs/augments_internal.dm @@ -41,7 +41,7 @@ /obj/item/organ/cyberimp/brain/anti_drop name = "anti-drop implant" desc = "This cybernetic brain implant will allow you to force your hand muscles to contract, preventing item dropping. Twitch ear to toggle." - var/active = 0 + var/active = FALSE var/list/stored_items = list() implant_color = "#DE7E00" slot = ORGAN_SLOT_BRAIN_ANTIDROP @@ -53,8 +53,8 @@ for(var/obj/item/I in owner.held_items) stored_items += I - var/list/L = owner.get_empty_held_indexes() - if(LAZYLEN(L) == owner.held_items.len) + var/list/hold_list = owner.get_empty_held_indexes() + if(LAZYLEN(hold_list) == owner.held_items.len) to_chat(owner, "You are not holding any items, your hands relax...") active = 0 stored_items = list() @@ -62,7 +62,6 @@ for(var/obj/item/I in stored_items) to_chat(owner, "Your [owner.get_held_index_name(owner.get_held_index_of_item(I))]'s grip tightens.") ADD_TRAIT(I, TRAIT_NODROP, ANTI_DROP_IMPLANT_TRAIT) - else release_items() to_chat(owner, "Your hands relax...") diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm index c0a3a3559c3fa..fc565a78d4bb7 100644 --- a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm +++ b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm @@ -32,7 +32,7 @@ if(QDELETED(src) || QDELETED(X) || QDELETED(AM)) return var/turf/T = get_turf(X.loc) - AM.anchored = FALSE + AM.set_anchored(FALSE) AM.forceMove(T) if(spawn_russian) new /mob/living/simple_animal/hostile/russian(T) diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_minors.dm b/code/modules/xenoarchaeology/traits/xenoartifact_minors.dm index 7872902f58439..cfc0474e6deec 100644 --- a/code/modules/xenoarchaeology/traits/xenoartifact_minors.dm +++ b/code/modules/xenoarchaeology/traits/xenoartifact_minors.dm @@ -150,7 +150,7 @@ man.status_flags |= GODMODE log_game("[key_name_admin(man)] took control of the sentient [X]. [X] located at [AREACOORD(X)]") man.forceMove(X) - man.anchored = TRUE + man.set_anchored(TRUE) var/obj/effect/proc_holder/spell/targeted/xeno_senitent_action/P = new /obj/effect/proc_holder/spell/targeted/xeno_senitent_action(,X) man.AddSpell(P) //show little guy his traits @@ -361,7 +361,7 @@ var/mob/living/holder = X.loc holder.dropItemToGround(X) X.visible_message("The [X.name] buckles to the floor!") - X.setAnchored(TRUE) + X.set_anchored(TRUE) X.density = TRUE /datum/xenoartifact_trait/minor/anchor/on_item(obj/item/xenoartifact/X, atom/user, obj/item/item) @@ -370,7 +370,7 @@ if(isliving(X.loc)) var/mob/living/holder = X.loc holder.dropItemToGround(X) - X.setAnchored(!X.anchored) + X.set_anchored(!X.anchored) if(!X.get_trait(/datum/xenoartifact_trait/minor/dense)) X.density = !X.density return TRUE