[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
@@ -38,26 +38,26 @@
|
||||
aggressiveness = 1 //Borgs are nicecurity!
|
||||
actions_types = list(/datum/action/item_action/halt)
|
||||
|
||||
/obj/item/clothing/mask/gas/sechailer/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
switch(aggressiveness)
|
||||
if(1)
|
||||
to_chat(user, "<span class='notice'>You set the restrictor to the middle position.</span>")
|
||||
aggressiveness = 2
|
||||
if(2)
|
||||
to_chat(user, "<span class='notice'>You set the restrictor to the last position.</span>")
|
||||
aggressiveness = 3
|
||||
if(3)
|
||||
to_chat(user, "<span class='notice'>You set the restrictor to the first position.</span>")
|
||||
aggressiveness = 1
|
||||
if(4)
|
||||
to_chat(user, "<span class='danger'>You adjust the restrictor but nothing happens, probably because it's broken.</span>")
|
||||
else if(istype(W, /obj/item/wirecutters))
|
||||
if(aggressiveness != 4)
|
||||
to_chat(user, "<span class='danger'>You broke the restrictor!</span>")
|
||||
aggressiveness = 4
|
||||
else
|
||||
..()
|
||||
/obj/item/clothing/mask/gas/sechailer/screwdriver_act(mob/living/user, obj/item/I)
|
||||
switch(aggressiveness)
|
||||
if(1)
|
||||
to_chat(user, "<span class='notice'>You set the restrictor to the middle position.</span>")
|
||||
aggressiveness = 2
|
||||
if(2)
|
||||
to_chat(user, "<span class='notice'>You set the restrictor to the last position.</span>")
|
||||
aggressiveness = 3
|
||||
if(3)
|
||||
to_chat(user, "<span class='notice'>You set the restrictor to the first position.</span>")
|
||||
aggressiveness = 1
|
||||
if(4)
|
||||
to_chat(user, "<span class='danger'>You adjust the restrictor but nothing happens, probably because it's broken.</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/item/clothing/mask/gas/sechailer/wirecutter_act(mob/living/user, obj/item/I)
|
||||
if(aggressiveness != 4)
|
||||
to_chat(user, "<span class='danger'>You broke the restrictor!</span>")
|
||||
aggressiveness = 4
|
||||
return TRUE
|
||||
|
||||
/obj/item/clothing/mask/gas/sechailer/ui_action_click(mob/user, action)
|
||||
if(istype(action, /datum/action/item_action/halt))
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
return FAILED_UNFASTEN
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/rad_collector/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20)
|
||||
/obj/machinery/power/rad_collector/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
||||
. = ..()
|
||||
if(. == SUCCESSFUL_UNFASTEN)
|
||||
if(anchored)
|
||||
@@ -128,11 +128,11 @@
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/rad_collector/wrench_act(mob/living/user, obj/item/wrench)
|
||||
default_unfasten_wrench(user, wrench, 0)
|
||||
/obj/machinery/power/rad_collector/wrench_act(mob/living/user, obj/item/I)
|
||||
default_unfasten_wrench(user, I, 0)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/rad_collector/crowbar_act(mob/living/user, obj/item/crowbar)
|
||||
/obj/machinery/power/rad_collector/crowbar_act(mob/living/user, obj/item/I)
|
||||
if(loaded_tank)
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>The controls are locked!</span>")
|
||||
@@ -142,7 +142,7 @@
|
||||
to_chat(user, "<span class='warning'>There isn't a tank loaded!</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/rad_collector/multitool_act(mob/living/user, obj/item/multitool)
|
||||
/obj/machinery/power/rad_collector/multitool_act(mob/living/user, obj/item/I)
|
||||
if(!is_station_level(z) && !SSresearch.science_tech)
|
||||
to_chat(user, "<span class='warning'>[src] isn't linked to a research system!</span>")
|
||||
return TRUE
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/emitter/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20)
|
||||
/obj/machinery/power/emitter/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
||||
. = ..()
|
||||
if(. == SUCCESSFUL_UNFASTEN)
|
||||
if(anchored)
|
||||
|
||||
@@ -89,7 +89,7 @@ field_generator power level display
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/machinery/field/generator/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20)
|
||||
/obj/machinery/field/generator/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
||||
. = ..()
|
||||
if(. == SUCCESSFUL_UNFASTEN)
|
||||
if(anchored)
|
||||
|
||||
@@ -74,9 +74,6 @@
|
||||
to_chat(user, "<span class='notice'>You cut the cables and dismantle the power terminal.</span>")
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/machinery/power/terminal/attackby(obj/item/W, mob/living/user, params)
|
||||
if(istype(W, /obj/item/wirecutters))
|
||||
dismantle(user, W)
|
||||
else
|
||||
return ..()
|
||||
/obj/machinery/power/terminal/wirecutter_act(mob/living/user, obj/item/I)
|
||||
dismantle(user, I)
|
||||
return TRUE
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
zap_cooldown -= (C.rating * 20)
|
||||
input_power_multiplier = power_multiplier
|
||||
|
||||
/obj/machinery/power/tesla_coil/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20)
|
||||
/obj/machinery/power/tesla_coil/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
||||
. = ..()
|
||||
if(. == SUCCESSFUL_UNFASTEN)
|
||||
if(panel_open)
|
||||
@@ -103,7 +103,7 @@
|
||||
buckle_lying = FALSE
|
||||
buckle_requires_restraints = TRUE
|
||||
|
||||
/obj/machinery/power/grounding_rod/default_unfasten_wrench(mob/user, obj/item/wrench/W, time = 20)
|
||||
/obj/machinery/power/grounding_rod/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
|
||||
. = ..()
|
||||
if(. == SUCCESSFUL_UNFASTEN)
|
||||
if(panel_open)
|
||||
|
||||
@@ -106,73 +106,68 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
// attackby item
|
||||
// construction/deconstruction
|
||||
// wrench: (un)anchor
|
||||
// weldingtool: convert to real pipe
|
||||
/obj/structure/disposalconstruct/wrench_act(mob/living/user, obj/item/I)
|
||||
if(anchored)
|
||||
anchored = FALSE
|
||||
density = FALSE
|
||||
to_chat(user, "<span class='notice'>You detach the [pipename] from the underfloor.</span>")
|
||||
else
|
||||
var/ispipe = is_pipe() // Indicates if we should change the level of this pipe
|
||||
|
||||
/obj/structure/disposalconstruct/attackby(obj/item/I, mob/user, params)
|
||||
var/ispipe = is_pipe() // Indicates if we should change the level of this pipe
|
||||
var/turf/T = get_turf(src)
|
||||
if(T.intact && isfloorturf(T))
|
||||
to_chat(user, "<span class='warning'>You can only attach the [pipename] if the floor plating is removed!</span>")
|
||||
return TRUE
|
||||
|
||||
add_fingerprint(user)
|
||||
if(!ispipe && iswallturf(T))
|
||||
to_chat(user, "<span class='warning'>You can't build [pipename]s on walls, only disposal pipes!</span>")
|
||||
return TRUE
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(T.intact && isfloorturf(T))
|
||||
to_chat(user, "<span class='warning'>You can only attach the [pipename] if the floor plating is removed!</span>")
|
||||
return
|
||||
if(ispipe)
|
||||
var/dpdir = get_disposal_dir()
|
||||
for(var/obj/structure/disposalpipe/CP in T)
|
||||
var/pdir = CP.dpdir
|
||||
if(istype(CP, /obj/structure/disposalpipe/broken))
|
||||
pdir = CP.dir
|
||||
if(pdir & dpdir)
|
||||
to_chat(user, "<span class='warning'>There is already a disposal pipe at that location!</span>")
|
||||
return TRUE
|
||||
|
||||
if(!ispipe && iswallturf(T))
|
||||
to_chat(user, "<span class='warning'>You can't build [pipename]s on walls, only disposal pipes!</span>")
|
||||
return
|
||||
else // Disposal or outlet
|
||||
var/found_trunk = FALSE
|
||||
for(var/obj/structure/disposalpipe/CP in T)
|
||||
if(istype(CP, /obj/structure/disposalpipe/trunk))
|
||||
found_trunk = TRUE
|
||||
break
|
||||
|
||||
if(istype(I, /obj/item/wrench))
|
||||
if(anchored)
|
||||
anchored = FALSE
|
||||
density = FALSE
|
||||
to_chat(user, "<span class='notice'>You detach the [pipename] from the underfloor.</span>")
|
||||
else
|
||||
if(ispipe)
|
||||
var/dpdir = get_disposal_dir()
|
||||
for(var/obj/structure/disposalpipe/CP in T)
|
||||
var/pdir = CP.dpdir
|
||||
if(istype(CP, /obj/structure/disposalpipe/broken))
|
||||
pdir = CP.dir
|
||||
if(pdir & dpdir)
|
||||
to_chat(user, "<span class='warning'>There is already a disposal pipe at that location!</span>")
|
||||
return
|
||||
level = 1 // Pipes only, don't want disposal bins to disappear under the floors
|
||||
if(!found_trunk)
|
||||
to_chat(user, "<span class='warning'>The [pipename] requires a trunk underneath it in order to work!</span>")
|
||||
return TRUE
|
||||
|
||||
else // Disposal or outlet
|
||||
var/found_trunk = FALSE
|
||||
for(var/obj/structure/disposalpipe/CP in T)
|
||||
if(istype(CP, /obj/structure/disposalpipe/trunk))
|
||||
found_trunk = TRUE
|
||||
break
|
||||
anchored = TRUE
|
||||
density = initial(pipe_type.density)
|
||||
to_chat(user, "<span class='notice'>You attach the [pipename] to the underfloor.</span>")
|
||||
I.play_tool_sound(src, 100)
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
if(!found_trunk)
|
||||
to_chat(user, "<span class='warning'>The [pipename] requires a trunk underneath it in order to work!</span>")
|
||||
return
|
||||
/obj/structure/disposalconstruct/welder_act(mob/living/user, obj/item/I)
|
||||
if(anchored)
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return TRUE
|
||||
|
||||
anchored = TRUE
|
||||
density = initial(pipe_type.density)
|
||||
to_chat(user, "<span class='notice'>You attach the [pipename] to the underfloor.</span>")
|
||||
I.play_tool_sound(src, 100)
|
||||
update_icon()
|
||||
to_chat(user, "<span class='notice'>You start welding the [pipename] in place...</span>")
|
||||
if(I.use_tool(src, user, 8, volume=50))
|
||||
to_chat(user, "<span class='notice'>The [pipename] has been welded in place.</span>")
|
||||
var/obj/O = new pipe_type(loc, src)
|
||||
transfer_fingerprints_to(O)
|
||||
|
||||
else if(istype(I, /obj/item/weldingtool))
|
||||
if(anchored)
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You start welding the [pipename] in place...</span>")
|
||||
if(I.use_tool(src, user, 8, volume=50))
|
||||
to_chat(user, "<span class='notice'>The [pipename] has been welded in place.</span>")
|
||||
var/obj/O = new pipe_type(loc, src)
|
||||
transfer_fingerprints_to(O)
|
||||
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to attach it to the plating first!</span>")
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to attach it to the plating first!</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/structure/disposalconstruct/proc/is_pipe()
|
||||
return ispath(pipe_type, /obj/structure/disposalpipe)
|
||||
|
||||
@@ -30,37 +30,37 @@
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
|
||||
/obj/machinery/bsa/wrench_act(mob/living/user, obj/item/I)
|
||||
default_unfasten_wrench(user, I, 10)
|
||||
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/device/multitool))
|
||||
var/obj/item/device/multitool/M = W
|
||||
/obj/machinery/bsa/back/multitool_act(mob/living/user, obj/item/I)
|
||||
if(istype(I, /obj/item/device/multitool)) // Only this multitool type has a data buffer.
|
||||
var/obj/item/device/multitool/M = I
|
||||
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
|
||||
to_chat(user, "<span class='notice'>You store linkage information in [I]'s buffer.</span>")
|
||||
else
|
||||
return ..()
|
||||
to_chat(user, "<span class='warning'>[I] has no data buffer!</span>")
|
||||
return TRUE
|
||||
|
||||
/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/device/multitool))
|
||||
var/obj/item/device/multitool/M = W
|
||||
/obj/machinery/bsa/front/multitool_act(mob/living/user, obj/item/I)
|
||||
if(istype(I, /obj/item/device/multitool)) // Only this multitool type has a data buffer.
|
||||
var/obj/item/device/multitool/M = I
|
||||
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
|
||||
to_chat(user, "<span class='notice'>You store linkage information in [I]'s buffer.</span>")
|
||||
else
|
||||
return ..()
|
||||
to_chat(user, "<span class='warning'>[I] has no data buffer!</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/bsa/middle
|
||||
name = "Bluespace Artillery Fusor"
|
||||
@@ -69,9 +69,9 @@
|
||||
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/device/multitool))
|
||||
var/obj/item/device/multitool/M = W
|
||||
/obj/machinery/bsa/middle/multitool_act(mob/living/user, obj/item/I)
|
||||
if(istype(I, /obj/item/device/multitool)) // Only this multitool type has a data buffer.
|
||||
var/obj/item/device/multitool/M = I
|
||||
if(M.buffer)
|
||||
if(istype(M.buffer, /obj/machinery/bsa/back))
|
||||
back = M.buffer
|
||||
@@ -81,11 +81,11 @@
|
||||
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
|
||||
to_chat(user, "<span class='warning'>[I]'s data buffer is empty!</span>")
|
||||
else
|
||||
return ..()
|
||||
to_chat(user, "<span class='warning'>[I] has no data buffer!</span>")
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/bsa/middle/proc/check_completion()
|
||||
if(!front || !back)
|
||||
@@ -136,6 +136,9 @@
|
||||
bound_x = -192
|
||||
appearance_flags = NONE //Removes default TILE_BOUND
|
||||
|
||||
/obj/machinery/bsa/full/wrench_act(mob/living/user, obj/item/I)
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/bsa/full/proc/get_front_turf()
|
||||
switch(dir)
|
||||
if(WEST)
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0), TEXT_SOUTH = list(-2), TEXT_EAST = list(0), TEXT_WEST = list( 2)))
|
||||
|
||||
|
||||
/obj/vehicle/ridden/scooter/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/wrench))
|
||||
to_chat(user, "<span class='notice'>You begin to remove the handlebars...</span>")
|
||||
if(I.use_tool(src, user, 40, volume=50))
|
||||
var/obj/vehicle/ridden/scooter/skateboard/S = new(drop_location())
|
||||
new /obj/item/stack/rods(drop_location(), 2)
|
||||
to_chat(user, "<span class='notice'>You remove the handlebars from [src].</span>")
|
||||
if(has_buckled_mobs())
|
||||
var/mob/living/carbon/H = buckled_mobs[1]
|
||||
unbuckle_mob(H)
|
||||
S.buckle_mob(H)
|
||||
qdel(src)
|
||||
/obj/vehicle/ridden/scooter/wrench_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='notice'>You begin to remove the handlebars...</span>")
|
||||
if(I.use_tool(src, user, 40, volume=50))
|
||||
var/obj/vehicle/ridden/scooter/skateboard/S = new(drop_location())
|
||||
new /obj/item/stack/rods(drop_location(), 2)
|
||||
to_chat(user, "<span class='notice'>You remove the handlebars from [src].</span>")
|
||||
if(has_buckled_mobs())
|
||||
var/mob/living/carbon/H = buckled_mobs[1]
|
||||
unbuckle_mob(H)
|
||||
S.buckle_mob(H)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/ridden/scooter/Moved()
|
||||
. = ..()
|
||||
@@ -100,14 +100,7 @@
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
|
||||
/obj/item/scooter_frame/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/wrench))
|
||||
to_chat(user, "<span class='notice'>You deconstruct [src].</span>")
|
||||
new /obj/item/stack/rods(drop_location(), 10)
|
||||
I.play_tool_sound(src)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
else if(istype(I, /obj/item/stack/sheet/metal))
|
||||
if(istype(I, /obj/item/stack/sheet/metal))
|
||||
if(!I.tool_start_check(user, amount=5))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You begin to add wheels to [src].</span>")
|
||||
@@ -115,20 +108,18 @@
|
||||
to_chat(user, "<span class='notice'>You finish making wheels for [src].</span>")
|
||||
new /obj/vehicle/ridden/scooter/skateboard(user.loc)
|
||||
qdel(src)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/scooter_frame/wrench_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='notice'>You deconstruct [src].</span>")
|
||||
new /obj/item/stack/rods(drop_location(), 10)
|
||||
I.play_tool_sound(src)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/vehicle/ridden/scooter/skateboard/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
to_chat(user, "<span class='notice'>You begin to deconstruct and remove the wheels on [src]...</span>")
|
||||
if(I.use_tool(src, user, 20, volume=50))
|
||||
to_chat(user, "<span class='notice'>You deconstruct the wheels on [src].</span>")
|
||||
new /obj/item/stack/sheet/metal(drop_location(), 5)
|
||||
new /obj/item/scooter_frame(drop_location())
|
||||
if(has_buckled_mobs())
|
||||
var/mob/living/carbon/H = buckled_mobs[1]
|
||||
unbuckle_mob(H)
|
||||
qdel(src)
|
||||
|
||||
else if(istype(I, /obj/item/stack/rods))
|
||||
if(istype(I, /obj/item/stack/rods))
|
||||
if(!I.tool_start_check(user, amount=2))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You begin making handlebars for [src].</span>")
|
||||
@@ -140,3 +131,18 @@
|
||||
unbuckle_mob(H)
|
||||
S.buckle_mob(H)
|
||||
qdel(src)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/vehicle/ridden/scooter/skateboard/screwdriver_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='notice'>You begin to deconstruct and remove the wheels on [src]...</span>")
|
||||
if(I.use_tool(src, user, 20, volume=50))
|
||||
to_chat(user, "<span class='notice'>You deconstruct the wheels on [src].</span>")
|
||||
new /obj/item/stack/sheet/metal(drop_location(), 5)
|
||||
new /obj/item/scooter_frame(drop_location())
|
||||
if(has_buckled_mobs())
|
||||
var/mob/living/carbon/H = buckled_mobs[1]
|
||||
unbuckle_mob(H)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user