[Testmerge ready] Ports tool behaviours; refactors all tools; adds functionality for self-filling reagent containers (#11700)

* Adds support for self-filling reagent containers

* Sets tool_behaviour on the default set of tools

* Fixing merge conflicts

* Refactors welder to use tool behaviour

* The refactor: part I

* The refactor: part II

* Tool Refactor Part III: Revenge of the Maint

* Tool Refactor Part IV: A New Hope

* Tool Refactor Part V: The Oldcoder Strikes Back

* Tool Refactor Part VI: Return of the Coder

* VII

* Holy shit, it compiles?!

* Nannek I completed your TODO, you owe me ice cream

* Tool helpers; telepad is compliant

* Bugtest, Round 1: Fight

Fuck refactoring disposals

* Buggfixing, Round 2: Electric Boogaloo

* Personal crafting uses tool behaviours now

* Construction datums use new tool behaviours; better way of handling fueltank refuelling; more bugfixing

* multitool_check_buffer change; removes some useless things in tool_helpers

* proc name change

* TRUE/FALSE changes

* Bugfixing, Round 3: A Good Day To Bugfix Hard

Fixes multiple issues raised by the testmerge

* Minor style changes
This commit is contained in:
Citinited
2020-02-15 13:31:08 -07:00
committed by GitHub
parent 5b1941e784
commit fddff1049b
238 changed files with 6681 additions and 5544 deletions
+121 -112
View File
@@ -441,59 +441,6 @@
if(issilicon(user) && get_dist(src,user)>1)
return src.attack_hand(user)
if(istype(W, /obj/item/crowbar)) //Using crowbar
if(opened) // a) on open apc
if(has_electronics==1)
if(terminal)
to_chat(user, "<span class='warning'>Disconnect the wires first!</span>")
return
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You are trying to remove the power control board...</span>" )
if(do_after(user, 50*W.toolspeed, target = src))
if(has_electronics==1)
has_electronics = 0
if(stat & BROKEN)
user.visible_message(\
"[user.name] has broken the power control board inside [src.name]!",
"<span class='notice'>You break the charred power control board and remove the remains.</span>",
"<span class='italics'>You hear a crack.</span>")
return
//SSticker.mode:apcs-- //XSI said no and I agreed. -rastaf0
else if(emagged) // We emag board, not APC's frame
emagged = FALSE
user.visible_message(
"[user.name] has discarded emaged power control board from [src.name]!",
"<span class='notice'>You discarded shorten board.</span>")
return
else if(malfhack) // AI hacks board, not APC's frame
user.visible_message(\
"[user.name] has discarded strangely programmed power control board from [src.name]!",
"<span class='notice'>You discarded strangely programmed board.</span>")
malfai = null
malfhack = 0
return
else
user.visible_message(\
"[user.name] has removed the power control board from [src.name]!",
"<span class='notice'>You remove the power control board.</span>")
new /obj/item/apc_electronics(loc)
return
else if(opened!=2) //cover isn't removed
opened = 0
coverlocked = TRUE //closing cover relocks it
update_icon()
return
else if(!(stat & BROKEN)) // b) on closed and not broken APC
if(coverlocked && !(stat & MAINT)) // locked...
to_chat(user, "<span class='warning'>The cover is locked and cannot be opened!</span>")
return
else if(panel_open) // wires are exposed
to_chat(user, "<span class='warning'>Exposed wires prevents you from opening it!</span>")
return
else
opened = 1
update_icon()
return
else if (istype(W, /obj/item/stock_parts/cell) && opened) // trying to put a cell inside
if(cell)
@@ -513,35 +460,6 @@
chargecount = 0
update_icon()
else if(istype(W, /obj/item/screwdriver)) // haxing
if(opened)
if(cell)
to_chat(user, "<span class='warning'>Close the APC first!</span>") //Less hints more mystery!
return
else
if(has_electronics==1)
has_electronics = 2
stat &= ~MAINT
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You screw the circuit electronics into place.</span>")
else if(has_electronics==2)
has_electronics = 1
stat |= MAINT
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You unfasten the electronics.</span>")
else /* has_electronics==0 */
to_chat(user, "<span class='warning'>There is nothing to secure!</span>")
return
update_icon()
else if(emagged)
to_chat(user, "<span class='warning'>The interface is broken!</span>")
else if((stat & MAINT) && !opened)
..() //its an empty closed frame... theres no wires to expose!
else
panel_open = !panel_open
to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"]")
update_icon()
else if(W.GetID()) // trying to unlock the interface with an ID card
togglelock(user)
@@ -581,9 +499,6 @@
make_terminal()
terminal.connect_to_network()
else if(istype(W, /obj/item/wirecutters) && terminal && opened)
terminal.dismantle(user, W)
else if(istype(W, /obj/item/apc_electronics) && opened)
if(has_electronics!=0) // there are already electronicks inside
to_chat(user, "<span class='warning'>You cannot put the board inside, there already is one!</span>")
@@ -602,31 +517,6 @@
to_chat(user, "<span class='notice'>You place the power control board inside the frame.</span>")
qdel(W)
else if(istype(W, /obj/item/weldingtool) && opened && has_electronics==0 && !terminal)
var/obj/item/weldingtool/WT = W
if(WT.get_fuel() < 3)
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task!</span>")
return
user.visible_message("[user.name] welds [src].", \
"<span class='notice'>You start welding the APC frame...</span>", \
"<span class='italics'>You hear welding.</span>")
playsound(src.loc, WT.usesound, 50, 1)
if(do_after(user, 50*W.toolspeed, target = src))
if(!src || !WT.remove_fuel(3, user))
return
if((stat & BROKEN) || opened==2)
new /obj/item/stack/sheet/metal(loc)
user.visible_message(\
"[user.name] has cut [src] apart with [W].",\
"<span class='notice'>You disassembled the broken APC frame.</span>")
else
new /obj/item/mounted/frame/apc_frame(loc)
user.visible_message(\
"[user.name] has cut [src] from the wall with [W].",\
"<span class='notice'>You cut the APC frame from the wall.</span>")
qdel(src)
return
else if(istype(W, /obj/item/mounted/frame/apc_frame) && opened)
if(!(stat & BROKEN || opened==2 || obj_integrity < max_integrity)) // There is nothing to repair
to_chat(user, "<span class='warning'>You found no reason for repairing this APC</span>")
@@ -654,11 +544,110 @@
opened = 1
update_icon()
return
else if(panel_open && !opened && is_wire_tool(W))
wires.Interact(user)
else
return ..()
/obj/machinery/power/apc/crowbar_act(mob/living/user, obj/item/I)
. = TRUE
if(!I.tool_start_check(user, 0))
return
if(opened) // a) on open apc
if(has_electronics==1)
if(terminal)
to_chat(user, "<span class='warning'>Disconnect the wires first!</span>")
return
to_chat(user, "<span class='notice'>You are trying to remove the power control board...</span>" )
if(I.use_tool(src, user, 50, volume = I.tool_volume))
if(has_electronics==1)
has_electronics = 0
if(stat & BROKEN)
user.visible_message(\
"[user.name] has broken the power control board inside [src.name]!",
"<span class='notice'>You break the charred power control board and remove the remains.</span>",
"<span class='italics'>You hear a crack.</span>")
return
//SSticker.mode:apcs-- //XSI said no and I agreed. -rastaf0
else if(emagged) // We emag board, not APC's frame
emagged = FALSE
user.visible_message(
"[user.name] has discarded emaged power control board from [src.name]!",
"<span class='notice'>You discarded shorten board.</span>")
return
else if(malfhack) // AI hacks board, not APC's frame
user.visible_message(\
"[user.name] has discarded strangely programmed power control board from [src.name]!",
"<span class='notice'>You discarded strangely programmed board.</span>")
malfai = null
malfhack = 0
return
else
user.visible_message(\
"[user.name] has removed the power control board from [src.name]!",
"<span class='notice'>You remove the power control board.</span>")
new /obj/item/apc_electronics(loc)
return
else if(opened!=2) //cover isn't removed
opened = 0
coverlocked = TRUE //closing cover relocks it
update_icon()
return
else if(!(stat & BROKEN)) // b) on closed and not broken APC
if(coverlocked && !(stat & MAINT)) // locked...
to_chat(user, "<span class='warning'>The cover is locked and cannot be opened!</span>")
return
else if(panel_open) // wires are exposed
to_chat(user, "<span class='warning'>Exposed wires prevents you from opening it!</span>")
return
else
opened = 1
update_icon()
/obj/machinery/power/apc/screwdriver_act(mob/living/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
else if(opened)
if(cell && !(stat & MAINT))
to_chat(user, "<span class='warning'>Close the APC first!</span>") //Less hints more mystery!
return
else
if(has_electronics==1)
has_electronics = 2
stat &= ~MAINT
to_chat(user, "<span class='notice'>You screw the circuit electronics into place.</span>")
else if(has_electronics==2)
has_electronics = 1
stat |= MAINT
to_chat(user, "<span class='notice'>You unfasten the electronics.</span>")
else
to_chat(user, "<span class='warning'>There is nothing to secure!</span>")
return
update_icon()
else if(emagged)
to_chat(user, "<span class='warning'>The interface is broken!</span>")
else
panel_open = !panel_open
to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"]")
update_icon()
/obj/machinery/power/apc/wirecutter_act(mob/living/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(panel_open && !opened)
wires.Interact(user)
else if(terminal && opened)
terminal.dismantle(user, I)
/obj/machinery/power/apc/multitool_act(mob/living/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(panel_open && !opened)
wires.Interact(user)
/obj/machinery/power/apc/proc/togglelock(mob/living/user)
if(emagged)
to_chat(user, "<span class='warning'>The interface is broken!</span>")
@@ -695,6 +684,26 @@
visible_message("<span class='warning'>The APC cover is knocked down!</span>")
update_icon()
/obj/machinery/power/apc/welder_act(mob/user, obj/item/I)
if(!opened || has_electronics || terminal)
return
. = TRUE
if(!I.tool_use_check(user, 3))
return
WELDER_ATTEMPT_SLICING_MESSAGE
if(I.use_tool(src, user, 50, amount = 3, volume = I.tool_volume))
if((stat & BROKEN) || opened==2)
new /obj/item/stack/sheet/metal(loc)
user.visible_message(\
"[user.name] has cut [src] apart with [I].",\
"<span class='notice'>You disassembled the broken APC frame.</span>")
else
new /obj/item/mounted/frame/apc_frame(loc)
user.visible_message(\
"[user.name] has cut [src] from the wall with [I].",\
"<span class='notice'>You cut the APC frame from the wall.</span>")
qdel(src)
/obj/machinery/power/apc/emag_act(user as mob)
if(!(emagged || malfhack)) // trying to unlock with an emag card
if(opened)
+26 -18
View File
@@ -159,20 +159,10 @@ By design, d1 is the smallest direction and d2 is the highest
// - Multitool : get the power currently passing through the cable
//
/obj/structure/cable/attackby(obj/item/W, mob/user)
var/turf/T = get_turf(src)
if(T.intact)
return
if(iswirecutter(W))
if(shock(user, 50))
return
user.visible_message("[user] cuts the cable.", "<span class='notice'>You cut the cable.</span>")
investigate_log("was cut by [key_name(usr, 1)] in [get_area(user)]([T.x], [T.y], [T.z] - [ADMIN_JMP(T)])","wires")
deconstruct()
return
else if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = W
if(coil.get_amount() < 1)
@@ -186,14 +176,6 @@ By design, d1 is the smallest direction and d2 is the highest
R.loaded.cable_join(src, user)
R.is_empty(user)
else if(istype(W, /obj/item/multitool))
if(powernet && (powernet.avail > 0)) // is it powered?
to_chat(user, "<span class='danger'>Total power: [DisplayPower(powernet.avail)]\nLoad: [DisplayPower(powernet.load)]\nExcess power: [DisplayPower(surplus())]</span>")
else
to_chat(user, "<span class='danger'>The cable is not powered.</span>")
shock(user, 5, 0.2)
else if(istype(W, /obj/item/toy/crayon))
var/obj/item/toy/crayon/C = W
cable_color(C.colourName)
@@ -204,6 +186,32 @@ By design, d1 is the smallest direction and d2 is the highest
add_fingerprint(user)
/obj/structure/cable/multitool_act(mob/user, obj/item/I)
. = TRUE
var/turf/T = get_turf(src)
if(T.intact)
return
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(powernet && (powernet.avail > 0)) // is it powered?
to_chat(user, "<span class='danger'>Total power: [DisplayPower(powernet.avail)]\nLoad: [DisplayPower(powernet.load)]\nExcess power: [DisplayPower(surplus())]</span>")
else
to_chat(user, "<span class='danger'>The cable is not powered.</span>")
shock(user, 5, 0.2)
/obj/structure/cable/wirecutter_act(mob/user, obj/item/I)
. = TRUE
var/turf/T = get_turf(src)
if(T.intact)
return
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(shock(user, 50))
return
user.visible_message("[user] cuts the cable.", "<span class='notice'>You cut the cable.</span>")
investigate_log("was cut by [key_name(usr, 1)] in [get_area(user)]([T.x], [T.y], [T.z] - [ADMIN_JMP(T)])","wires")
deconstruct()
// shock the user with probability prb
/obj/structure/cable/proc/shock(mob/user, prb, siemens_coeff = 1)
if(!prob(prb))
+1 -1
View File
@@ -64,7 +64,7 @@
return 100 * charge / maxcharge
// use power from a cell
/obj/item/stock_parts/cell/proc/use(amount)
/obj/item/stock_parts/cell/use(amount)
if(rigged && amount > 0)
explode()
return 0
+30 -27
View File
@@ -158,34 +158,37 @@
return
interact(user)
/obj/machinery/power/generator/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/wrench))
anchored = !anchored
if(!anchored)
disconnect()
power_change()
else
connect()
playsound(loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.</span>")
else if(ismultitool(W))
if(cold_dir == WEST)
cold_dir = EAST
hot_dir = WEST
else if(cold_dir == NORTH)
cold_dir = SOUTH
hot_dir = NORTH
else if(cold_dir == EAST)
cold_dir = WEST
hot_dir = EAST
else
cold_dir = NORTH
hot_dir = SOUTH
connect()
to_chat(user, "<span class='notice'>You reverse the generator's circulator settings. The cold circulator is now on the [dir2text(cold_dir)] side, and the heat circulator is now on the [dir2text(hot_dir)] side.</span>")
update_desc()
/obj/machinery/power/generator/multitool_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(cold_dir == WEST)
cold_dir = EAST
hot_dir = WEST
else if(cold_dir == NORTH)
cold_dir = SOUTH
hot_dir = NORTH
else if(cold_dir == EAST)
cold_dir = WEST
hot_dir = EAST
else
return ..()
cold_dir = NORTH
hot_dir = SOUTH
connect()
to_chat(user, "<span class='notice'>You reverse the generator's circulator settings. The cold circulator is now on the [dir2text(cold_dir)] side, and the heat circulator is now on the [dir2text(hot_dir)] side.</span>")
update_desc()
/obj/machinery/power/generator/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
anchored = !anchored
if(!anchored)
disconnect()
power_change()
else
connect()
to_chat(user, "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.</span>")
/obj/machinery/power/generator/proc/get_menu(include_link = 1)
var/t = ""
+10 -9
View File
@@ -187,15 +187,6 @@ var/const/GRAV_NEEDS_WRENCH = 3
broken_state++
update_icon()
return
if(GRAV_NEEDS_WELDING)
if(istype(I, /obj/item/weldingtool))
var/obj/item/weldingtool/WT = I
if(WT.remove_fuel(1, user))
to_chat(user, "<span class='notice'>You mend the damaged framework.</span>")
playsound(src.loc, WT.usesound, 50, 1)
broken_state++
update_icon()
return
if(GRAV_NEEDS_PLASTEEL)
if(istype(I, /obj/item/stack/sheet/plasteel))
var/obj/item/stack/sheet/plasteel/PS = I
@@ -216,6 +207,16 @@ var/const/GRAV_NEEDS_WRENCH = 3
return
return ..()
/obj/machinery/gravity_generator/main/welder_act(mob/user, obj/item/I)
if(broken_state != GRAV_NEEDS_WELDING)
return
. = TRUE
if(!I.use_tool(src, user, amount = 1, volume = I.tool_volume))
return
to_chat(user, "<span class='notice'>You mend the damaged framework.</span>")
broken_state++
update_icon()
/obj/machinery/gravity_generator/main/attack_hand(mob/user as mob)
if(!..())
return interact(user)
+1 -1
View File
@@ -306,7 +306,7 @@
exchange_parts(user, O)
return
else if(istype(O, /obj/item/crowbar) && panel_open)
default_deconstruction_crowbar(O)
default_deconstruction_crowbar(user, O)
else
return ..()
+27 -37
View File
@@ -286,42 +286,6 @@
to_chat(user, "<span class='warning'>The [src.name] needs to be unwelded from the floor.</span>")
return
if(istype(W, /obj/item/weldingtool))
var/obj/item/weldingtool/WT = W
if(active)
to_chat(user, "Turn off the [src] first.")
return
switch(state)
if(0)
to_chat(user, "<span class='warning'>The [src.name] needs to be wrenched to the floor.</span>")
if(1)
if(WT.remove_fuel(0,user))
playsound(src.loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if(do_after(user, 20 * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
state = 2
to_chat(user, "You weld the [src] to the floor.")
connect_to_network()
else
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
if(2)
if(WT.remove_fuel(0,user))
playsound(src.loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if(do_after(user, 20 * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
state = 1
to_chat(user, "You cut the [src] free from the floor.")
disconnect_from_network()
else
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
return
if(istype(W, /obj/item/card/id) || istype(W, /obj/item/pda))
if(emagged)
to_chat(user, "<span class='warning'>The lock seems to be broken</span>")
@@ -343,7 +307,7 @@
if(exchange_parts(user, W))
return
if(default_deconstruction_crowbar(W))
if(default_deconstruction_crowbar(user, W))
return
return ..()
@@ -354,3 +318,29 @@
emagged = 1
if(user)
user.visible_message("[user.name] emags the [src.name].","<span class='warning'>You short out the lock.</span>")
/obj/machinery/power/emitter/welder_act(mob/user, obj/item/I)
if(active)
to_chat(user, "<span class='notice'>Turn off [src] first.</span>")
return
if(state == 0)
to_chat(user, "<span class='warning'>[src] needs to be wrenched to the floor.</span>")
return
. = TRUE
if(!I.tool_use_check(user, 0))
return
if(state == 1)
WELDER_ATTEMPT_FLOOR_WELD_MESSAGE
else if(state == 2)
WELDER_ATTEMPT_FLOOR_SLICE_MESSAGE
if(!I.use_tool(src, user, 20, volume = I.tool_volume))
return
if(state == 1)
WELDER_FLOOR_WELD_SUCCESS_MESSAGE
connect_to_network()
state = 2
else if(state == 2)
WELDER_FLOOR_SLICE_SUCCESS_MESSAGE
disconnect_from_network()
state = 1
@@ -101,41 +101,29 @@ field_generator power level display
anchored = 0
if(FG_WELDED)
to_chat(user, "<span class='warning'>The [name] needs to be unwelded from the floor!</span>")
else if(istype(W, /obj/item/weldingtool))
var/obj/item/weldingtool/WT = W
switch(state)
if(FG_UNSECURED)
to_chat(user, "<span class='warning'>The [name] needs to be wrenched to the floor!</span>")
if(FG_SECURED)
if(WT.remove_fuel(0,user))
playsound(loc, WT.usesound, 50, 1)
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(do_after(user, 20 * WT.toolspeed, target = src))
if(!src || !WT.isOn())
return
state = FG_WELDED
to_chat(user, "<span class='notice'>You weld the field generator to the floor.</span>")
if(FG_WELDED)
if(WT.remove_fuel(0,user))
playsound(loc, WT.usesound, 50, 1)
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(do_after(user, 20 * WT.toolspeed, target = src))
if(!src || !WT.isOn())
return
state = FG_SECURED
to_chat(user, "<span class='notice'>You cut \the [src] free from the floor.</span>")
else
return ..()
/obj/machinery/field/generator/welder_act(mob/user, obj/item/I)
. = TRUE
if(state == FG_UNSECURED)
to_chat(user, "<span class='warning'>[src] needs to be wrenched to the floor!</span>")
return
if(!I.tool_use_check(user, 0))
return
if(state == FG_SECURED)
WELDER_ATTEMPT_FLOOR_SLICE_MESSAGE
else if(state == FG_WELDED)
WELDER_ATTEMPT_FLOOR_WELD_MESSAGE
if(I.use_tool(src, user, 20, volume = I.tool_volume))
if(state == FG_SECURED)
WELDER_FLOOR_SLICE_SUCCESS_MESSAGE
state = FG_WELDED
else if(state == FG_WELDED)
WELDER_FLOOR_WELD_SUCCESS_MESSAGE
state = FG_SECURED
/obj/machinery/field/generator/emp_act()
return 0
@@ -54,6 +54,10 @@ Strength being set by the computer and a null strength (Computer is powered off
So, hopefully this is helpful if any more icons are to be added/changed/wondering what the hell is going on here
*/
#define ACCELERATOR_UNWRENCHED 0
#define ACCELERATOR_WRENCHED 1
#define ACCELERATOR_WIRED 2
#define ACCELERATOR_READY 3
/obj/structure/particle_accelerator
name = "Particle Accelerator"
@@ -136,12 +140,6 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
desc = desc_holder
. = ..()
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params)
if(istool(W))
if(process_tool_hit(W,user))
return
return..()
/obj/structure/particle_accelerator/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
new /obj/item/stack/sheet/metal (loc, 5)
@@ -196,66 +194,58 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return 1
return 0
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params)
if(!iscoil(W))
return ..()
if(construction_state == ACCELERATOR_WRENCHED)
var/obj/item/stack/cable_coil/C = W
if(C.use(1))
playsound(loc, C.usesound, 50, 1)
user.visible_message("[user.name] adds wires to the [name].", \
"You add some wires.")
construction_state = ACCELERATOR_WIRED
update_icon()
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
if(!(O) || !(user))
return 0
if(!ismob(user) || !isobj(O))
return 0
var/temp_state = construction_state
/obj/structure/particle_accelerator/screwdriver_act(mob/user, obj/item/I)
if(construction_state != ACCELERATOR_WIRED && construction_state != ACCELERATOR_READY)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(construction_state == ACCELERATOR_WIRED)
SCREWDRIVER_CLOSE_PANEL_MESSAGE
construction_state = ACCELERATOR_READY
switch(construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(iswrench(O) && !isinspace())
playsound(loc, O.usesound, 50, 1)
anchored = 1
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
temp_state++
if(1)
if(iswrench(O))
playsound(loc, O.usesound, 50, 1)
anchored = 0
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
temp_state--
else if(iscoil(O))
var/obj/item/stack/cable_coil/C = O
if(C.use(1))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] adds wires to the [name].", \
"You add some wires.")
temp_state++
else
to_chat(user, "<span class='warning'>You need one length of cable to wire the [name]!</span>")
return
if(2)
if(iswirecutter(O))//TODO:Shock user if its on?
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] removes some wires from the [name].", \
"You remove some wires.")
temp_state--
else if(isscrewdriver(O))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] closes the [name]'s access panel.", \
"You close the access panel.")
temp_state++
if(3)
if(isscrewdriver(O))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] opens the [name]'s access panel.", \
"You open the access panel.")
temp_state--
if(temp_state == construction_state)//Nothing changed
return 0
else
construction_state = temp_state
if(construction_state < 3)//Was taken apart, update state
update_state()
update_icon()
return 1
return 0
construction_state = ACCELERATOR_WIRED
SCREWDRIVER_OPEN_PANEL_MESSAGE
update_state()
update_icon()
/obj/structure/particle_accelerator/wirecutter_act(mob/user, obj/item/I)
if(construction_state != ACCELERATOR_WIRED)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
WIRECUTTER_SNIP_MESSAGE
construction_state = ACCELERATOR_WRENCHED
/obj/structure/particle_accelerator/wrench_act(mob/user, obj/item/I)
if(construction_state != ACCELERATOR_UNWRENCHED && construction_state != ACCELERATOR_WRENCHED)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(construction_state == ACCELERATOR_UNWRENCHED)
anchored = TRUE
WRENCH_ANCHOR_MESSAGE
construction_state = ACCELERATOR_WRENCHED
else
anchored = FALSE
WRENCH_UNANCHOR_MESSAGE
construction_state = ACCELERATOR_UNWRENCHED
update_icon()
/obj/machinery/particle_accelerator
@@ -306,72 +296,65 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user, params)
if(istool(W))
if(process_tool_hit(W,user))
return
return ..()
if(!iscoil(W))
return ..()
if(construction_state == ACCELERATOR_WRENCHED)
var/obj/item/stack/cable_coil/C = W
if(C.use(1))
playsound(loc, C.usesound, 50, 1)
user.visible_message("[user.name] adds wires to the [name].", \
"You add some wires.")
construction_state = ACCELERATOR_WIRED
update_icon()
/obj/machinery/particle_accelerator/screwdriver_act(mob/user, obj/item/I)
if(construction_state != ACCELERATOR_WIRED && construction_state != ACCELERATOR_READY)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(construction_state == ACCELERATOR_WIRED)
SCREWDRIVER_CLOSE_PANEL_MESSAGE
construction_state = ACCELERATOR_READY
use_power = IDLE_POWER_USE
else
construction_state = ACCELERATOR_WIRED
SCREWDRIVER_OPEN_PANEL_MESSAGE
use_power = NO_POWER_USE
update_state()
update_icon()
/obj/machinery/particle_accelerator/wirecutter_act(mob/user, obj/item/I)
if(construction_state != ACCELERATOR_WIRED)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
WIRECUTTER_SNIP_MESSAGE
construction_state = ACCELERATOR_WRENCHED
/obj/machinery/particle_accelerator/wrench_act(mob/user, obj/item/I)
if(construction_state != ACCELERATOR_UNWRENCHED && construction_state != ACCELERATOR_WRENCHED)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(construction_state == ACCELERATOR_UNWRENCHED)
anchored = TRUE
WRENCH_ANCHOR_MESSAGE
construction_state = ACCELERATOR_WRENCHED
else
anchored = FALSE
WRENCH_UNANCHOR_MESSAGE
construction_state = ACCELERATOR_UNWRENCHED
update_icon()
/obj/machinery/particle_accelerator/proc/update_state()
return 0
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
if(!(O) || !(user))
return 0
if(!ismob(user) || !isobj(O))
return 0
var/temp_state = construction_state
switch(construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(iswrench(O))
playsound(loc, O.usesound, 50, 1)
anchored = 1
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
temp_state++
power_change()
if(1)
if(iswrench(O))
playsound(loc, O.usesound, 50, 1)
anchored = 0
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
temp_state--
power_change()
else if(iscoil(O))
if(O:use(1))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] adds wires to the [name].", \
"You add some wires.")
temp_state++
if(2)
if(iswirecutter(O))//TODO:Shock user if its on?
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] removes some wires from the [name].", \
"You remove some wires.")
temp_state--
else if(isscrewdriver(O))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] closes the [name]'s access panel.", \
"You close the access panel.")
temp_state++
if(3)
if(isscrewdriver(O))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] opens the [name]'s access panel.", \
"You open the access panel.")
temp_state--
active = 0
if(temp_state == construction_state)//Nothing changed
return 0
else
if(construction_state < 3)//Was taken apart, update state
update_state()
if(use_power)
use_power = NO_POWER_USE
construction_state = temp_state
if(construction_state >= 3)
use_power = IDLE_POWER_USE
update_icon()
return 1
return 0
#undef ACCELERATOR_UNWRENCHED
#undef ACCELERATOR_WRENCHED
#undef ACCELERATOR_WIRED
#undef ACCELERATOR_READY
+1 -1
View File
@@ -224,7 +224,7 @@
return
//crowbarring it !
if(default_deconstruction_crowbar(I))
if(default_deconstruction_crowbar(user, I))
return
return ..()
+8 -10
View File
@@ -55,17 +55,15 @@
update_icon()
/obj/machinery/power/solar/attackby(obj/item/W, mob/user, params)
if(iscrowbar(W))
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user.visible_message("[user] begins to take the glass off the solar panel.", "<span class='notice'>You begin to take the glass off the solar panel...</span>")
if(do_after(user, 50 * W.toolspeed, target = src))
playsound(src.loc, W.usesound, 50, 1)
user.visible_message("[user] takes the glass off the solar panel.", "<span class='notice'>You take the glass off the solar panel.</span>")
deconstruct(TRUE)
/obj/machinery/power/solar/crowbar_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_use_check(user, 0))
return
return ..()
playsound(loc, 'sound/machines/click.ogg', 50, 1)
user.visible_message("[user] begins to take the glass off the solar panel.", "<span class='notice'>You begin to take the glass off the solar panel...</span>")
if(I.use_tool(src, user, 50, volume = I.tool_volume))
user.visible_message("[user] takes the glass off the solar panel.", "<span class='notice'>You take the glass off the solar panel.</span>")
deconstruct(TRUE)
/obj/machinery/power/solar/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
+45 -24
View File
@@ -33,28 +33,48 @@
input_power_multiplier = power_multiplier
/obj/machinery/power/tesla_coil/attackby(obj/item/W, mob/user, params)
if(default_deconstruction_screwdriver(user, "coil_open[anchored]", "coil[anchored]", W))
return
if(exchange_parts(user, W))
return
if(default_unfasten_wrench(user, W))
else if(istype(W, /obj/item/assembly/signaler) && panel_open)
wires.Interact(user)
else
return ..()
/obj/machinery/power/tesla_coil/crowbar_act(mob/user, obj/item/I)
. = TRUE
default_deconstruction_crowbar(user, I)
/obj/machinery/power/tesla_coil/multitool_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(panel_open)
wires.Interact(user)
/obj/machinery/power/tesla_coil/screwdriver_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
default_deconstruction_screwdriver(user, "coil_open[anchored]", "coil[anchored]", I)
/obj/machinery/power/tesla_coil/wirecutter_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(panel_open)
wires.Interact(user)
/obj/machinery/power/tesla_coil/wrench_act(mob/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(default_unfasten_wrench(user, I))
if(!anchored)
disconnect_from_network()
else
connect_to_network()
return
if(default_deconstruction_crowbar(W))
return
else if(iswirecutter(W) || ismultitool(W) || istype(W, /obj/item/assembly/signaler))
if(panel_open)
wires.Interact(user)
else
return ..()
/obj/machinery/power/tesla_coil/tesla_act(var/power)
if(anchored && !panel_open)
@@ -97,22 +117,23 @@
RefreshParts()
/obj/machinery/power/grounding_rod/attackby(obj/item/W, mob/user, params)
if(default_deconstruction_screwdriver(user, "grounding_rod_open[anchored]", "grounding_rod[anchored]", W))
return
if(exchange_parts(user, W))
return
if(default_unfasten_wrench(user, W))
return
/obj/machinery/power/grounding_rod/screwdriver_act(mob/user, obj/item/I)
. = TRUE
default_deconstruction_screwdriver(user, "grounding_rod_open[anchored]", "grounding_rod[anchored]", I)
if(default_deconstruction_crowbar(W))
return
/obj/machinery/power/grounding_rod/wrench_act(mob/user, obj/item/I)
. = TRUE
default_unfasten_wrench(user, I)
return ..()
/obj/machinery/power/grounding_rod/crowbar_act(mob/user, obj/item/I)
. = TRUE
default_deconstruction_crowbar(user, I)
/obj/machinery/power/grounding_rod/tesla_act(var/power)
if(anchored && !panel_open)
flick("grounding_rodhit", src)
else
..()
..()
+9 -9
View File
@@ -59,16 +59,16 @@
if(powernet && (powernet == control.powernet)) //update if we're still in the same powernet
control.cdir = angle
/obj/machinery/power/tracker/attackby(var/obj/item/W, var/mob/user)
if(iscrowbar(W))
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] begins to take the glass off the solar tracker.</span>")
if(do_after(user, 50 * W.toolspeed, target = src))
playsound(src.loc, W.usesound, 50, 1)
user.visible_message("<span class='notice'>[user] takes the glass off the tracker.</span>")
deconstruct(TRUE)
/obj/machinery/power/tracker/crowbar_act(mob/user, obj/item/I)
. = TRUE
if(!I.tool_use_check(user, 0))
return
return ..()
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] begins to take the glass off the solar tracker.</span>")
if(I.use_tool(src, user, 50, volume = I.tool_volume))
user.visible_message("<span class='notice'>[user] takes the glass off the tracker.</span>")
deconstruct(TRUE)
/obj/machinery/power/tracker/obj_break(damage_flag)
if(!(stat & BROKEN) && !(flags & NODECONSTRUCT))
+10 -6
View File
@@ -110,9 +110,6 @@
efficiency = E / 6
/obj/machinery/power/compressor/attackby(obj/item/I, mob/user, params)
if(default_deconstruction_screwdriver(user, initial(icon_state), initial(icon_state), I))
return
if(default_change_direction_wrench(user, I))
turbine = null
inturf = get_step(src, dir)
@@ -128,10 +125,17 @@
if(exchange_parts(user, I))
return
if(default_deconstruction_crowbar(I))
return
return ..()
/obj/machinery/power/compressor/crowbar_act(mob/user, obj/item/I)
if(default_deconstruction_crowbar(user, I))
return TRUE
/obj/machinery/power/compressor/screwdriver_act(mob/user, obj/item/I)
if(default_deconstruction_screwdriver(user, initial(icon_state), initial(icon_state), I))
return TRUE
/obj/machinery/power/compressor/CanAtmosPass(turf/T)
return !density
@@ -285,7 +289,7 @@
if(exchange_parts(user, I))
return
if(default_deconstruction_crowbar(I))
if(default_deconstruction_crowbar(user, I))
return
return ..()