[MIRROR] Ports more operations to "tool_act" (#5718)
* Merge pull request #35854 from ACCount12/more_tool_act Ports more operations to "tool_act" * Ports more operations to "tool_act"
This commit is contained in:
committed by
Poojawa
parent
f74ceb582c
commit
5f6c41fa30
@@ -134,78 +134,92 @@
|
||||
toggle_cam(null, 0)
|
||||
..()
|
||||
|
||||
/obj/machinery/camera/attackby(obj/item/W, mob/living/user, params)
|
||||
var/msg = "<span class='notice'>You attach [W] into the assembly's inner circuits.</span>"
|
||||
var/msg2 = "<span class='notice'>[src] already has that upgrade!</span>"
|
||||
// Construction/Deconstruction
|
||||
/obj/machinery/camera/screwdriver_act(mob/living/user, obj/item/I)
|
||||
panel_open = !panel_open
|
||||
to_chat(user, "<span class='notice'>You screw the camera's panel [panel_open ? "open" : "closed"].</span>")
|
||||
I.play_tool_sound(src)
|
||||
return TRUE
|
||||
|
||||
// DECONSTRUCTION
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
panel_open = !panel_open
|
||||
to_chat(user, "<span class='notice'>You screw the camera's panel [panel_open ? "open" : "closed"].</span>")
|
||||
W.play_tool_sound(src)
|
||||
return
|
||||
/obj/machinery/camera/wirecutter_act(mob/living/user, obj/item/I)
|
||||
if(!panel_open)
|
||||
return FALSE
|
||||
toggle_cam(user, 1)
|
||||
obj_integrity = max_integrity //this is a pretty simplistic way to heal the camera, but there's no reason for this to be complex.
|
||||
I.play_tool_sound(src)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/camera/multitool_act(mob/living/user, obj/item/I)
|
||||
if(!panel_open)
|
||||
return FALSE
|
||||
|
||||
setViewRange((view_range == initial(view_range)) ? short_range : initial(view_range))
|
||||
to_chat(user, "<span class='notice'>You [(view_range == initial(view_range)) ? "restore" : "mess up"] the camera's focus.</span>")
|
||||
return
|
||||
|
||||
/obj/machinery/camera/welder_act(mob/living/user, obj/item/I)
|
||||
if(!panel_open)
|
||||
return FALSE
|
||||
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return TRUE
|
||||
|
||||
to_chat(user, "<span class='notice'>You start to weld [src]...</span>")
|
||||
if(I.use_tool(src, user, 100, volume=50))
|
||||
user.visible_message("<span class='warning'>[user] unwelds [src], leaving it as just a frame bolted to the wall.</span>",
|
||||
"<span class='warning'>You unweld [src], leaving it as just a frame bolted to the wall</span>")
|
||||
deconstruct(TRUE)
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/camera/attackby(obj/item/I, mob/living/user, params)
|
||||
// UPGRADES
|
||||
if(panel_open)
|
||||
if(istype(W, /obj/item/wirecutters)) //enable/disable the camera
|
||||
toggle_cam(user, 1)
|
||||
obj_integrity = max_integrity //this is a pretty simplistic way to heal the camera, but there's no reason for this to be complex.
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/device/multitool)) //change focus
|
||||
setViewRange((view_range == initial(view_range)) ? short_range : initial(view_range))
|
||||
to_chat(user, "<span class='notice'>You [(view_range == initial(view_range)) ? "restore" : "mess up"] the camera's focus.</span>")
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/weldingtool))
|
||||
if(weld(W, user))
|
||||
visible_message("<span class='warning'>[user] unwelds [src], leaving it as just a frame bolted to the wall.</span>", "<span class='warning'>You unweld [src], leaving it as just a frame bolted to the wall</span>")
|
||||
deconstruct(TRUE)
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/device/analyzer))
|
||||
if(istype(I, /obj/item/device/analyzer))
|
||||
if(!isXRay())
|
||||
if(!user.temporarilyRemoveItemFromInventory(W))
|
||||
if(!user.temporarilyRemoveItemFromInventory(I))
|
||||
return
|
||||
qdel(W)
|
||||
qdel(I)
|
||||
upgradeXRay()
|
||||
to_chat(user, "[msg]")
|
||||
to_chat(user, "<span class='notice'>You attach [I] into the assembly's inner circuits.</span>")
|
||||
else
|
||||
to_chat(user, "[msg2]")
|
||||
to_chat(user, "<span class='notice'>[src] already has that upgrade!</span>")
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/stack/sheet/mineral/plasma))
|
||||
else if(istype(I, /obj/item/stack/sheet/mineral/plasma))
|
||||
if(!isEmpProof())
|
||||
var/obj/item/stack/sheet/mineral/plasma/P = W
|
||||
upgradeEmpProof()
|
||||
to_chat(user, "[msg]")
|
||||
P.use(1)
|
||||
if(I.use_tool(src, user, 0, amount=1))
|
||||
upgradeEmpProof()
|
||||
to_chat(user, "<span class='notice'>You attach [I] into the assembly's inner circuits.</span>")
|
||||
else
|
||||
to_chat(user, "[msg2]")
|
||||
to_chat(user, "<span class='notice'>[src] already has that upgrade!</span>")
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/device/assembly/prox_sensor))
|
||||
else if(istype(I, /obj/item/device/assembly/prox_sensor))
|
||||
if(!isMotion())
|
||||
if(!user.temporarilyRemoveItemFromInventory(I))
|
||||
return
|
||||
upgradeMotion()
|
||||
to_chat(user, "[msg]")
|
||||
qdel(W)
|
||||
to_chat(user, "<span class='notice'>You attach [I] into the assembly's inner circuits.</span>")
|
||||
qdel(I)
|
||||
else
|
||||
to_chat(user, "[msg2]")
|
||||
to_chat(user, "<span class='notice'>[src] already has that upgrade!</span>")
|
||||
return
|
||||
|
||||
// OTHER
|
||||
if((istype(W, /obj/item/paper) || istype(W, /obj/item/device/pda)) && isliving(user))
|
||||
if((istype(I, /obj/item/paper) || istype(I, /obj/item/device/pda)) && isliving(user))
|
||||
var/mob/living/U = user
|
||||
var/obj/item/paper/X = null
|
||||
var/obj/item/device/pda/P = null
|
||||
|
||||
var/itemname = ""
|
||||
var/info = ""
|
||||
if(istype(W, /obj/item/paper))
|
||||
X = W
|
||||
if(istype(I, /obj/item/paper))
|
||||
X = I
|
||||
itemname = X.name
|
||||
info = X.info
|
||||
else
|
||||
P = W
|
||||
P = I
|
||||
itemname = P.name
|
||||
info = P.notehtml
|
||||
to_chat(U, "<span class='notice'>You hold \the [itemname] up to the camera...</span>")
|
||||
@@ -225,7 +239,7 @@
|
||||
O << browse(text("<HTML><HEAD><TITLE>[]</TITLE></HEAD><BODY><TT>[]</TT></BODY></HTML>", itemname, info), text("window=[]", itemname))
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/device/camera_bug))
|
||||
else if(istype(I, /obj/item/device/camera_bug))
|
||||
if(!can_use())
|
||||
to_chat(user, "<span class='notice'>Camera non-functional.</span>")
|
||||
return
|
||||
@@ -235,12 +249,12 @@
|
||||
bug = null
|
||||
else
|
||||
to_chat(user, "<span class='notice'>Camera bugged.</span>")
|
||||
bug = W
|
||||
bug = I
|
||||
bug.bugged_cameras[src.c_tag] = src
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/pai_cable))
|
||||
var/obj/item/pai_cable/cable = W
|
||||
else if(istype(I, /obj/item/pai_cable))
|
||||
var/obj/item/pai_cable/cable = I
|
||||
cable.plugin(src, user)
|
||||
return
|
||||
|
||||
@@ -370,20 +384,6 @@
|
||||
|
||||
return null
|
||||
|
||||
/obj/machinery/camera/proc/weld(obj/item/weldingtool/W, mob/living/user)
|
||||
if(busy)
|
||||
return FALSE
|
||||
if(!W.tool_start_check(user, amount=0))
|
||||
return FALSE
|
||||
|
||||
to_chat(user, "<span class='notice'>You start to weld [src]...</span>")
|
||||
busy = TRUE
|
||||
if(W.use_tool(src, user, 100, volume=50))
|
||||
busy = FALSE
|
||||
return TRUE
|
||||
busy = FALSE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/camera/proc/Togglelight(on=0)
|
||||
for(var/mob/living/silicon/ai/A in GLOB.ai_list)
|
||||
for(var/obj/machinery/camera/cam in A.lit_cameras)
|
||||
|
||||
@@ -244,32 +244,33 @@
|
||||
dish_quants[S.name] = 1
|
||||
sortList(dish_quants)
|
||||
|
||||
/obj/machinery/vending/attackby(obj/item/W, mob/user, params)
|
||||
/obj/machinery/vending/crowbar_act(mob/living/user, obj/item/I)
|
||||
if(!component_parts)
|
||||
return FALSE
|
||||
default_deconstruction_crowbar(I)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/vending/wrench_act(mob/living/user, obj/item/I)
|
||||
if(panel_open)
|
||||
if(default_unfasten_wrench(user, W, time = 60))
|
||||
return
|
||||
default_unfasten_wrench(user, I, time = 60)
|
||||
return TRUE
|
||||
|
||||
if(component_parts)
|
||||
if(default_deconstruction_crowbar(W))
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
if(anchored)
|
||||
panel_open = !panel_open
|
||||
to_chat(user, "<span class='notice'>You [panel_open ? "open" : "close"] the maintenance panel.</span>")
|
||||
cut_overlays()
|
||||
if(panel_open)
|
||||
add_overlay("[initial(icon_state)]-panel")
|
||||
W.play_tool_sound(src)
|
||||
updateUsrDialog()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You must first secure [src].</span>")
|
||||
return
|
||||
else if(istype(W, /obj/item/device/multitool)||istype(W, /obj/item/wirecutters))
|
||||
/obj/machinery/vending/screwdriver_act(mob/living/user, obj/item/I)
|
||||
if(anchored)
|
||||
default_deconstruction_screwdriver(user, icon_state, icon_state, I)
|
||||
cut_overlays()
|
||||
if(panel_open)
|
||||
attack_hand(user)
|
||||
add_overlay("[initial(icon_state)]-panel")
|
||||
updateUsrDialog()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You must first secure [src].</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/vending/attackby(obj/item/I, mob/user, params)
|
||||
if(panel_open && is_wire_tool(I))
|
||||
wires.interact(user)
|
||||
return
|
||||
else if(istype(W, /obj/item/coin))
|
||||
else if(istype(I, /obj/item/coin))
|
||||
if(coin)
|
||||
to_chat(user, "<span class='warning'>[src] already has [coin] inserted</span>")
|
||||
return
|
||||
@@ -279,32 +280,32 @@
|
||||
if(!premium.len)
|
||||
to_chat(user, "<span class='warning'>[src] doesn't have a coin slot.</span>")
|
||||
return
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
if(!user.transferItemToLoc(I, src))
|
||||
return
|
||||
coin = W
|
||||
to_chat(user, "<span class='notice'>You insert [W] into [src].</span>")
|
||||
coin = I
|
||||
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
|
||||
return
|
||||
else if(istype(W, /obj/item/stack/spacecash))
|
||||
else if(istype(I, /obj/item/stack/spacecash))
|
||||
if(coin)
|
||||
to_chat(user, "<span class='warning'>[src] already has [coin] inserted</span>")
|
||||
return
|
||||
if(bill)
|
||||
to_chat(user, "<span class='warning'>[src] already has [bill] inserted</span>")
|
||||
return
|
||||
var/obj/item/stack/S = W
|
||||
var/obj/item/stack/S = I
|
||||
if(!premium.len)
|
||||
to_chat(user, "<span class='warning'>[src] doesn't have a bill slot.</span>")
|
||||
return
|
||||
S.use(1)
|
||||
bill = new S.type(src,1)
|
||||
to_chat(user, "<span class='notice'>You insert [W] into [src].</span>")
|
||||
bill = new S.type(src, 1)
|
||||
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
|
||||
return
|
||||
else if(istype(W, refill_canister) && refill_canister != null)
|
||||
else if(istype(I, refill_canister) && refill_canister != null)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
to_chat(user, "<span class='notice'>It does nothing.</span>")
|
||||
else if(panel_open)
|
||||
//if the panel is open we attempt to refill the machine
|
||||
var/obj/item/vending_refill/canister = W
|
||||
var/obj/item/vending_refill/canister = I
|
||||
if(canister.charges[STANDARD_CHARGE] == 0)
|
||||
to_chat(user, "<span class='notice'>This [canister.name] is empty!</span>")
|
||||
else
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
return FAILED_UNFASTEN
|
||||
return ..()
|
||||
|
||||
/obj/structure/shuttle/engine/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20)
|
||||
/obj/structure/shuttle/engine/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
||||
. = ..()
|
||||
if(. == SUCCESSFUL_UNFASTEN)
|
||||
if(anchored)
|
||||
@@ -34,42 +34,40 @@
|
||||
else
|
||||
state = ENGINE_UNWRENCHED
|
||||
|
||||
/obj/structure/shuttle/engine/attackby(obj/item/I, mob/user, params)
|
||||
add_fingerprint(user)
|
||||
if(default_unfasten_wrench(user, I))
|
||||
return
|
||||
else if(istype(I, /obj/item/weldingtool))
|
||||
switch(state)
|
||||
if(ENGINE_UNWRENCHED)
|
||||
to_chat(user, "<span class='warning'>The [src.name] needs to be wrenched to the floor!</span>")
|
||||
if(EM_SECURED)
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return
|
||||
/obj/structure/shuttle/engine/wrench_act(mob/living/user, obj/item/I)
|
||||
default_unfasten_wrench(user, I)
|
||||
return TRUE
|
||||
|
||||
user.visible_message("[user.name] starts to weld the [name] to the floor.", \
|
||||
"<span class='notice'>You start to weld \the [src] to the floor...</span>", \
|
||||
"<span class='italics'>You hear welding.</span>")
|
||||
/obj/structure/shuttle/engine/welder_act(mob/living/user, obj/item/I)
|
||||
switch(state)
|
||||
if(ENGINE_UNWRENCHED)
|
||||
to_chat(user, "<span class='warning'>The [src.name] needs to be wrenched to the floor!</span>")
|
||||
if(EM_SECURED)
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return TRUE
|
||||
|
||||
if(I.use_tool(src, user, ENGINE_WELDTIME, volume=50))
|
||||
state = ENGINE_WELDED
|
||||
to_chat(user, "<span class='notice'>You weld \the [src] to the floor.</span>")
|
||||
alter_engine_power(engine_power)
|
||||
user.visible_message("[user.name] starts to weld the [name] to the floor.", \
|
||||
"<span class='notice'>You start to weld \the [src] to the floor...</span>", \
|
||||
"<span class='italics'>You hear welding.</span>")
|
||||
|
||||
if(EM_WELDED)
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return
|
||||
if(I.use_tool(src, user, ENGINE_WELDTIME, volume=50))
|
||||
state = ENGINE_WELDED
|
||||
to_chat(user, "<span class='notice'>You weld \the [src] to the floor.</span>")
|
||||
alter_engine_power(engine_power)
|
||||
|
||||
user.visible_message("[user.name] starts to cut the [name] free from the floor.", \
|
||||
"<span class='notice'>You start to cut \the [src] free from the floor...</span>", \
|
||||
"<span class='italics'>You hear welding.</span>")
|
||||
if(EM_WELDED)
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return TRUE
|
||||
|
||||
if(I.use_tool(src, user, ENGINE_WELDTIME, volume=50))
|
||||
state = ENGINE_WRENCHED
|
||||
to_chat(user, "<span class='notice'>You cut \the [src] free from the floor.</span>")
|
||||
alter_engine_power(-engine_power)
|
||||
return
|
||||
else
|
||||
return ..()
|
||||
user.visible_message("[user.name] starts to cut the [name] free from the floor.", \
|
||||
"<span class='notice'>You start to cut \the [src] free from the floor...</span>", \
|
||||
"<span class='italics'>You hear welding.</span>")
|
||||
|
||||
if(I.use_tool(src, user, ENGINE_WELDTIME, volume=50))
|
||||
state = ENGINE_WRENCHED
|
||||
to_chat(user, "<span class='notice'>You cut \the [src] free from the floor.</span>")
|
||||
alter_engine_power(-engine_power)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/shuttle/engine/Destroy()
|
||||
if(state == ENGINE_WELDED)
|
||||
|
||||
Reference in New Issue
Block a user