Moves a small few things from attackby() to item_interaction() (#96663)

## About The Pull Request

Ten files. No mechanical changes this time around, so the most notable
thing about this is a change to the way laying pipe cleaners works. I
guess since there's only ten, I can list them. But I'm not going to.

## Why It's Good For The Game

You probably don't regard the way pipe cleaner laying works to be sacred

## Changelog
🆑

code: Ten files have been moved from attackby() to item_interaction()

/🆑
This commit is contained in:
Leland Kemble
2026-07-02 09:59:51 +02:00
committed by GitHub
parent e29746d80c
commit eaeb4b07c4
10 changed files with 363 additions and 335 deletions
@@ -76,36 +76,35 @@
//replace lights & stuff
return do_action(interacting_with, user) ? ITEM_INTERACT_SUCCESS : NONE
/obj/item/lightreplacer/attackby(obj/item/insert, mob/user, list/modifiers, list/attack_modifiers)
. = ..()
/obj/item/lightreplacer/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(uses >= max_uses)
user.balloon_alert(user, "already full!")
return TRUE
return ITEM_INTERACT_BLOCKING
if(istype(insert, /obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/glass/glass_to_insert = insert
if(glass_to_insert.use(LIGHTBULB_COST))
add_uses(GLASS_SHEET_USES)
user.balloon_alert(user, "glass inserted")
else
if(istype(tool, /obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/glass/glass_to_insert = tool
if(!glass_to_insert.use(LIGHTBULB_COST))
user.balloon_alert(user, "need [LIGHTBULB_COST] glass sheets!")
return TRUE
return ITEM_INTERACT_BLOCKING
add_uses(GLASS_SHEET_USES)
user.balloon_alert(user, "glass inserted")
return ITEM_INTERACT_SUCCESS
if(insert.type == /obj/item/shard) //we don't want to insert plasma, titanium or other types of shards
if(!user.temporarilyRemoveItemFromInventory(insert))
if(tool.type == /obj/item/shard) //we don't want to insert plasma, titanium or other types of shards
if(!user.temporarilyRemoveItemFromInventory(tool))
user.balloon_alert(user, "stuck in your hand!")
return TRUE
return ITEM_INTERACT_BLOCKING
if(!add_shard(user)) //add_shard will display a message if it created a bulb from the shard so only display message when that does not happen
user.balloon_alert(user, "shard inserted")
qdel(insert)
return TRUE
qdel(tool)
return ITEM_INTERACT_SUCCESS
if(istype(insert, /obj/item/light))
var/obj/item/light/light_to_insert = insert
if(istype(tool, /obj/item/light))
var/obj/item/light/light_to_insert = tool
//remove from player's hand
if(!user.temporarilyRemoveItemFromInventory(light_to_insert))
user.balloon_alert(user, "stuck in your hand!")
return TRUE
return ITEM_INTERACT_BLOCKING
//insert light. display message only if adding a shard did not create a new bulb else the messages will conflict
var/display_msg = TRUE
@@ -117,14 +116,13 @@
user.balloon_alert(user, "light inserted")
qdel(light_to_insert)
return TRUE
return ITEM_INTERACT_SUCCESS
if(istype(insert, /obj/item/storage))
if(istype(tool, /obj/item/storage))
var/replaced_something = FALSE
var/loaded = FALSE
var/obj/item/storage/storage_to_empty = insert
for(var/obj/item/item_to_check in storage_to_empty.contents)
for(var/obj/item/item_to_check in tool.contents)
//reached max capacity during insertion
if(src.uses >= max_uses)
break
@@ -153,14 +151,13 @@
replaced_something = TRUE
if(!replaced_something)
if(uses == max_uses)
user.balloon_alert(user, "already full!")
else
user.balloon_alert(user, "nothing usable in [storage_to_empty]!")
return TRUE
user.balloon_alert(user, "nothing usable in [tool]!")
return ITEM_INTERACT_BLOCKING
user.balloon_alert(user, "lights inserted")
return TRUE
return ITEM_INTERACT_SUCCESS
return NONE
/obj/item/lightreplacer/emag_act(mob/user, obj/item/card/emag/emag_card)
if(obj_flags & EMAGGED)
+26 -27
View File
@@ -388,37 +388,36 @@ GLOBAL_LIST_EMPTY(station_turfs)
falling_mov.pulledby.stop_pulling()
return TRUE
/turf/proc/handleRCL(obj/item/rcl/C, mob/user)
if(C.loaded)
for(var/obj/structure/pipe_cleaner/LC in src)
if(!LC.d1 || !LC.d2)
LC.handlecable(C, user)
return
C.loaded.place_turf(src, user)
if(C.wiring_gui_menu)
C.wiringGuiUpdate(user)
C.is_empty(user)
/turf/proc/handleRCL(obj/item/rcl/rapid_layer, mob/user)
if(!rapid_layer.loaded)
return
lay_pipe_cleaner(rapid_layer.loaded, user)
if(rapid_layer.wiring_gui_menu)
rapid_layer.wiringGuiUpdate(user)
rapid_layer.is_empty(user)
/turf/attackby(obj/item/C, mob/user, list/modifiers, list/attack_modifiers)
if(..())
return TRUE
if(can_lay_cable() && istype(C, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = C
/turf/proc/lay_pipe_cleaner(obj/item/stack/pipe_cleaner_coil/coil, user)
for(var/obj/structure/pipe_cleaner/lain_cable in src)
if(!lain_cable.d1 || !lain_cable.d2)
lain_cable.item_interaction(user, coil)
return
coil.place_turf(src, user)
/turf/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(can_lay_cable() && istype(tool, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = tool
coil.place_turf(src, user)
return TRUE
else if(can_have_cabling() && istype(C, /obj/item/stack/pipe_cleaner_coil))
var/obj/item/stack/pipe_cleaner_coil/coil = C
for(var/obj/structure/pipe_cleaner/LC in src)
if(!LC.d1 || !LC.d2)
LC.attackby(C, user)
return
coil.place_turf(src, user)
return TRUE
return ITEM_INTERACT_SUCCESS
else if(istype(C, /obj/item/rcl))
handleRCL(C, user)
if(can_have_cabling() && istype(tool, /obj/item/stack/pipe_cleaner_coil))
lay_pipe_cleaner(tool, user)
return ITEM_INTERACT_SUCCESS
return FALSE
if(istype(tool, /obj/item/rcl))
handleRCL(tool, user)
return ITEM_INTERACT_SUCCESS
return NONE
//There's a lot of QDELETED() calls here if someone can figure out how to optimize this but not runtime when something gets deleted by a Bump/CanPass/Cross call, lemme know or go ahead and fix this mess - kevinz000
/turf/Enter(atom/movable/mover)
+27 -23
View File
@@ -98,31 +98,33 @@
return ITEM_INTERACT_SUCCESS
/obj/structure/floodlight_frame/attackby(obj/item/O, mob/user, list/modifiers, list/attack_modifiers)
if(istype(O, /obj/item/stack/cable_coil) && state == FLOODLIGHT_NEEDS_WIRES)
var/obj/item/stack/S = O
if(S.use(5))
icon_state = "floodlight_c2"
state = FLOODLIGHT_NEEDS_SECURING
return
else
/obj/structure/floodlight_frame/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(istype(tool, /obj/item/stack/cable_coil) && state == FLOODLIGHT_NEEDS_WIRES)
var/obj/item/stack/coil = tool
if(!coil.use(5))
balloon_alert(user, "need 5 cable pieces!")
return
return ITEM_INTERACT_BLOCKING
if(istype(O, /obj/item/light/tube))
icon_state = "floodlight_c2"
state = FLOODLIGHT_NEEDS_SECURING
return ITEM_INTERACT_SUCCESS
if(istype(tool, /obj/item/light/tube))
if(state != FLOODLIGHT_NEEDS_LIGHTS)
balloon_alert(user, "construction not completed!")
return
var/obj/item/light/tube/L = O
if(L.status != LIGHT_BROKEN) // light tube not broken.
new /obj/machinery/power/floodlight(loc)
qdel(src)
qdel(O)
return
else //A minute of silence for all the accidentally broken light tubes.
return ITEM_INTERACT_BLOCKING
if(astype(tool, /obj/item/light/tube).status == LIGHT_BROKEN) // light tube broken.
balloon_alert(user, "light tube is broken!")
return
..()
return ITEM_INTERACT_BLOCKING
new /obj/machinery/power/floodlight(loc)
qdel(src)
qdel(tool)
return ITEM_INTERACT_SUCCESS
return NONE
/obj/structure/floodlight_frame/completed
name = "floodlight frame"
@@ -262,7 +264,6 @@
return ..()
/obj/machinery/power/floodlight/wrench_act(mob/living/user, obj/item/tool)
. = ..()
default_unfasten_wrench(user, tool)
change_setting(FLOODLIGHT_OFF)
if(anchored)
@@ -272,11 +273,14 @@
return ITEM_INTERACT_SUCCESS
/obj/machinery/power/floodlight/screwdriver_act(mob/living/user, obj/item/tool)
. = ..()
if(panel_open)
panel_open = FALSE
balloon_alert(user, "closed panel")
return ITEM_INTERACT_SUCCESS
change_setting(FLOODLIGHT_OFF)
panel_open = TRUE
balloon_alert(user, "opened panel")
return TRUE
return ITEM_INTERACT_SUCCESS
/obj/machinery/power/floodlight/attack_hand(mob/user, list/modifiers)
. = ..()
+45 -39
View File
@@ -83,10 +83,10 @@ GLOBAL_LIST_EMPTY(gravity_generators)
main_part = null
return ..()
/obj/machinery/gravity_generator/part/attackby(obj/item/weapon, mob/user, list/modifiers, list/attack_modifiers)
/obj/machinery/gravity_generator/part/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!main_part)
return
return main_part.attackby(weapon, user)
return NONE
return main_part.item_interaction(user, tool)
/obj/machinery/gravity_generator/part/get_status()
if(!main_part)
@@ -235,42 +235,48 @@ GLOBAL_LIST_EMPTY(gravity_generators)
. += span_notice("The new plating just needs to be <b>bolted</b> into place now.")
// Fixing the gravity generator.
/obj/machinery/gravity_generator/main/attackby(obj/item/weapon, mob/user, list/modifiers, list/attack_modifiers)
if(machine_stat & BROKEN)
switch(broken_state)
if(GRAV_NEEDS_SCREWDRIVER)
if(weapon.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, span_notice("You secure the screws of the framework."))
weapon.play_tool_sound(src)
broken_state++
update_appearance()
return
if(GRAV_NEEDS_WELDING)
if(weapon.tool_behaviour == TOOL_WELDER)
if(weapon.use_tool(src, user, 0, volume=50))
to_chat(user, span_notice("You mend the damaged framework."))
broken_state++
update_appearance()
return
if(GRAV_NEEDS_PLASTEEL)
if(istype(weapon, /obj/item/stack/sheet/plasteel))
var/obj/item/stack/sheet/plasteel/PS = weapon
if(PS.get_amount() >= 10)
PS.use(10)
to_chat(user, span_notice("You add the plating to the framework."))
playsound(src.loc, 'sound/machines/click.ogg', 75, TRUE)
broken_state++
update_appearance()
else
to_chat(user, span_warning("You need 10 sheets of plasteel!"))
return
if(GRAV_NEEDS_WRENCH)
if(weapon.tool_behaviour == TOOL_WRENCH)
to_chat(user, span_notice("You secure the plating to the framework."))
weapon.play_tool_sound(src)
set_fix()
return
return ..()
/obj/machinery/gravity_generator/main/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!(machine_stat & BROKEN) || (broken_state != GRAV_NEEDS_PLASTEEL))
return NONE
if(!istype(tool, /obj/item/stack/sheet/plasteel))
return NONE
var/obj/item/stack/sheet/plasteel/metal = tool
if(metal.get_amount() < 10)
to_chat(user, span_warning("You need 10 sheets of plasteel!"))
return ITEM_INTERACT_BLOCKING
metal.use(10)
to_chat(user, span_notice("You add the plating to the framework."))
playsound(src.loc, 'sound/machines/click.ogg', 75, TRUE)
broken_state++
update_appearance()
return ITEM_INTERACT_SUCCESS
/obj/machinery/gravity_generator/main/welder_act(mob/living/user, obj/item/tool)
if(!(machine_stat & BROKEN) || (broken_state != GRAV_NEEDS_WELDING))
return NONE
if(!tool.use_tool(src, user, 0, volume=50))
return ITEM_INTERACT_BLOCKING
to_chat(user, span_notice("You mend the damaged framework."))
broken_state++
update_appearance()
return ITEM_INTERACT_SUCCESS
/obj/machinery/gravity_generator/main/wrench_act(mob/living/user, obj/item/tool)
if(!(machine_stat & BROKEN) || (broken_state != GRAV_NEEDS_WRENCH))
return NONE
to_chat(user, span_notice("You secure the plating to the framework."))
tool.play_tool_sound(src)
set_fix()
return ITEM_INTERACT_SUCCESS
/obj/machinery/gravity_generator/main/screwdriver_act(mob/living/user, obj/item/tool)
if(!(machine_stat & BROKEN) || (broken_state != GRAV_NEEDS_SCREWDRIVER))
return NONE
to_chat(user, span_notice("You secure the screws of the framework."))
tool.play_tool_sound(src)
broken_state++
update_appearance()
return ITEM_INTERACT_SUCCESS
/obj/machinery/gravity_generator/main/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
+19 -15
View File
@@ -381,21 +381,20 @@
// attack with item - insert light (if right type), otherwise try to break the light
/obj/machinery/light/attackby(obj/item/tool, mob/living/user, list/modifiers, list/attack_modifiers)
// insert light (if right type), otherwise try to break the light
/obj/machinery/light/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
// attempt to insert light
if(istype(tool, /obj/item/light))
if(status == LIGHT_OK)
to_chat(user, span_warning("There is a [fitting] already inserted!"))
return
return ITEM_INTERACT_BLOCKING
add_fingerprint(user)
var/obj/item/light/light_object = tool
if(!istype(light_object, light_type))
to_chat(user, span_warning("This type of light requires a [fitting]!"))
return
return ITEM_INTERACT_BLOCKING
if(!user.temporarilyRemoveItemFromInventory(light_object))
return
return ITEM_INTERACT_BLOCKING
add_fingerprint(user)
if(status != LIGHT_EMPTY)
@@ -414,26 +413,31 @@
qdel(light_object)
return
return ITEM_INTERACT_SUCCESS
// attempt to stick weapon into light socket
if(status != LIGHT_EMPTY || user.combat_mode)
return ..()
if(tool.tool_behaviour == TOOL_SCREWDRIVER) //If it's a screwdriver open it.
tool.play_tool_sound(src, 75)
user.visible_message(span_notice("[user.name] opens [src]'s casing."), \
span_notice("You open [src]'s casing."), span_hear("You hear a noise."))
deconstruct(disassembled = TRUE)
return
return NONE
if(tool.item_flags & ABSTRACT)
return
return NONE
to_chat(user, span_userdanger("You stick \the [tool] into the light socket!"))
if(has_power() && (tool.obj_flags & CONDUCTS_ELECTRICITY))
do_sparks(3, TRUE, src)
if (prob(75))
electrocute_mob(user, get_area(src), src, (rand(7,10) * 0.1), TRUE)
return ITEM_INTERACT_SUCCESS
/obj/machinery/light/screwdriver_act(mob/living/user, obj/item/tool)
if(status != LIGHT_EMPTY || user.combat_mode)
return NONE
tool.play_tool_sound(src, 75)
user.visible_message(span_notice("[user.name] opens [src]'s casing."), \
span_notice("You open [src]'s casing."), \
span_hear("You hear unscrewing."))
deconstruct(disassembled = TRUE)
return ITEM_INTERACT_SUCCESS
/obj/machinery/light/on_deconstruction(disassembled)
+80 -68
View File
@@ -80,89 +80,101 @@
cell_reference.forceMove(drop_location())
return cell_reference.attack_tk(user)
/obj/structure/light_construct/attackby(obj/item/tool, mob/user, list/modifiers, list/attack_modifiers)
/obj/structure/light_construct/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
add_fingerprint(user)
if(istype(tool, /obj/item/stock_parts/power_store/cell))
if(!cell_connectors)
to_chat(user, span_warning("This [name] can't support a power cell!"))
return
if(HAS_TRAIT(tool, TRAIT_NODROP))
return ITEM_INTERACT_BLOCKING
if(!user.temporarilyRemoveItemFromInventory(tool))
to_chat(user, span_warning("[tool] is stuck to your hand!"))
return
return ITEM_INTERACT_BLOCKING
if(cell)
to_chat(user, span_warning("There is a power cell already installed!"))
return
if(user.temporarilyRemoveItemFromInventory(tool))
user.visible_message(span_notice("[user] hooks up [tool] to [src]."), \
span_notice("You add [tool] to [src]."))
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
tool.forceMove(src)
cell = tool
add_fingerprint(user)
return
return ITEM_INTERACT_BLOCKING
user.visible_message(span_notice("[user] hooks up [tool] to [src]."), \
span_notice("You add [tool] to [src]."))
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
tool.forceMove(src)
cell = tool
add_fingerprint(user)
return ITEM_INTERACT_SUCCESS
if(istype(tool, /obj/item/light))
to_chat(user, span_warning("This [name] isn't finished being setup!"))
return
return ITEM_INTERACT_BLOCKING
if(stage == LIGHT_CONSTRUCT_EMPTY && istype(tool, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = tool
if(!coil.use(1))
to_chat(user, span_warning("You need one length of cable to wire [src]!"))
return ITEM_INTERACT_BLOCKING
icon_state = "[fixture_type]-construct-stage2"
stage = LIGHT_CONSTRUCT_WIRED
user.visible_message(span_notice("[user.name] adds wires to [src]."), \
span_notice("You add wires to [src]."))
return ITEM_INTERACT_SUCCESS
return NONE
/obj/structure/light_construct/wrench_act(mob/living/user, obj/item/tool)
switch(stage)
if(LIGHT_CONSTRUCT_EMPTY)
if(tool.tool_behaviour == TOOL_WRENCH)
if(cell)
to_chat(user, span_warning("You have to remove the cell first!"))
return
to_chat(user, span_notice("You begin deconstructing [src]..."))
if (tool.use_tool(src, user, 30, volume=50))
user.visible_message(span_notice("[user.name] deconstructs [src]."), \
span_notice("You deconstruct [src]."), span_hear("You hear a ratchet."))
playsound(src, 'sound/items/deconstruct.ogg', 75, TRUE)
deconstruct()
return
if(istype(tool, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = tool
if(coil.use(1))
icon_state = "[fixture_type]-construct-stage2"
stage = LIGHT_CONSTRUCT_WIRED
user.visible_message(span_notice("[user.name] adds wires to [src]."), \
span_notice("You add wires to [src]."))
else
to_chat(user, span_warning("You need one length of cable to wire [src]!"))
return
if(cell)
to_chat(user, span_warning("You have to remove the cell first!"))
return ITEM_INTERACT_BLOCKING
to_chat(user, span_notice("You begin deconstructing [src]..."))
if (!tool.use_tool(src, user, 30, volume=50))
return ITEM_INTERACT_BLOCKING
user.visible_message(span_notice("[user.name] deconstructs [src]."), \
span_notice("You deconstruct [src]."), \
span_hear("You hear a ratchet."))
playsound(src, 'sound/items/deconstruct.ogg', 75, TRUE)
deconstruct()
return ITEM_INTERACT_SUCCESS
if(LIGHT_CONSTRUCT_WIRED)
if(tool.tool_behaviour == TOOL_WRENCH)
to_chat(usr, span_warning("You have to remove the wires first!"))
return
to_chat(usr, span_warning("You have to remove the wires first!"))
return ITEM_INTERACT_BLOCKING
return NONE
if(tool.tool_behaviour == TOOL_WIRECUTTER)
stage = LIGHT_CONSTRUCT_EMPTY
icon_state = "[fixture_type]-construct-stage1"
new /obj/item/stack/cable_coil(drop_location(), 1, "red")
user.visible_message(span_notice("[user.name] removes the wiring from [src]."), \
span_notice("You remove the wiring from [src]."), span_hear("You hear clicking."))
tool.play_tool_sound(src, 100)
return
/obj/structure/light_construct/screwdriver_act(mob/living/user, obj/item/tool)
if(stage != LIGHT_CONSTRUCT_WIRED)
return NONE
user.visible_message(span_notice("[user.name] closes [src]'s casing."), \
span_notice("You close [src]'s casing."), \
span_hear("You hear screwing."))
tool.play_tool_sound(src, 75)
switch(fixture_type)
if("tube")
new_light = new /obj/machinery/light/empty(loc)
if("bulb")
new_light = new /obj/machinery/light/small/empty(loc)
if("floor")
new_light = new /obj/machinery/light/floor/empty(loc)
new_light.setDir(dir)
new_light.find_and_mount_on_atom()
transfer_fingerprints_to(new_light)
if(!QDELETED(cell))
new_light.cell = cell
cell.forceMove(new_light)
cell = null
qdel(src)
return ITEM_INTERACT_SUCCESS
if(tool.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message(span_notice("[user.name] closes [src]'s casing."), \
span_notice("You close [src]'s casing."), span_hear("You hear screwing."))
tool.play_tool_sound(src, 75)
switch(fixture_type)
if("tube")
new_light = new /obj/machinery/light/empty(loc)
if("bulb")
new_light = new /obj/machinery/light/small/empty(loc)
if("floor")
new_light = new /obj/machinery/light/floor/empty(loc)
new_light.setDir(dir)
new_light.find_and_mount_on_atom()
transfer_fingerprints_to(new_light)
if(!QDELETED(cell))
new_light.cell = cell
cell.forceMove(new_light)
cell = null
qdel(src)
return
return ..()
/obj/structure/light_construct/wirecutter_act(mob/living/user, obj/item/tool)
if(stage != LIGHT_CONSTRUCT_WIRED)
return NONE
stage = LIGHT_CONSTRUCT_EMPTY
icon_state = "[fixture_type]-construct-stage1"
new /obj/item/stack/cable_coil(drop_location(), 1, "red")
user.visible_message(span_notice("[user.name] removes the wiring from [src]."), \
span_notice("You remove the wiring from [src]."), \
span_hear("You hear clicking."))
tool.play_tool_sound(src, 100)
return ITEM_INTERACT_SUCCESS
/obj/structure/light_construct/blob_act(obj/structure/blob/attacking_blob)
if(attacking_blob && attacking_blob.loc == loc)
+5 -6
View File
@@ -32,12 +32,11 @@
/obj/item/light/grind_results()
return list(/datum/reagent/silicon = 5, /datum/reagent/nitrogen = 10)
/obj/item/light/attackby(obj/item/attacking_item, mob/user, list/modifiers, list/attack_modifiers)
. = ..()
if(istype(attacking_item, /obj/item/lightreplacer))
var/obj/item/lightreplacer/lightreplacer = attacking_item
lightreplacer.attackby(src, user)
/obj/item/light/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!istype(tool, /obj/item/lightreplacer))
return NONE
tool.item_interaction(user, src)
return ITEM_INTERACT_SUCCESS
/// Returns true if bulb is intact
/obj/item/light/proc/is_intact()
+15 -14
View File
@@ -131,19 +131,16 @@ By design, d1 is the smallest direction and d2 is the highest
// - Wirecutters : cut it duh !
// - pipe cleaner coil : merge pipe cleaners
//
/obj/structure/pipe_cleaner/proc/handlecable(obj/item/W, mob/user, params)
if(W.tool_behaviour == TOOL_WIRECUTTER)
cut_pipe_cleaner(user)
return
else if(istype(W, /obj/item/stack/pipe_cleaner_coil))
var/obj/item/stack/pipe_cleaner_coil/coil = W
if (coil.get_amount() < 1)
to_chat(user, span_warning("Not enough pipe cleaner!"))
return
coil.pipe_cleaner_join(src, user)
/obj/structure/pipe_cleaner/proc/handlecable(obj/item/tool, mob/user, params)
add_fingerprint(user)
if(!istype(tool, /obj/item/stack/pipe_cleaner_coil))
return ITEM_INTERACT_BLOCKING
var/obj/item/stack/pipe_cleaner_coil/coil = tool
if (coil.get_amount() < 1)
to_chat(user, span_warning("Not enough pipe cleaner!"))
return ITEM_INTERACT_BLOCKING
coil.pipe_cleaner_join(src, user)
return ITEM_INTERACT_SUCCESS
/obj/structure/pipe_cleaner/proc/cut_pipe_cleaner(mob/user)
user.visible_message(span_notice("[user] pulls up the pipe cleaner."), span_notice("You pull up the pipe cleaner."))
@@ -151,8 +148,12 @@ By design, d1 is the smallest direction and d2 is the highest
investigate_log("was pulled up by [key_name(usr)] in [AREACOORD(src)]", INVESTIGATE_WIRES)
deconstruct()
/obj/structure/pipe_cleaner/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers)
handlecable(W, user, modifiers)
/obj/structure/pipe_cleaner/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
return handlecable(tool, user, modifiers)
/obj/structure/pipe_cleaner/wirecutter_act(mob/living/user, obj/item/tool)
cut_pipe_cleaner(user)
return ITEM_INTERACT_SUCCESS
/obj/structure/pipe_cleaner/singularity_pull(atom/singularity, current_size)
..()
+37 -32
View File
@@ -175,39 +175,44 @@
else
disconnect_from_network()
/obj/machinery/power/port_gen/pacman/attackby(obj/item/O, mob/user, list/modifiers, list/attack_modifiers)
if(istype(O, sheet_path))
var/obj/item/stack/addstack = O
var/amount = min((max_sheets - sheets), addstack.amount)
if(amount < 1)
to_chat(user, span_notice("\The [src] is full!"))
return
to_chat(user, span_notice("You add [amount] sheets to \the [src]."))
sheets += amount
addstack.use(amount)
return
else if(!active)
if(O.tool_behaviour == TOOL_WRENCH)
if(!anchored && !isinspace())
set_anchored(TRUE)
to_chat(user, span_notice("You secure the generator to the floor."))
else if(anchored)
set_anchored(FALSE)
to_chat(user, span_notice("You unsecure the generator from the floor."))
/obj/machinery/power/port_gen/pacman/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!istype(tool, sheet_path))
return ..()
var/obj/item/stack/addstack = tool
var/amount = min((max_sheets - sheets), addstack.amount)
if(amount < 1)
to_chat(user, span_notice("\The [src] is full!"))
return ITEM_INTERACT_BLOCKING
to_chat(user, span_notice("You add [amount] sheets to \the [src]."))
sheets += amount
addstack.use(amount)
return ITEM_INTERACT_SUCCESS
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
return
else if(O.tool_behaviour == TOOL_SCREWDRIVER)
toggle_panel_open()
O.play_tool_sound(src)
if(panel_open)
to_chat(user, span_notice("You open the access panel."))
else
to_chat(user, span_notice("You close the access panel."))
return
else if(default_deconstruction_crowbar(user, O))
return
return ..()
/obj/machinery/power/port_gen/screwdriver_act(mob/living/user, obj/item/tool)
if(active)
return NONE
toggle_panel_open()
tool.play_tool_sound(src)
to_chat(user, span_notice("You [panel_open ? "open" : "close"] the access panel."))
return ITEM_INTERACT_SUCCESS
/obj/machinery/power/port_gen/wrench_act(mob/living/user, obj/item/tool)
if(active)
return NONE
if(!anchored && !isinspace())
set_anchored(TRUE)
to_chat(user, span_notice("You secure the generator to the floor."))
return ITEM_INTERACT_SUCCESS
set_anchored(FALSE)
to_chat(user, span_notice("You unsecure the generator from the floor."))
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
return ITEM_INTERACT_SUCCESS
/obj/machinery/power/port_gen/crowbar_act(mob/living/user, obj/item/tool)
if(active)
return NONE
return default_deconstruction_crowbar(user, tool)
/obj/machinery/power/port_gen/pacman/emag_act(mob/user, obj/item/card/emag/emag_card)
if(obj_flags & EMAGGED)
+84 -83
View File
@@ -289,63 +289,34 @@
return
randomise_offset(anchored ? 0 : random_offset)
/obj/item/solar_assembly/attackby(obj/item/item_used, mob/user, list/modifiers, list/attack_modifiers)
/obj/item/solar_assembly/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
var/turf/solarturf = get_turf(src)
if(item_used.tool_behaviour == TOOL_WRENCH && isturf(loc))
if(!solarturf.can_have_cabling()) //allows catwalks
balloon_alert(user, "can't secure in space!")
return
for(var/obj/stuff_in_the_way in solarturf) //prevent anchoring on other machinery or solar assemblies
if(stuff_in_the_way == src)
continue
if(istype(stuff_in_the_way, /obj/item/solar_assembly) && stuff_in_the_way.anchored)
balloon_alert(user, "secured assembly in the way!")
return
if((stuff_in_the_way.density) && !(stuff_in_the_way.flags_1 & ON_BORDER_1))
balloon_alert(user, "something in the way!")
return
set_anchored(!anchored)
user.visible_message(
span_notice("[user] [anchored ? null : "un"]wrenches the solar assembly[anchored ? " into place" : null]."),
span_notice("You [anchored ? null : "un"]wrench the solar assembly[anchored ? " into place" : null]."),
)
item_used.play_tool_sound(src, 75)
return TRUE
if(tracker)
if(item_used.tool_behaviour == TOOL_CROWBAR)
new /obj/item/electronics/tracker(src.loc)
tracker = FALSE
update_appearance()
user.visible_message(span_notice("[user] takes out the electronics from the solar assembly."), span_notice("You take out the electronics from the solar assembly."))
return TRUE
//prevent construction if something dense's on our tile
if(solarturf.is_blocked_turf(exclude_mobs = TRUE, source_atom = src))
balloon_alert(user, "something in the way!")
return
if(!istype(item_used, /obj/item/stack/sheet/glass))
return ITEM_INTERACT_BLOCKING
if(!istype(tool, /obj/item/stack/sheet/glass))
to_chat(user, span_warning("The tracker only accepts standard, un-reinforced glass."))
return
var/obj/item/stack/sheet/my_sheet = item_used
return ITEM_INTERACT_BLOCKING
var/obj/item/stack/sheet/my_sheet = tool
if(!my_sheet.use(2))
to_chat(user, span_warning("You don't have enough glass to complete the tracker."))
return
return ITEM_INTERACT_BLOCKING
playsound(src.loc, 'sound/machines/click.ogg', 50, TRUE)
user.visible_message(span_notice("[user] places the glass on the solar assembly."),span_notice("You place the glass on the solar assembly."))
new /obj/machinery/power/tracker/(get_turf(src), src)
return TRUE
return ITEM_INTERACT_SUCCESS
if(!tracker)
if(istype(item_used, /obj/item/electronics/tracker))
if(!user.temporarilyRemoveItemFromInventory(item_used))
return
tracker = TRUE
update_appearance()
qdel(item_used)
user.visible_message(span_notice("[user] inserts the electronics into the solar assembly."), span_notice("You insert the electronics into the solar assembly."))
return TRUE
if(istype(tool, /obj/item/electronics/tracker))
if(!user.temporarilyRemoveItemFromInventory(tool))
return ITEM_INTERACT_BLOCKING
tracker = TRUE
update_appearance()
qdel(tool)
user.visible_message(span_notice("[user] inserts the electronics into the solar assembly."), span_notice("You insert the electronics into the solar assembly."))
return ITEM_INTERACT_SUCCESS
//make a list of all the glass
var/static/list/acceptable_glass_list = typecacheof(list(
@@ -355,23 +326,23 @@
/obj/item/stack/sheet/plastitaniumglass,
))
if(!acceptable_glass_list[item_used.type])
if(!acceptable_glass_list[tool.type])
//items that arent used above, or arent usable glass will make it here.
//so we check if its reinfocred glass, or some other item
if(istype(item_used, /obj/item/stack/sheet/rglass) || istype(item_used, /obj/item/stack/sheet/plasmarglass))
if(istype(tool, /obj/item/stack/sheet/rglass) || istype(tool, /obj/item/stack/sheet/plasmarglass))
to_chat(user, span_warning("The solar array will only accept glass or glass alloys that have not been reinforced."))
//an else statement can be put here if you want something to happen to all the misc items that make it this far
return
return ITEM_INTERACT_BLOCKING
//prevent construction if something dense's on our tile
if(solarturf.is_blocked_turf(exclude_mobs = TRUE, source_atom = src))
balloon_alert(user, "something in the way!")
return
return ITEM_INTERACT_BLOCKING
if(is_glass_sheet(item_used))
if(is_glass_sheet(tool))
if(!anchored)
to_chat(user, span_warning("You need to secure the assembly before you can add glass."))
return
return ITEM_INTERACT_BLOCKING
var/list/glass_material_to_tier = list(
/datum/material/glass = 1,
@@ -380,10 +351,10 @@
/datum/material/alloy/plastitaniumglass = 4,
)
var/obj/item/stack/sheet/my_sheet = item_used
var/obj/item/stack/sheet/my_sheet = tool
if(!my_sheet.use(2))
to_chat(user, span_warning("You need at least two sheets of glass to complete a solar panel!"))
return
return ITEM_INTERACT_BLOCKING
var/datum/material/glass_material = my_sheet.material_type
playsound(src.loc, 'sound/machines/click.ogg', 50, TRUE)
@@ -393,8 +364,43 @@
mySolar.material_type = glass_material
mySolar.panel.icon_state = "solar_panel_[glass_material.name]"
mySolar.panel_edge.icon_state = "solar_panel_[glass_material.name]_edge"
return TRUE
return ..()
return ITEM_INTERACT_SUCCESS
return NONE
/obj/item/solar_assembly/wrench_act(mob/living/user, obj/item/tool)
var/turf/solarturf = get_turf(src)
if(!isturf(loc))
return NONE
if(!solarturf.can_have_cabling()) //allows catwalks
balloon_alert(user, "can't secure in space!")
return ITEM_INTERACT_BLOCKING
for(var/obj/stuff_in_the_way in solarturf) //prevent anchoring on other machinery or solar assemblies
if(stuff_in_the_way == src)
continue
if(istype(stuff_in_the_way, /obj/item/solar_assembly) && stuff_in_the_way.anchored)
balloon_alert(user, "secured assembly in the way!")
return ITEM_INTERACT_BLOCKING
if((stuff_in_the_way.density) && !(stuff_in_the_way.flags_1 & ON_BORDER_1))
balloon_alert(user, "something in the way!")
return ITEM_INTERACT_BLOCKING
set_anchored(!anchored)
user.visible_message(
span_notice("[user] [anchored ? null : "un"]wrenches the solar assembly[anchored ? " into place" : null]."),
span_notice("You [anchored ? null : "un"]wrench the solar assembly[anchored ? " into place" : null]."),
)
tool.play_tool_sound(src, 75)
return ITEM_INTERACT_SUCCESS
/obj/item/solar_assembly/crowbar_act(mob/living/user, obj/item/tool)
if(!tracker)
return NONE
new /obj/item/electronics/tracker(src.loc)
tracker = FALSE
update_appearance()
user.visible_message(span_notice("[user] takes out the electronics from the solar assembly."), \
span_notice("You take out the electronics from the solar assembly."))
return ITEM_INTERACT_SUCCESS
//
// Solar Control Computer
@@ -558,36 +564,31 @@
return TRUE
return FALSE
/obj/machinery/power/solar_control/attackby(obj/item/I, mob/living/user, list/modifiers, list/attack_modifiers)
if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(I.use_tool(src, user, 20, volume=50))
if (src.machine_stat & BROKEN)
to_chat(user, span_notice("The broken glass falls out."))
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer( src.loc )
new /obj/item/shard( src.loc )
var/obj/item/circuitboard/computer/solar_control/M = new /obj/item/circuitboard/computer/solar_control( A )
for (var/obj/C in src)
C.forceMove(drop_location())
A.circuit = M
A.state = 3
A.icon_state = "3"
A.set_anchored(TRUE)
qdel(src)
else
to_chat(user, span_notice("You disconnect the monitor."))
var/obj/structure/frame/computer/A = new /obj/structure/frame/computer( src.loc )
var/obj/item/circuitboard/computer/solar_control/M = new /obj/item/circuitboard/computer/solar_control( A )
for (var/obj/C in src)
C.forceMove(drop_location())
A.circuit = M
A.state = 4
A.icon_state = "4"
A.set_anchored(TRUE)
qdel(src)
else if(!user.combat_mode && !(I.item_flags & NOBLUDGEON))
attack_hand(user)
else
/obj/machinery/power/solar_control/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(user.combat_mode || (tool.item_flags & NOBLUDGEON))
return ..()
attack_hand(user)
return ITEM_INTERACT_SUCCESS
/obj/machinery/power/solar_control/screwdriver_act(mob/living/user, obj/item/tool)
if(tool.use_tool(src, user, 20, volume=50))
return ITEM_INTERACT_BLOCKING
var/obj/structure/frame/computer/new_computer = new /obj/structure/frame/computer(src.loc)
if (src.machine_stat & BROKEN)
to_chat(user, span_notice("The broken glass falls out."))
new /obj/item/shard( src.loc )
new_computer.state = 3
new_computer.icon_state = "3"
else
to_chat(user, span_notice("You disconnect the monitor."))
new_computer.state = 4
new_computer.icon_state = "4"
for (var/obj/within in src)
within.forceMove(drop_location())
new_computer.circuit = new /obj/item/circuitboard/computer/solar_control(new_computer)
new_computer.set_anchored(TRUE)
qdel(src)
return ITEM_INTERACT_SUCCESS
/obj/machinery/power/solar_control/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)