Moves almost all wrench checks in attackby to wrench_act() (#25687)

* wrench a bunch of acts

* atmospherics

* some last few things

* last iswrench changes for anything that isn't construction

* Update code/game/machinery/pipe/pipe_construction.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>

* thank you dgamer

* oopsie daisy

* tests and addresses some introduced bugs

* proper testing

* proper ci

* Update code/game/objects/structures/fluff.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>

* Update code/game/objects/structures/fluff.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>

* thank you burza 🙏

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Update code/modules/recycling/disposal-construction.dm

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

---------

Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
Luc
2024-07-30 13:51:00 +00:00
committed by GitHub
co-authored by DGamerL Burzah
parent 2411c62392
commit 495afc5e60
32 changed files with 474 additions and 483 deletions
+14 -12
View File
@@ -14,18 +14,20 @@
QDEL_NULL(part2)
return ..()
/obj/item/assembly/shock_kit/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/wrench) && !status)
var/turf/T = loc
if(ismob(T))
T = T.loc
part1.loc = T
part2.loc = T
part1.master = null
part2.master = null
part1 = null
part2 = null
qdel(src)
/obj/item/assembly/shock_kit/wrench_act(mob/living/user, obj/item/I)
if(status)
return
. = TRUE
var/turf/T = get_turf(src)
part1?.forceMove(T)
part2?.forceMove(T)
part1?.master = null
part2?.master = null
part1 = null
part2 = null
visible_message("<span class='notice'>[user] disassembles [src].</span>")
qdel(src)
return TRUE
/obj/item/assembly/shock_kit/screwdriver_act(mob/user, obj/item/I)
status = !status
@@ -50,6 +50,9 @@ Pipelines + Other Objects -> Pipe network
/// ID for automatic linkage of stuff. This is used to assist in connections at mapload. Dont try use it for other stuff
var/autolink_id = null
/// Whether or not this can be unwrenched while on.
var/can_unwrench_while_on = TRUE
/obj/machinery/atmospherics/Initialize(mapload)
. = ..()
@@ -189,63 +192,73 @@ Pipelines + Other Objects -> Pipe network
if(P)
P.other_atmosmch -= src
/obj/machinery/atmospherics/wrench_act(mob/living/user, obj/item/wrench/W)
var/turf/T = get_turf(src)
if(!can_unwrench_while_on && !(stat & NOPOWER) && on)
to_chat(user, "<span class='alert'>You cannot unwrench this [name], turn it off first.</span>")
return TRUE
if(!can_unwrench)
return FALSE
. = TRUE
if(level == 1 && T.transparent_floor && istype(src, /obj/machinery/atmospherics/pipe))
to_chat(user, "<span class='danger'>You can't interact with something that's under the floor!</span>")
return
if(level == 1 && isturf(T) && T.intact)
to_chat(user, "<span class='danger'>You must remove the plating first.</span>")
return
var/datum/gas_mixture/int_air = return_obj_air()
var/datum/gas_mixture/env_air = T.get_readonly_air()
add_fingerprint(user)
var/unsafe_wrenching = FALSE
var/safefromgusts = FALSE
var/I = int_air ? int_air.return_pressure() : 0
var/E = env_air ? env_air.return_pressure() : 0
var/internal_pressure = I - E
to_chat(user, "<span class='notice'>You begin to unfasten [src]...</span>")
if(HAS_TRAIT(user, TRAIT_MAGPULSE))
safefromgusts = TRUE
if(internal_pressure > 2 * ONE_ATMOSPHERE)
unsafe_wrenching = TRUE //Oh dear oh dear
if(internal_pressure > 1750 && !safefromgusts) // 1750 is the pressure limit to do 60 damage when thrown
to_chat(user, "<span class='userdanger'>As you struggle to unwrench [src] a huge gust of gas blows in your face! This seems like a terrible idea!</span>")
else
to_chat(user, "<span class='warning'>As you begin unwrenching [src] a gust of air blows in your face... maybe you should reconsider?</span>")
if(!W.use_tool(src, user, 4 SECONDS, volume = 50) || QDELETED(src))
return
safefromgusts = FALSE
if(HAS_TRAIT(user, TRAIT_MAGPULSE))
safefromgusts = TRUE
user.visible_message(
"<span class='notice'>[user] unfastens [src].</span>",
"<span class='notice'>You have unfastened [src].</span>",
"<span class='italics'>You hear ratcheting.</span>"
)
investigate_log("was <span class='warning'>REMOVED</span> by [key_name(usr)]", "atmos")
//You unwrenched a pipe full of pressure? let's splat you into the wall silly.
if(unsafe_wrenching)
if(safefromgusts)
to_chat(user, "<span class='notice'>Your magboots cling to the floor as a great burst of wind bellows against you.</span>")
else
unsafe_pressure_release(user,internal_pressure)
deconstruct(TRUE)
//(De)construction
/obj/machinery/atmospherics/attackby(obj/item/W, mob/user)
var/turf/T = get_turf(src)
if(can_unwrench && istype(W, /obj/item/wrench))
if(level == 1 && T.transparent_floor && istype(src, /obj/machinery/atmospherics/pipe))
to_chat(user, "<span class='danger'>You can't interact with something that's under the floor!</span>")
return
if(level == 1 && isturf(T) && T.intact)
to_chat(user, "<span class='danger'>You must remove the plating first.</span>")
return
var/datum/gas_mixture/int_air = return_obj_air()
var/datum/gas_mixture/env_air = T.get_readonly_air()
add_fingerprint(user)
var/unsafe_wrenching = FALSE
var/safefromgusts = FALSE
var/I = int_air ? int_air.return_pressure() : 0
var/E = env_air ? env_air.return_pressure() : 0
var/internal_pressure = I - E
playsound(loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if(HAS_TRAIT(user, TRAIT_MAGPULSE))
safefromgusts = TRUE
if(internal_pressure > 2 * ONE_ATMOSPHERE)
unsafe_wrenching = TRUE //Oh dear oh dear
if(internal_pressure > 1750 && !safefromgusts) // 1750 is the pressure limit to do 60 damage when thrown
to_chat(user, "<span class='userdanger'>As you struggle to unwrench [src] a huge gust of gas blows in your face! This seems like a terrible idea!</span>")
else
to_chat(user, "<span class='warning'>As you begin unwrenching [src] a gust of air blows in your face... maybe you should reconsider?</span>")
if(do_after(user, 40 * W.toolspeed, target = src) && !QDELETED(src))
safefromgusts = FALSE
if(HAS_TRAIT(user, TRAIT_MAGPULSE))
safefromgusts = TRUE
user.visible_message( \
"<span class='notice'>[user] unfastens [src].</span>", \
"<span class='notice'>You have unfastened [src].</span>", \
"<span class='italics'>You hear ratcheting.</span>")
investigate_log("was <span class='warning'>REMOVED</span> by [key_name(usr)]", "atmos")
//You unwrenched a pipe full of pressure? let's splat you into the wall silly.
if(unsafe_wrenching)
if(safefromgusts)
to_chat(user, "<span class='notice'>Your magboots cling to the floor as a great burst of wind bellows against you.</span>")
else
unsafe_pressure_release(user,internal_pressure)
deconstruct(TRUE)
else
if(T.transparent_floor)
to_chat(user, "<span class='danger'>You can't interact with something that's under the floor!</span>")
return TRUE
return ..()
if(T.transparent_floor)
to_chat(user, "<span class='danger'>You can't interact with something that's under the floor!</span>")
return TRUE
return ..()
//Called when an atmospherics object is unwrenched while having a large pressure difference
//with it's locs air contents.
@@ -8,6 +8,7 @@
desc = "A one-way air valve that does not require power"
can_unwrench = TRUE
can_unwrench_while_on = FALSE
target_pressure = ONE_ATMOSPHERE
@@ -126,11 +127,3 @@
. = TRUE
if(.)
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos")
/obj/machinery/atmospherics/binary/passive_gate/attackby(obj/item/W, mob/user, params)
if(!istype(W, /obj/item/wrench))
return ..()
if(on)
to_chat(user, "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>")
return 1
return ..()
@@ -13,13 +13,13 @@ Thus, the two variables affect pump operation are set in New():
*/
/obj/machinery/atmospherics/binary/pump
name = "gas pump"
desc = "A pump."
icon = 'icons/atmos/pump.dmi'
icon_state = "map_off"
name = "gas pump"
desc = "A pump"
can_unwrench = TRUE
can_unwrench_while_on = FALSE
target_pressure = ONE_ATMOSPHERE
@@ -160,10 +160,5 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/pump/attackby(obj/item/W, mob/user, params)
if(is_pen(W))
rename_interactive(user, W)
return
else if(!istype(W, /obj/item/wrench))
return ..()
if(!(stat & NOPOWER) && on)
to_chat(user, "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>")
return 1
return TRUE
return ..()
@@ -20,6 +20,7 @@ Thus, the two variables affect pump operation are set in New():
desc = "A volumetric pump"
can_unwrench = TRUE
can_unwrench_while_on = FALSE
var/transfer_rate = 200
@@ -155,10 +156,5 @@ Thus, the two variables affect pump operation are set in New():
/obj/machinery/atmospherics/binary/volume_pump/attackby(obj/item/W, mob/user, params)
if(is_pen(W))
rename_interactive(user, W)
return
else if(!istype(W, /obj/item/wrench))
return ..()
if(!(stat & NOPOWER) && on)
to_chat(user, "<span class='alert'>You cannot unwrench this [src], turn it off first.</span>")
return 1
return TRUE
return ..()
@@ -10,6 +10,7 @@ GLOBAL_LIST_EMPTY(air_injectors)
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF //really helpful in building gas chambers for xenomorphs
can_unwrench = TRUE
can_unwrench_while_on = TRUE
name = "air injector"
desc = "Has a valve and pump attached to it."
@@ -78,10 +79,3 @@ GLOBAL_LIST_EMPTY(air_injectors)
var/obj/item/multitool/M = I
M.buffer_uid = UID()
to_chat(user, "<span class='notice'>You save [src] into [M]'s buffer</span>")
/obj/machinery/atmospherics/unary/outlet_injector/attackby(obj/item/W, mob/user)
if(iswrench(W))
if(!(stat & NOPOWER) && on)
to_chat(user, "<span class='danger'>You cannot unwrench this [src], turn if off first.</span>")
return TRUE
return ..()
@@ -32,11 +32,10 @@
return 0
parent.update = 1
/obj/machinery/atmospherics/unary/portables_connector/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/wrench))
if(connected_device)
to_chat(user, "<span class='danger'>You cannot unwrench this [src], detach [connected_device] first.</span>")
return 1
/obj/machinery/atmospherics/unary/portables_connector/wrench_act(mob/living/user, obj/item/wrench/W)
if(connected_device)
to_chat(user, "<span class='danger'>You cannot unwrench this [name], detach [connected_device] first.</span>")
return TRUE
return ..()
/obj/machinery/atmospherics/unary/portables_connector/portableConnectorReturnAir()
@@ -131,11 +131,11 @@
/obj/machinery/atmospherics/unary/thermomachine/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(!panel_open)
to_chat(user, "<span class='notice'>Open the maintenance panel first.</span>")
return
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
var/list/choices = list("West" = WEST, "East" = EAST, "South" = SOUTH, "North" = NORTH)
var/selected = tgui_input_list(user, "Select a direction for the connector.", "Connector Direction", choices)
if(!selected)
@@ -195,11 +195,6 @@
to_chat(user, "The vent is welded.")
return TRUE
if(iswrench(W))
if(!(stat & NOPOWER) && on)
to_chat(user, "<span class='danger'>You cannot unwrench this [src], turn it off first.</span>")
return TRUE
return ..()
/obj/machinery/atmospherics/unary/vent_pump/multitool_act(mob/living/user, obj/item/I)
@@ -9,6 +9,7 @@
power_state = ACTIVE_POWER_USE
idle_power_consumption = 10
active_power_consumption = 60
can_unwrench_while_on = FALSE
can_unwrench = TRUE
@@ -215,14 +216,6 @@
pipe_image.plane = ABOVE_HUD_PLANE
playsound(loc, 'sound/weapons/bladeslice.ogg', 100, TRUE)
/obj/machinery/atmospherics/unary/vent_scrubber/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
if(!(stat & NOPOWER) && on)
to_chat(user, "<span class='danger'>You cannot unwrench this [src], turn it off first.</span>")
return TRUE
return ..()
/obj/machinery/atmospherics/unary/vent_scrubber/welder_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_use_check(user, 0))
@@ -83,17 +83,19 @@ GLOBAL_LIST_EMPTY(gas_meters)
return ..()
/obj/machinery/atmospherics/meter/attackby(obj/item/W as obj, mob/user as mob, params)
if(!iswrench(W))
return ..()
playsound(loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if(do_after(user, 40 * W.toolspeed, target = src))
user.visible_message( \
"[user] unfastens \the [src].", \
"<span class='notice'>You have unfastened \the [src].</span>", \
"You hear ratchet.")
deconstruct(TRUE)
/obj/machinery/atmospherics/meter/wrench_act(mob/living/user, obj/item/wrench/W)
// don't call parent here, we're kind of different
to_chat(user, "<span class='notice'>You begin to unfasten [src]...</span>")
if(!W.use_tool(src, user, volume = W.tool_volume))
return
user.visible_message(
"[user] unfastens [src].",
"<span class='notice'>You have unfastened [src].</span>",
"You hear ratchet."
)
deconstruct(TRUE)
return TRUE
/obj/machinery/atmospherics/meter/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
+27 -26
View File
@@ -201,15 +201,16 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/economy/vending/wallmed/survival_pod,
density = TRUE
pixel_y = -32
/obj/item/gps/computer/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
playsound(loc, W.usesound, 50, 1)
user.visible_message("<span class='warning'>[user] disassembles the gps.</span>", \
"<span class='notice'>You start to disassemble the gps...</span>", "You hear clanking and banging noises.")
if(do_after(user, 20 * W.toolspeed, target = src))
new /obj/item/gps(loc)
qdel(src)
return ..()
/obj/item/gps/computer/wrench_act(mob/living/user, obj/item/I)
. = TRUE
user.visible_message("<span class='warning'>[user] starts to disassemble [src].</span>", \
"<span class='notice'>You start to disassemble [src]...</span>", "You hear clanking and banging noises.")
if(!I.use_tool(src, user, 2 SECONDS, 0, 50))
return
user.visible_message("<span class='warning'>[user] disassembles [src].</span>", \
"<span class='notice'>You disassemble [src].</span>", "You hear clanking and banging noises.")
new /obj/item/gps(loc)
qdel(src)
/obj/item/gps/computer/attack_hand(mob/user)
attack_self(user)
@@ -296,14 +297,15 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/economy/vending/wallmed/survival_pod,
new buildstacktype(loc, buildstackamount)
qdel(src)
/obj/structure/fans/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
playsound(loc, W.usesound, 50, 1)
user.visible_message("<span class='warning'>[user] disassembles the fan.</span>", \
"<span class='notice'>You start to disassemble the fan...</span>", "You hear clanking and banging noises.")
if(do_after(user, 20 * W.toolspeed, target = src))
deconstruct()
return ..()
/obj/structure/fans/wrench_act(mob/living/user, obj/item/I)
. = TRUE
user.visible_message("<span class='warning'>[user] starts to disassemble [src].</span>", \
"<span class='notice'>You start to disassemble [src]...</span>", "You hear clanking and banging noises.")
if(!I.use_tool(src, user, 2 SECONDS, volume = 50))
return
user.visible_message("<span class='warning'>[user] disassembles [src].</span>", \
"<span class='notice'>You disassemble [src].</span>", "You hear something fall on the floor.")
deconstruct()
/obj/structure/fans/tiny
name = "tiny fan"
@@ -343,15 +345,14 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/economy/vending/wallmed/survival_pod,
layer = MOB_LAYER - 0.2
density = FALSE
/obj/structure/tubes/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
playsound(loc, W.usesound, 50, 1)
user.visible_message("<span class='warning'>[user] disassembles [src].</span>", \
"<span class='notice'>You start to disassemble [src]...</span>", "You hear clanking and banging noises.")
if(do_after(user, 20 * W.toolspeed, target = src))
new /obj/item/stack/rods(loc)
qdel(src)
return ..()
/obj/structure/tubes/wrench_act(mob/living/user, obj/item/W)
. = TRUE
user.visible_message("<span class='warning'>[user] disassembles [src].</span>", \
"<span class='notice'>You start to disassemble [src]...</span>", "You hear clanking and banging noises.")
if(!W.use_tool(src, user, 2 SECONDS, volume = 50))
return
new /obj/item/stack/rods(loc)
qdel(src)
/obj/item/fakeartefact
name = "expensive forgery"
+15 -20
View File
@@ -1247,27 +1247,22 @@ GLOBAL_LIST_INIT(ai_verbs_default, list(
C.Togglelight(1)
lit_cameras |= C
/mob/living/silicon/ai/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
if(anchored)
user.visible_message("<span class='notice'>\The [user] starts to unbolt \the [src] from the plating...</span>")
if(!do_after(user, 40 * W.toolspeed, target = src))
user.visible_message("<span class='notice'>\The [user] decides not to unbolt \the [src].</span>")
return
user.visible_message("<span class='notice'>\The [user] finishes unfastening \the [src]!</span>")
anchored = FALSE
/mob/living/silicon/ai/wrench_act(mob/living/user, obj/item/I)
. = TRUE
if(anchored)
user.visible_message("<span class='notice'>[user] starts to unbolt [src] from the plating...</span>")
if(I.use_tool(src, user, 4 SECONDS, 0, 50))
user.visible_message("<span class='notice'>[user] decides not to unbolt [src].</span>")
return
else
user.visible_message("<span class='notice'>\The [user] starts to bolt \the [src] to the plating...</span>")
if(!do_after(user, 40 * W.toolspeed, target = src))
user.visible_message("<span class='notice'>\The [user] decides not to bolt \the [src].</span>")
return
user.visible_message("<span class='notice'>\The [user] finishes fastening down \the [src]!</span>")
anchored = TRUE
return
else
return ..()
user.visible_message("<span class='notice'>[user] finishes unfastening [src]!</span>")
anchored = FALSE
return
user.visible_message("<span class='notice'>[user] starts to bolt [src] to the plating...</span>")
if(!I.use_tool(src, user, 4 SECONDS, 0, 50))
user.visible_message("<span class='notice'>[user] decides not to bolt [src].</span>")
return FALSE
user.visible_message("<span class='notice'>[user] finishes fastening down [src]!</span>")
anchored = TRUE
/mob/living/silicon/ai/welder_act()
return
@@ -505,7 +505,7 @@
//General Griefsky
else if(istype(I, /obj/item/wrench) && build_step == 3)
else if(iswrench(I) && build_step == 3)
var/obj/item/griefsky_assembly/A = new /obj/item/griefsky_assembly(get_turf(src))
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You adjust the arm slots for extra weapons!</span>")
@@ -47,6 +47,24 @@
else
to_chat(user, "<span class='warning'>The controls are locked!</span>")
/obj/machinery/power/rad_collector/wrench_act(mob/living/user, obj/item/I)
. = TRUE
if(loaded_tank)
to_chat(user, "<span class='notice'>Remove the plasma tank first.</span>")
return TRUE
var/turf/T = get_turf(src)
for(var/obj/machinery/power/rad_collector/can_wrench in T.contents)
if(can_wrench.anchored && !anchored)
to_chat(user, "<span class='notice'>You can't wrench down [src] here!</span>")
return
I.play_tool_sound(src)
anchored = !anchored
user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the [name].", "You [anchored ? "secure" : "undo"] the external bolts.", "You hear a ratchet")
if(anchored)
connect_to_network()
else
disconnect_from_network()
/obj/machinery/power/rad_collector/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/tank/internals/plasma))
@@ -64,22 +82,6 @@
if(loaded_tank && !locked)
eject()
return TRUE
else if(iswrench(I))
if(loaded_tank)
to_chat(user, "<span class='notice'>Remove the plasma tank first.</span>")
return TRUE
var/turf/T = get_turf(src)
for(var/obj/machinery/power/rad_collector/can_wrench in T.contents)
if(can_wrench.anchored && !anchored)
to_chat(user, "<span class='notice'>You can't wrench down [src] here!</span>")
return
playsound(loc, I.usesound, 75, TRUE)
anchored = !anchored
user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the [name].", "You [anchored ? "secure" : "undo"] the external bolts.", "You hear a ratchet")
if(anchored)
connect_to_network()
else
disconnect_from_network()
else if(istype(I, /obj/item/card/id) || istype(I, /obj/item/pda))
if(allowed(user))
if(active)
@@ -77,33 +77,29 @@ GLOBAL_LIST_EMPTY(field_generator_fields)
else
to_chat(user, "<span class='warning'>[src] needs to be firmly secured to the floor first!</span>")
/obj/machinery/field/generator/attackby(obj/item/W, mob/user, params)
/obj/machinery/field/generator/wrench_act(mob/living/user, obj/item/W)
. = TRUE
if(active)
to_chat(user, "<span class='warning'>[src] needs to be off!</span>")
return
else if(istype(W, /obj/item/wrench))
switch(state)
if(FG_UNSECURED)
if(isinspace()) return
state = FG_SECURED
playsound(loc, W.usesound, 75, 1)
user.visible_message("[user.name] secures [name] to the floor.", \
"<span class='notice'>You secure the external reinforcing bolts to the floor.</span>", \
"<span class='italics'>You hear ratchet.</span>")
anchored = TRUE
if(FG_SECURED)
state = FG_UNSECURED
playsound(loc, W.usesound, 75, 1)
user.visible_message("[user.name] unsecures [name] reinforcing bolts from the floor.", \
"<span class='notice'>You undo the external reinforcing bolts.</span>", \
"<span class='italics'>You hear ratchet.</span>")
anchored = FALSE
if(FG_WELDED)
to_chat(user, "<span class='warning'>[src] needs to be unwelded from the floor!</span>")
else
return ..()
switch(state)
if(FG_UNSECURED)
if(isinspace()) return
state = FG_SECURED
W.play_tool_sound(W, 75)
user.visible_message("[user.name] secures [name] to the floor.", \
"<span class='notice'>You secure the external reinforcing bolts to the floor.</span>", \
"<span class='italics'>You hear ratchet.</span>")
anchored = TRUE
if(FG_SECURED)
state = FG_UNSECURED
W.play_tool_sound(W, 75)
user.visible_message("[user.name] unsecures [name] reinforcing bolts from the floor.", \
"<span class='notice'>You undo the external reinforcing bolts.</span>", \
"<span class='italics'>You hear ratchet.</span>")
anchored = FALSE
if(FG_WELDED)
to_chat(user, "<span class='warning'>[src] needs to be unwelded from the floor!</span>")
/obj/machinery/field/generator/welder_act(mob/user, obj/item/I)
. = TRUE
@@ -21,18 +21,18 @@
transfer_fingerprints_to(S)
if(src) qdel(src)
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
anchored = !anchored
playsound(src.loc, W.usesound, 75, 1)
if(anchored)
user.visible_message("[user.name] secures [src] to the floor.", \
"You secure [src] to the floor.", \
"You hear a ratchet")
src.add_hiddenprint(user)
else
user.visible_message("[user.name] unsecures [src] from the floor.", \
"You unsecure [src.name] from the floor.", \
"You hear a ratchet")
/obj/machinery/the_singularitygen/wrench_act(mob/living/user, obj/item/wrench/W)
. = TRUE
anchored = !anchored
if(!W.use_tool(src, user, 2 SECONDS, 0, 50))
return
return ..()
if(anchored)
user.visible_message("[user.name] secures [src] to the floor.", \
"You secure [src] to the floor.", \
"You hear a ratchet.")
src.add_hiddenprint(user)
else
user.visible_message("[user.name] unsecures [src] from the floor.", \
"You unsecure [src.name] from the floor.", \
"You hear a ratchet.")
+41 -29
View File
@@ -137,10 +137,41 @@
// wrench: (un)anchor
// weldingtool: convert to real pipe
/obj/structure/disposalconstruct/attackby(obj/item/I, mob/user, params)
/obj/structure/disposalconstruct/wrench_act(mob/living/user, obj/item/I)
var/ispipe = is_pipe()
var/nicetype = get_nice_name()
if(anchored)
anchored = FALSE
if(ispipe)
level = 2
density = FALSE
else
density = TRUE
to_chat(user, "You detach the [nicetype] from the underfloor.")
else
anchored = TRUE
if(ispipe)
level = 1 // We don't want disposal bins to disappear under the floors
density = FALSE
else
density = TRUE // We don't want disposal bins or outlets to go density 0
to_chat(user, "You attach the [nicetype] to the underfloor.")
I.play_tool_sound(src, I.tool_volume)
update()
return TRUE
/obj/structure/disposalconstruct/proc/is_pipe()
switch(ptype)
// lewtodo: this sucks
if(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)
return FALSE
if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT)
return TRUE
else
return TRUE
/obj/structure/disposalconstruct/proc/get_nice_name()
var/nicetype = "pipe"
var/ispipe = 0 // Indicates if we should change the level of this pipe
src.add_fingerprint(user)
switch(ptype)
if(PIPE_DISPOSALS_BIN)
nicetype = "disposal bin"
@@ -150,38 +181,19 @@
nicetype = "delivery chute"
if(PIPE_DISPOSALS_SORT_RIGHT, PIPE_DISPOSALS_SORT_LEFT)
nicetype = "sorting pipe"
ispipe = 1
else
nicetype = "pipe"
ispipe = 1
return nicetype
/obj/structure/disposalconstruct/attackby(obj/item/I, mob/user, params)
var/nicetype = get_nice_name()
var/ispipe = is_pipe() // Indicates if we should change the level of this pipe
add_fingerprint(user)
var/turf/T = src.loc
if(T.intact)
to_chat(user, "You can only attach the [nicetype] if the floor plating is removed.")
return
if(istype(I, /obj/item/wrench))
if(anchored)
anchored = FALSE
if(ispipe)
level = 2
density = FALSE
else
density = TRUE
to_chat(user, "You detach the [nicetype] from the underfloor.")
else
anchored = TRUE
if(ispipe)
level = 1 // We don't want disposal bins to disappear under the floors
density = FALSE
else
density = TRUE // We don't want disposal bins or outlets to go density 0
to_chat(user, "You attach the [nicetype] to the underfloor.")
playsound(src.loc, I.usesound, 100, 1)
update()
return
if(ptype in list(PIPE_DISPOSALS_BIN, PIPE_DISPOSALS_OUTLET, PIPE_DISPOSALS_CHUTE)) // Disposal or outlet
var/obj/structure/disposalpipe/trunk/CP = locate() in T
if(!CP) // There's no trunk
+22 -39
View File
@@ -32,38 +32,25 @@
density = TRUE
anchored = TRUE
/obj/machinery/bsa/wrench_act(mob/living/user, obj/item/I)
default_unfasten_wrench(user, I, 1 SECONDS)
return TRUE
/obj/machinery/bsa/multitool_act(mob/living/user, obj/item/multitool/M)
M.buffer = src
to_chat(user, "<span class='notice'>You store linkage information in [M]'s buffer.</span>")
return TRUE
/obj/machinery/bsa/back
name = "Bluespace Artillery Generator"
desc = "Generates cannon pulse. Needs to be linked with a fusor. "
icon_state = "power_box"
/obj/machinery/bsa/back/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/multitool))
var/obj/item/multitool/M = W
M.buffer = src
to_chat(user, "<span class='notice'>You store linkage information in [W]'s buffer.</span>")
else if(istype(W, /obj/item/wrench))
default_unfasten_wrench(user, W, 10)
return TRUE
else
return ..()
/obj/machinery/bsa/front
name = "Bluespace Artillery Bore"
desc = "Do not stand in front of cannon during operation. Needs to be linked with a fusor."
icon_state = "emitter_center"
/obj/machinery/bsa/front/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/multitool))
var/obj/item/multitool/M = W
M.buffer = src
to_chat(user, "<span class='notice'>You store linkage information in [W]'s buffer.</span>")
else if(istype(W, /obj/item/wrench))
default_unfasten_wrench(user, W, 10)
return TRUE
else
return ..()
/obj/machinery/bsa/middle
name = "Bluespace Artillery Fusor"
desc = "Contents classifed by Nanotrasen Naval Command. Needs to be linked with the other BSA parts using multitool."
@@ -71,23 +58,19 @@
var/obj/machinery/bsa/back/back
var/obj/machinery/bsa/front/front
/obj/machinery/bsa/middle/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/multitool))
var/obj/item/multitool/M = W
if(M.buffer)
if(istype(M.buffer,/obj/machinery/bsa/back))
back = M.buffer
M.buffer = null
to_chat(user, "<span class='notice'>You link [src] with [back].</span>")
else if(istype(M.buffer,/obj/machinery/bsa/front))
front = M.buffer
M.buffer = null
to_chat(user, "<span class='notice'>You link [src] with [front].</span>")
else if(istype(W, /obj/item/wrench))
default_unfasten_wrench(user, W, 10)
return TRUE
else
return ..()
/obj/machinery/bsa/middle/multitool_act(mob/living/user, obj/item/multitool/M)
. = TRUE
if(!M.buffer)
to_chat(user, "<span class='warning'>[M]'s buffer is empty!</span>")
return
if(istype(M.buffer,/obj/machinery/bsa/back))
back = M.buffer
M.buffer = null
to_chat(user, "<span class='notice'>You link [src] with [back].</span>")
else if(istype(M.buffer,/obj/machinery/bsa/front))
front = M.buffer
M.buffer = null
to_chat(user, "<span class='notice'>You link [src] with [front].</span>")
/obj/machinery/bsa/middle/proc/check_completion()
if(!front || !back)