Merge pull request #265 from ReoDaProtovali/Conveyor-Fixes

Conveyor fixes and yuuuuuge tool refactor
This commit is contained in:
evilew
2024-09-11 16:37:29 +02:00
committed by GitHub
187 changed files with 627 additions and 612 deletions
@@ -636,7 +636,7 @@ Congratulations! You are now trained for invasive xenobiology research!"}
AddComponent(/datum/component/wearertargeting/earprotection, list(SLOT_EARS))
/obj/item/radio/headset/abductor/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
return // Stops humans from disassembling abductor headsets.
return ..()
@@ -703,7 +703,7 @@ Congratulations! You are now trained for invasive xenobiology research!"}
framestackamount = 1
/obj/structure/table_frame/abductor/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench))
if(I.tool_behaviour == TOOL_WRENCH)
to_chat(user, "<span class='notice'>You start disassembling [src]...</span>")
I.play_tool_sound(src)
if(I.use_tool(src, user, 30))
@@ -49,7 +49,7 @@
// This exists so Hardened/Silver Stake can't have a welding torch used on them.
/obj/item/stake/basic/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weldingtool))
if(W.tool_behaviour == TOOL_WELDER)
//if (amWelded)
// to_chat(user, "<span class='warning'>This stake has already been treated with fire.</span>")
// return
@@ -146,7 +146,7 @@
// Convert back to Silver
/obj/item/stake/hardened/silver/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weldingtool))
if(I.tool_behaviour == TOOL_WELDER)
var/obj/item/weldingtool/WT = I
if(WT.use(0))//remove_fuel(0, user))
var/obj/item/stack/sheet/mineral/silver/newsheet = new (user.loc)
@@ -169,11 +169,11 @@
if(istype(W, cutting_tool))
to_chat(user, "<span class='notice'>This is a much more complex mechanical structure than you thought. You don't know where to begin cutting [src].</span>")
return
else if(anchored && istype(W, /obj/item/wrench)) // Can't unanchor unless owner.
else if(anchored && W.tool_behaviour == TOOL_WRENCH) // Can't unanchor unless owner.
to_chat(user, "<span class='danger'>The coffin won't come unanchored from the floor.</span>")
return
if(locked && istype(W, /obj/item/crowbar))
if(locked && W.tool_behaviour == TOOL_CROWBAR)
var/pry_time = pryLidTimer * W.toolspeed // Pry speed must be affected by the speed of the tool.
user.visible_message("<span class='notice'>[user] tries to pry the lid off of [src] with [W].</span>", \
"<span class='notice'>You begin prying the lid off of [src] with [W]. This should take about [DisplayTimeText(pry_time)].</span>")
@@ -353,7 +353,7 @@
torture_time -= 1
else if(I.sharpness == IS_SHARP_ACCURATE)
torture_time -= 2
if(istype(I, /obj/item/weldingtool))
if(I.tool_behaviour == TOOL_WELDER)
var/obj/item/weldingtool/welder = I
welder.welding = TRUE
torture_time -= 5
@@ -95,7 +95,7 @@
return ..()
/obj/structure/destructible/clockwork/attackby(obj/item/I, mob/user, params)
if(is_servant_of_ratvar(user) && istype(I, /obj/item/wrench) && unanchored_icon)
if(is_servant_of_ratvar(user) && I.tool_behaviour == TOOL_WRENCH && unanchored_icon)
if(default_unfasten_wrench(user, I, 50) == SUCCESSFUL_UNFASTEN)
update_anchored(user)
return 1
@@ -24,10 +24,10 @@
return
/obj/structure/destructible/clockwork/wall_gear/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wrench))
if(I.tool_behaviour == TOOL_WRENCH)
default_unfasten_wrench(user, I, 10)
return 1
else if(istype(I, /obj/item/screwdriver))
else if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(anchored)
to_chat(user, "<span class='warning'>[src] needs to be unsecured to disassemble it!</span>")
else
@@ -114,7 +114,7 @@
return
if(NUKESTATE_PANEL_REMOVED)
if(istype(I, /obj/item/weldingtool))
if(I.tool_behaviour == TOOL_WELDER)
if(!I.tool_start_check(user, amount=1))
return
to_chat(user, "<span class='notice'>You start cutting [src]'s inner plate...</span>")
+1 -1
View File
@@ -43,7 +43,7 @@
to_chat(user, "<span class='notice'>Picking up the swarmer may cause it to activate. You should be careful about this.</span>")
/obj/effect/mob_spawn/swarmer/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver) && user.a_intent != INTENT_HARM)
if(W.tool_behaviour == TOOL_SCREWDRIVER && user.a_intent != INTENT_HARM)
user.visible_message("<span class='warning'>[usr.name] deactivates [src].</span>",
"<span class='notice'>After some fiddling, you find a way to disable [src]'s power source.</span>",
"<span class='italics'>You hear clicking.</span>")
@@ -744,14 +744,14 @@
/obj/machinery/airalarm/attackby(obj/item/W, mob/user, params)
switch(buildstage)
if(2)
if(istype(W, /obj/item/wirecutters) && panel_open && wires.is_all_cut())
if(W.tool_behaviour == TOOL_WIRECUTTER && panel_open && wires.is_all_cut())
W.play_tool_sound(src)
to_chat(user, "<span class='notice'>You cut the final wires.</span>")
new /obj/item/stack/cable_coil(loc, 5)
buildstage = 1
update_icon()
return
else if(istype(W, /obj/item/screwdriver)) // Opening that Air Alarm up.
else if(W.tool_behaviour == TOOL_SCREWDRIVER) // Opening that Air Alarm up.
W.play_tool_sound(src)
panel_open = !panel_open
to_chat(user, "<span class='notice'>The wires have been [panel_open ? "exposed" : "unexposed"].</span>")
@@ -763,7 +763,7 @@
wires.interact(user)
return
if(1)
if(istype(W, /obj/item/crowbar))
if(W.tool_behaviour == TOOL_CROWBAR)
user.visible_message("[user.name] removes the electronics from [src.name].",\
"<span class='notice'>You start prying out the circuit...</span>")
W.play_tool_sound(src)
@@ -815,7 +815,7 @@
update_icon()
return
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
to_chat(user, "<span class='notice'>You detach \the [src] from the wall.</span>")
W.play_tool_sound(src)
new /obj/item/wallframe/airalarm( user.loc )
@@ -301,7 +301,7 @@
|| default_deconstruction_crowbar(I))
update_icon()
return
else if(istype(I, /obj/item/screwdriver))
else if(I.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "<span class='notice'>You can't access the maintenance panel while the pod is " \
+ (on ? "active" : (occupant ? "full" : "open")) + ".</span>")
return
@@ -116,7 +116,7 @@
to_chat(user, "<span class='notice'>[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [T]" : "You insert [T] into [src]"].</span>")
replace_tank(user, FALSE, T)
update_icon()
else if(istype(W, /obj/item/wrench))
else if(W.tool_behaviour == TOOL_WRENCH)
if(!(stat & BROKEN))
if(connected_port)
disconnect()
+1 -1
View File
@@ -159,7 +159,7 @@ GLOBAL_DATUM(the_gateway, /obj/machinery/gateway/centerstation)
return
/obj/machinery/gateway/centeraway/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/multitool))
if(W.tool_behaviour == TOOL_MULTITOOL)
if(calibrated)
to_chat(user, "\black The gate is already calibrated, there is no work for you to do here.")
return
+3 -8
View File
@@ -20,14 +20,9 @@
/datum/supply_pack/engineering/conveyor
name = "Conveyor Assembly Crate"
desc = "Keep production moving along with six conveyor belts. Conveyor switch included. If you have any questions, check out the enclosed instruction book."
cost = 750
contains = list(/obj/item/conveyor_construct,
/obj/item/conveyor_construct,
/obj/item/conveyor_construct,
/obj/item/conveyor_construct,
/obj/item/conveyor_construct,
/obj/item/conveyor_construct,
desc = "Keep production moving along with thirty conveyor belts. Conveyor switch included. If you have any questions, check out the enclosed instruction book."
cost = 1500
contains = list(/obj/item/stack/conveyor/thirty,
/obj/item/conveyor_switch_construct,
/obj/item/paper/guides/conveyor)
crate_name = "conveyor assembly crate"
+3 -3
View File
@@ -63,7 +63,7 @@
name = "fingerless insulated gloves"
/obj/item/clothing/gloves/color/yellow/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wirecutters))
if(I.tool_behaviour == TOOL_WIRECUTTER)
if(can_be_cut && icon_state == initial(icon_state))//only if not dyed
to_chat(user, "<span class='notice'>You snip the fingertips off of [src].</span>")
I.play_tool_sound(src)
@@ -72,7 +72,7 @@
..()
/obj/item/clothing/gloves/color/fyellow/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wirecutters))
if(I.tool_behaviour == TOOL_WIRECUTTER)
if(can_be_cut && icon_state == initial(icon_state))//only if not dyed
to_chat(user, "<span class='notice'>You snip the fingertips off of [src].</span>")
I.play_tool_sound(src)
@@ -100,7 +100,7 @@
item_color = "chief" //Exists for washing machines. Is not different from black gloves in any way.
/obj/item/clothing/gloves/color/black/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/wirecutters))
if(I.tool_behaviour == TOOL_WIRECUTTER)
if(can_be_cut && icon_state == initial(icon_state))//only if not dyed
to_chat(user, "<span class='notice'>You snip the fingertips off of [src].</span>")
I.play_tool_sound(src)
+1 -1
View File
@@ -288,7 +288,7 @@
A.Grant(user)
return
if(istype(I, /obj/item/screwdriver))
if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(F)
for(var/obj/item/flashlight/seclite/S in src)
to_chat(user, "<span class='notice'>You unscrew the seclite from [src].</span>")
@@ -1006,7 +1006,7 @@
else if(locked)
usermessage("You can not perform any service while the suit is locked!", "boldwarning")
return FALSE
else if(istype(I, /obj/item/screwdriver))
else if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(!maint_panel)
maint_panel = TRUE
else
@@ -1016,7 +1016,7 @@
else if(!maint_panel)
usermessage("The maintenance panel is closed!", "boldwarning")
return FALSE
else if(istype(I, /obj/item/crowbar))
else if(I.tool_behaviour == TOOL_CROWBAR)
var/list/inputlist = list()
if(pack)
inputlist += "Pack"
+1 -1
View File
@@ -126,7 +126,7 @@
jetpack = I
to_chat(user, "<span class='notice'>You successfully install the jetpack into [src].</span>")
return
else if(istype(I, /obj/item/screwdriver))
else if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(!jetpack)
to_chat(user, "<span class='warning'>[src] has no jetpack installed.</span>")
return
@@ -157,7 +157,7 @@
to_chat(user, "<span class='warning'>There's no room for any more frames in the apiary!</span>")
return
if(istype(I, /obj/item/wrench))
if(I.tool_behaviour == TOOL_WRENCH)
if(default_unfasten_wrench(user, I, time = 20))
return
+1 -1
View File
@@ -615,7 +615,7 @@
else if(default_unfasten_wrench(user, O))
return
else if(istype(O, /obj/item/wirecutters) && unwrenchable)
else if(O.tool_behaviour == TOOL_WIRECUTTER && unwrenchable)
if (!anchored)
to_chat(user, "<span class='warning'>Anchor the tray first!</span>")
return
@@ -452,7 +452,7 @@
for(var/obj/item/integrated_circuit/input/S in assembly_components)
S.attackby_react(I,user,user.a_intent)
return ..()
else if(istype(I, /obj/item/multitool) || istype(I, /obj/item/integrated_electronics/wirer) || istype(I, /obj/item/integrated_electronics/debugger))
else if(I.tool_behaviour == TOOL_MULTITOOL || istype(I, /obj/item/integrated_electronics/wirer) || istype(I, /obj/item/integrated_electronics/debugger))
if(opened)
interact(user)
return TRUE
@@ -250,7 +250,7 @@ a creative player the means to solve many problems. Circuits are held inside an
var/update = TRUE
var/update_to_assembly = FALSE
var/obj/held_item = usr.get_active_held_item()
var/obj/item/held_item = usr.get_active_held_item()
if(href_list["rename"])
rename_component(usr)
@@ -265,7 +265,7 @@ a creative player the means to solve many problems. Circuits are held inside an
if(href_list["link"])
linked = locate(href_list["link"]) in pin.linked
if(istype(held_item, /obj/item/integrated_electronics) || istype(held_item, /obj/item/multitool))
if(istype(held_item, /obj/item/integrated_electronics) || held_item.tool_behaviour == TOOL_MULTITOOL)
pin.handle_wire(linked, held_item, href_list["act"], usr)
else
to_chat(usr, "<span class='warning'>You can't do a whole lot without the proper tools.</span>")
@@ -105,7 +105,7 @@ D [1]/ ||
push_data()
/datum/integrated_io/proc/handle_wire(datum/integrated_io/linked_pin, obj/item/tool, action, mob/living/user)
if(istype(tool, /obj/item/multitool))
if(tool.tool_behaviour == TOOL_MULTITOOL)
var/obj/item/multitool/multitool = tool
switch(action)
if("wire")
+5 -5
View File
@@ -53,12 +53,12 @@
/obj/structure/bookcase/attackby(obj/item/I, mob/user, params)
switch(state)
if(0)
if(istype(I, /obj/item/wrench))
if(I.tool_behaviour == TOOL_WRENCH)
if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "<span class='notice'>You wrench the frame into place.</span>")
anchored = TRUE
state = 1
if(istype(I, /obj/item/crowbar))
if(I.tool_behaviour == TOOL_CROWBAR)
if(I.use_tool(src, user, 20, volume=50))
to_chat(user, "<span class='notice'>You pry the frame apart.</span>")
deconstruct(TRUE)
@@ -71,7 +71,7 @@
to_chat(user, "<span class='notice'>You add a shelf.</span>")
state = 2
icon_state = "book-0"
if(istype(I, /obj/item/wrench))
if(I.tool_behaviour == TOOL_WRENCH)
I.play_tool_sound(src, 100)
to_chat(user, "<span class='notice'>You unwrench the frame.</span>")
anchored = FALSE
@@ -100,7 +100,7 @@
return
else
name = "bookcase ([sanitize(newname)])"
else if(istype(I, /obj/item/crowbar))
else if(I.tool_behaviour == TOOL_CROWBAR)
if(contents.len)
to_chat(user, "<span class='warning'>You need to remove the books first!</span>")
else
@@ -292,7 +292,7 @@
scanner.computer.inventory.Add(src)
to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. Title added to general inventory.'")
else if(istype(I, /obj/item/multitool))
else if(I.tool_behaviour == TOOL_MULTITOOL)
to_chat(user, "<span class='notice'>You begin to erase the data from [title] with your PDA!...</span>")
if(do_after(user, 30, target = src))
to_chat(user, "<span class='notice'>You erase all the page data from [title] with your PDA! You didn't want to read it anyway.</span>")
+1 -1
View File
@@ -191,7 +191,7 @@
/obj/structure/closet/crate/secure/loot/attackby(obj/item/W, mob/user)
if(locked)
if(istype(W, /obj/item/multitool))
if(W.tool_behaviour == TOOL_MULTITOOL)
to_chat(user, "<span class='notice'>DECA-CODE LOCK REPORT:</span>")
if(attempts == 1)
to_chat(user, "<span class='warning'>* Anti-Tamper Bomb will activate on next failed access attempt.</span>")
@@ -48,7 +48,7 @@
. += "<span class='notice'>It has \a [T] attached, which causes [T.effect_desc()].</span>"
/obj/item/twohanded/kinetic_crusher/attackby(obj/item/I, mob/living/user)
if(istype(I, /obj/item/crowbar))
if(I.tool_behaviour == TOOL_CROWBAR)
if(LAZYLEN(trophies))
to_chat(user, "<span class='notice'>You remove [src]'s trophies.</span>")
I.play_tool_sound(src)
+1 -1
View File
@@ -38,7 +38,7 @@
user << browse(dat, "window=console_stacking_machine")
/obj/machinery/mineral/stacking_unit_console/multitool_act(mob/living/user, obj/item/I)
if(istype(I, /obj/item/multitool))
if(I.tool_behaviour == TOOL_MULTITOOL)
var/obj/item/multitool/M = I
M.buffer = src
to_chat(user, "<span class='notice'>You store linkage information in [I]'s buffer.</span>")
+1 -1
View File
@@ -105,7 +105,7 @@
to_chat(user, "<span class='info'>You instruct [src] to drop any collected ore.</span>")
DropOre()
return
if(istype(I, /obj/item/crowbar) || istype(I, /obj/item/borg/upgrade/modkit))
if(I.tool_behaviour == TOOL_CROWBAR || istype(I, /obj/item/borg/upgrade/modkit))
I.melee_attack_chain(user, stored_gun, params)
return
..()
+1 -1
View File
@@ -241,7 +241,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
GibtoniteReaction(user)
return
if(primed)
if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner) || istype(I, /obj/item/multitool))
if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner) || I.tool_behaviour == TOOL_MULTITOOL)
primed = FALSE
if(det_timer)
deltimer(det_timer)
-3
View File
@@ -30,9 +30,6 @@ INITIALIZE_IMMEDIATE(/mob/dead)
/mob/dead/gib() //ghosts can't be gibbed.
return
/mob/dead/ConveyorMove() //lol
return
/mob/dead/forceMove(atom/destination)
var/turf/old_turf = get_turf(src)
var/turf/new_turf = get_turf(destination)
-5
View File
@@ -1053,11 +1053,6 @@
"[C] leaps out of [src]'s way!")]</span>")
C.Knockdown(40)
/mob/living/ConveyorMove()
if((movement_type & FLYING) && !stat)
return
..()
/mob/living/can_be_pulled()
return ..() && !(buckled && buckled.buckle_prevents_pull)
@@ -390,7 +390,7 @@
return ISINRANGE(T1.x, T0.x - interaction_range, T0.x + interaction_range) && ISINRANGE(T1.y, T0.y - interaction_range, T0.y + interaction_range)
/mob/living/silicon/robot/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weldingtool) && (user.a_intent != INTENT_HARM || user == src))
if(W.tool_behaviour == TOOL_WELDER && (user.a_intent != INTENT_HARM || user == src))
user.changeNext_move(CLICK_CD_MELEE)
if (!getBruteLoss())
to_chat(user, "<span class='warning'>[src] is already in good condition!</span>")
@@ -435,7 +435,7 @@
else
to_chat(user, "The wires seem fine, there's no need to fix them.")
else if(istype(W, /obj/item/crowbar)) // crowbar means open or close the cover
else if(W.tool_behaviour == TOOL_CROWBAR) // crowbar means open or close the cover
if(opened)
to_chat(user, "<span class='notice'>You close the cover.</span>")
opened = 0
@@ -467,12 +467,12 @@
else
to_chat(user, "<span class='warning'>You can't reach the wiring!</span>")
else if(istype(W, /obj/item/screwdriver) && opened && !cell) // haxing
else if(W.tool_behaviour == TOOL_SCREWDRIVER && opened && !cell) // haxing
wiresexposed = !wiresexposed
to_chat(user, "The wires have been [wiresexposed ? "exposed" : "unexposed"]")
update_icons()
else if(istype(W, /obj/item/screwdriver) && opened && cell) // radio
else if(W.tool_behaviour == TOOL_SCREWDRIVER && opened && cell) // radio
if(shell)
to_chat(user, "You cannot seem to open the radio compartment") //Prevent AI radio key theft
else if(radio)
@@ -481,7 +481,7 @@
to_chat(user, "<span class='warning'>Unable to locate a radio!</span>")
update_icons()
else if(istype(W, /obj/item/wrench) && opened && !cell) //Deconstruction. The flashes break from the fall, to prevent this from being a ghetto reset module.
else if(W.tool_behaviour == TOOL_WRENCH && opened && !cell) //Deconstruction. The flashes break from the fall, to prevent this from being a ghetto reset module.
if(!lockcharge)
to_chat(user, "<span class='boldannounce'>[src]'s bolts spark! Maybe you should lock them down first!</span>")
spark_system.start()
@@ -284,7 +284,7 @@
show_controls(user)
/mob/living/simple_animal/bot/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(!locked)
open = !open
to_chat(user, "<span class='notice'>The maintenance panel is now [open ? "opened" : "closed"].</span>")
@@ -314,7 +314,7 @@
ejectpai(user)
else
user.changeNext_move(CLICK_CD_MELEE)
if(istype(W, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
if(W.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM)
if(health >= maxHealth)
to_chat(user, "<span class='warning'>[src] does not need a repair!</span>")
return
@@ -100,7 +100,7 @@
build_step++
if(ASSEMBLY_FOURTH_STEP)
if(istype(W, /obj/item/weldingtool))
if(W.tool_behaviour == TOOL_WELDER)
if(W.use_tool(src, user, 0, volume=40))
name = "shielded frame assembly"
to_chat(user, "<span class='notice'>You weld the vest to [src].</span>")
@@ -181,7 +181,7 @@
build_step++
if(8)
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "<span class='notice'>You start attaching the gun to the frame...</span>")
if(W.use_tool(src, user, 40, volume=100))
name = "armed [name]"
@@ -408,13 +408,13 @@
var/atom/Tsec = drop_location()
switch(build_step)
if(ASSEMBLY_FIRST_STEP)
if(istype(I, /obj/item/weldingtool))
if(I.tool_behaviour == TOOL_WELDER)
if(I.use_tool(src, user, 0, volume=40))
add_overlay("hs_hole")
to_chat(user, "<span class='notice'>You weld a hole in [src]!</span>")
build_step++
else if(istype(I, /obj/item/screwdriver)) //deconstruct
else if(I.tool_behaviour == TOOL_SCREWDRIVER) //deconstruct
new /obj/item/assembly/signaler(Tsec)
new /obj/item/clothing/head/helmet/sec(Tsec)
to_chat(user, "<span class='notice'>You disconnect the signaler from the helmet.</span>")
@@ -430,7 +430,7 @@
qdel(I)
build_step++
else if(istype(I, /obj/item/weldingtool)) //deconstruct
else if(I.tool_behaviour == TOOL_WELDER) //deconstruct
if(I.use_tool(src, user, 0, volume=40))
cut_overlay("hs_hole")
to_chat(user, "<span class='notice'>You weld the hole in [src] shut!</span>")
@@ -447,7 +447,7 @@
qdel(I)
build_step++
else if(istype(I, /obj/item/screwdriver)) //deconstruct
else if(I.tool_behaviour == TOOL_SCREWDRIVER) //deconstruct
cut_overlay("hs_eye")
new /obj/item/assembly/prox_sensor(Tsec)
to_chat(user, "<span class='notice'>You detach the proximity sensor from [src].</span>")
@@ -464,7 +464,7 @@
S.robot_arm = robot_arm
qdel(I)
qdel(src)
if(istype(I, /obj/item/wrench))
if(I.tool_behaviour == TOOL_WRENCH)
to_chat(user, "You adjust [src]'s arm slots to mount extra weapons")
build_step ++
return
@@ -488,7 +488,7 @@
qdel(I)
qdel(src)
else if(istype(I, /obj/item/screwdriver)) //deconstruct
else if(I.tool_behaviour == TOOL_SCREWDRIVER) //deconstruct
cut_overlay("hs_arm")
var/obj/item/bodypart/dropped_arm = new robot_arm(Tsec)
robot_arm = null
@@ -520,7 +520,7 @@
S.robot_arm = robot_arm
qdel(I)
qdel(src)
else if(istype(I, /obj/item/screwdriver)) //deconstruct
else if(I.tool_behaviour == TOOL_SCREWDRIVER) //deconstruct
build_step--
icon_state = initial(icon_state)
to_chat(user, "<span class='notice'>You unbolt [src]'s energy swords</span>")
@@ -186,9 +186,9 @@ Auto Patrol[]"},
/mob/living/simple_animal/bot/ed209/attackby(obj/item/W, mob/user, params)
..()
if(istype(W, /obj/item/weldingtool) && user.a_intent != INTENT_HARM) // Any intent but harm will heal, so we shouldn't get angry.
if(W.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) // Any intent but harm will heal, so we shouldn't get angry.
return
if(!istype(W, /obj/item/screwdriver) && (!target)) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass.
if(!W.tool_behaviour == TOOL_SCREWDRIVER && (!target)) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass.
if(W.force && W.damtype != STAMINA)//If force is non-zero and damage type isn't stamina.
retaliate(user)
if(lasercolor)//To make up for the fact that lasertag bots don't hunt
@@ -119,9 +119,9 @@ Maintenance panel panel is [open ? "opened" : "closed"]"},
/mob/living/simple_animal/bot/honkbot/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weldingtool) && user.a_intent != INTENT_HARM)
if(W.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM)
return
if(!istype(W, /obj/item/screwdriver) && (W.force) && (!target) && (W.damtype != STAMINA) ) // Check for welding tool to fix #2432.
if(!W.tool_behaviour == TOOL_SCREWDRIVER && (W.force) && (!target) && (W.damtype != STAMINA) ) // Check for welding tool to fix #2432.
retaliate(user)
addtimer(CALLBACK(src,PROC_REF(react_buzz)), 5)
..()
@@ -185,9 +185,9 @@ Auto Patrol: []"},
/mob/living/simple_animal/bot/secbot/attackby(obj/item/W, mob/user, params)
..()
if(istype(W, /obj/item/weldingtool) && user.a_intent != INTENT_HARM) // Any intent but harm will heal, so we shouldn't get angry.
if(W.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) // Any intent but harm will heal, so we shouldn't get angry.
return
if(!istype(W, /obj/item/screwdriver) && (W.force) && (!target) && (W.damtype != STAMINA) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass.
if(!W.tool_behaviour == TOOL_SCREWDRIVER && (W.force) && (!target) && (W.damtype != STAMINA) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass.
retaliate(user)
if(special_retaliate_after_attack(user))
return
@@ -168,7 +168,7 @@
..()
/mob/living/simple_animal/drone/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/screwdriver) && stat == DEAD)
if(I.tool_behaviour == TOOL_SCREWDRIVER && stat == DEAD)
try_reactivate(user)
else
..()
@@ -55,7 +55,7 @@
/mob/living/simple_animal/drone/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/screwdriver) && stat != DEAD)
if(I.tool_behaviour == TOOL_SCREWDRIVER && stat != DEAD)
if(health < maxHealth)
to_chat(user, "<span class='notice'>You start to tighten loose screws on [src]...</span>")
if(I.use_tool(src, user, 80))
@@ -66,7 +66,7 @@
else
to_chat(user, "<span class='warning'>[src]'s screws can't get any tighter!</span>")
return //This used to not exist and drones who repaired themselves also stabbed the shit out of themselves.
else if(istype(I, /obj/item/wrench) && user != src) //They aren't required to be hacked, because laws can change in other ways (i.e. admins)
else if(I.tool_behaviour == TOOL_WRENCH && user != src) //They aren't required to be hacked, because laws can change in other ways (i.e. admins)
user.visible_message("<span class='notice'>[user] starts resetting [src]...</span>", \
"<span class='notice'>You press down on [src]'s factory reset control...</span>")
if(I.use_tool(src, user, 50, volume=50))
@@ -199,7 +199,7 @@
/mob/living/simple_animal/mouse/boommouse/attackby(obj/item/I, mob/living/user, params)
var/turf/T = get_turf(src)
message_admins("[ADMIN_LOOKUPFLW(user)] is attacking a boommouse at [ADMIN_VERBOSEJMP(T)].")
if(istype(I, /obj/item/weldingtool))
if(I.tool_behaviour == TOOL_WELDER)
var/obj/item/weldingtool/W = I
if(W.welding)
user.visible_message("<span class='warning'>[user] burns the boommouse with [user.p_their()] [W.name]!</span>", "<span class='userdanger'>That was stupid of you.</span>")
@@ -400,7 +400,7 @@
if(install_component(W, user))
return
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
if(all_components.len)
to_chat(user, "<span class='warning'>Remove all components from \the [src] before disassembling it.</span>")
return
@@ -410,7 +410,7 @@
qdel(src)
return
if(istype(W, /obj/item/weldingtool))
if(W.tool_behaviour == TOOL_WELDER)
if(obj_integrity == max_integrity)
to_chat(user, "<span class='warning'>\The [src] does not require repairs.</span>")
return
@@ -424,7 +424,7 @@
to_chat(user, "<span class='notice'>You repair \the [src].</span>")
return
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(!all_components.len)
to_chat(user, "<span class='warning'>This device doesn't have any components installed.</span>")
return
@@ -33,7 +33,7 @@
/obj/item/computer_hardware/attackby(obj/item/I, mob/living/user)
// Multitool. Runs diagnostics
if(istype(I, /obj/item/multitool))
if(I.tool_behaviour == TOOL_MULTITOOL)
to_chat(user, "***** DIAGNOSTICS REPORT *****")
diagnostics(user)
to_chat(user, "******************************")
@@ -62,7 +62,7 @@
/obj/item/computer_hardware/ai_slot/attackby(obj/item/I, mob/living/user)
if(..())
return
if(istype(I, /obj/item/screwdriver))
if(I.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "<span class='notice'>You press down on the manual eject button with \the [I].</span>")
try_eject(,user,1)
return
return
@@ -111,7 +111,7 @@
/obj/item/computer_hardware/card_slot/attackby(obj/item/I, mob/living/user)
if(..())
return
if(istype(I, /obj/item/screwdriver))
if(I.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "<span class='notice'>You press down on the manual eject button with \the [I].</span>")
try_eject(0,user)
return
+1 -1
View File
@@ -54,7 +54,7 @@
sleep(5)
icon_state = initial(icon_state)
updateUsrDialog()
else if(istype(P, /obj/item/wrench))
else if(P.tool_behaviour == TOOL_WRENCH)
to_chat(user, "<span class='notice'>You begin to [anchored ? "unwrench" : "wrench"] [src].</span>")
if(P.use_tool(src, user, 20, volume=50))
to_chat(user, "<span class='notice'>You successfully [anchored ? "unwrench" : "wrench"] [src].</span>")
+1 -1
View File
@@ -59,7 +59,7 @@
storedcutter = P
update_icon()
return
if(istype(P, /obj/item/screwdriver) && storedcutter)
if(P.tool_behaviour == TOOL_SCREWDRIVER && storedcutter)
P.play_tool_sound(src)
to_chat(user, "<span class='notice'>[storedcutter] has been [cuttersecured ? "unsecured" : "secured"].</span>")
cuttersecured = !cuttersecured
+2 -2
View File
@@ -115,14 +115,14 @@
return ..()
/obj/structure/sign/picture_frame/attackby(obj/item/I, mob/user, params)
if(can_decon && (istype(I, /obj/item/screwdriver) || istype(I, /obj/item/wrench)))
if(can_decon && (I.tool_behaviour == TOOL_SCREWDRIVER || I.tool_behaviour == TOOL_WRENCH))
to_chat(user, "<span class='notice'>You start unsecuring [name]...</span>")
if(I.use_tool(src, user, 30, volume=50))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
to_chat(user, "<span class='notice'>You unsecure [name].</span>")
deconstruct()
else if(istype(I, /obj/item/wirecutters) && framed)
else if(I.tool_behaviour == TOOL_WIRECUTTER && framed)
framed.forceMove(drop_location())
framed = null
user.visible_message("<span class='warning'>[user] cuts away [framed] from [src]!</span>")
+1 -1
View File
@@ -159,7 +159,7 @@
/obj/machinery/power/am_control_unit/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
if(!anchored)
W.play_tool_sound(src, 75)
user.visible_message("[user.name] secures the [src.name] to the floor.", \
+1 -1
View File
@@ -246,7 +246,7 @@
materials = list(MAT_METAL=100)
/obj/item/am_shielding_container/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/multitool) && istype(src.loc, /turf))
if(I.tool_behaviour == TOOL_MULTITOOL && istype(src.loc, /turf))
new/obj/machinery/am_shielding(src.loc)
qdel(src)
else
+3 -3
View File
@@ -139,7 +139,7 @@ By design, d1 is the smallest direction and d2 is the highest
var/turf/T = get_turf(src)
if(T.intact)
return
if(istype(W, /obj/item/wirecutters))
if(W.tool_behaviour == TOOL_WIRECUTTER)
if (shock(user, 50))
return
user.visible_message("[user] cuts the cable.", "<span class='notice'>You cut the cable.</span>")
@@ -161,7 +161,7 @@ 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))
else if(W.tool_behaviour == TOOL_MULTITOOL)
if(powernet && (powernet.avail > 0)) // is it powered?
to_chat(user, "<span class='danger'>[DisplayPower(powernet.avail)] in power network.</span>")
else
@@ -852,4 +852,4 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai
/obj/item/stack/cable_coil/cut/random
item_color = null
color = "#ffffff"
color = "#ffffff"
+4 -4
View File
@@ -9,7 +9,7 @@
var/state = FLOODLIGHT_NEEDS_WRENCHING
/obj/structure/floodlight_frame/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/wrench) && (state == FLOODLIGHT_NEEDS_WRENCHING))
if(O.tool_behaviour == TOOL_WRENCH && (state == FLOODLIGHT_NEEDS_WRENCHING))
to_chat(user, "<span class='notice'>You secure [src].</span>")
anchored = TRUE
state = FLOODLIGHT_NEEDS_WIRES
@@ -27,7 +27,7 @@
to_chat(user, "<span class='notice'>You put lights in [src].</span>")
new /obj/machinery/power/floodlight(src.loc)
qdel(src)
else if(istype(O, /obj/item/screwdriver) && (state == FLOODLIGHT_NEEDS_SECURING))
else if(O.tool_behaviour == TOOL_SCREWDRIVER && (state == FLOODLIGHT_NEEDS_SECURING))
to_chat(user, "<span class='notice'>You fasten the wiring and electronics in [src].</span>")
name = "secured [name]"
desc = "A bare metal frame that looks like a floodlight. Requires light tubes."
@@ -83,7 +83,7 @@
to_chat(user, "You set [src] to [setting_text].")
/obj/machinery/power/floodlight/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/wrench))
if(O.tool_behaviour == TOOL_WRENCH)
default_unfasten_wrench(user, O, time = 20)
change_setting(1)
if(anchored)
@@ -114,4 +114,4 @@
qdel(src)
/obj/machinery/power/floodlight/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
playsound(src, 'sound/effects/glasshit.ogg', 75, 1)
playsound(src, 'sound/effects/glasshit.ogg', 75, 1)
+3 -3
View File
@@ -187,14 +187,14 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
/obj/machinery/gravity_generator/main/attackby(obj/item/I, mob/user, params)
switch(broken_state)
if(GRAV_NEEDS_SCREWDRIVER)
if(istype(I, /obj/item/screwdriver))
if(I.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "<span class='notice'>You secure the screws of the framework.</span>")
I.play_tool_sound(src)
broken_state++
update_icon()
return
if(GRAV_NEEDS_WELDING)
if(istype(I, /obj/item/weldingtool))
if(I.tool_behaviour == TOOL_WELDER)
if(I.use_tool(src, user, 0, volume=50, amount=1))
to_chat(user, "<span class='notice'>You mend the damaged framework.</span>")
broken_state++
@@ -213,7 +213,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
to_chat(user, "<span class='warning'>You need 10 sheets of plasteel!</span>")
return
if(GRAV_NEEDS_WRENCH)
if(istype(I, /obj/item/wrench))
if(I.tool_behaviour == TOOL_WRENCH)
to_chat(user, "<span class='notice'>You secure the plating to the framework.</span>")
I.play_tool_sound(src)
set_fix()
+5 -5
View File
@@ -107,7 +107,7 @@
return
switch(stage)
if(1)
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
to_chat(usr, "<span class='notice'>You begin deconstructing [src]...</span>")
if (W.use_tool(src, user, 30, volume=50))
new /obj/item/stack/sheet/metal(drop_location(), sheets_refunded)
@@ -128,11 +128,11 @@
to_chat(user, "<span class='warning'>You need one length of cable to wire [src]!</span>")
return
if(2)
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
to_chat(usr, "<span class='warning'>You have to remove the wires first!</span>")
return
if(istype(W, /obj/item/wirecutters))
if(W.tool_behaviour == TOOL_WIRECUTTER)
stage = 1
icon_state = "[fixture_type]-construct-stage1"
new /obj/item/stack/cable_coil(drop_location(), 1, "red")
@@ -141,7 +141,7 @@
W.play_tool_sound(src, 100)
return
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message("[user.name] closes [src]'s casing.", \
"<span class='notice'>You close [src]'s casing.</span>", "<span class='italics'>You hear screwing.</span>")
W.play_tool_sound(src, 75)
@@ -450,7 +450,7 @@
// attempt to stick weapon into light socket
else if(status == LIGHT_EMPTY)
if(istype(W, /obj/item/screwdriver)) //If it's a screwdriver open it.
if(W.tool_behaviour == TOOL_SCREWDRIVER) //If it's a screwdriver open it.
W.play_tool_sound(src, 75)
user.visible_message("[user.name] opens [src]'s casing.", \
"<span class='notice'>You open [src]'s casing.</span>", "<span class='italics'>You hear a noise.</span>")
+2 -2
View File
@@ -168,7 +168,7 @@
return
else if(!active)
if(istype(O, /obj/item/wrench))
if(O.tool_behaviour == TOOL_WRENCH)
if(!anchored && !isinspace())
connect_to_network()
@@ -181,7 +181,7 @@
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
return
else if(istype(O, /obj/item/screwdriver))
else if(O.tool_behaviour == TOOL_SCREWDRIVER)
panel_open = !panel_open
O.play_tool_sound(src)
if(panel_open)
+1 -1
View File
@@ -18,7 +18,7 @@
var/creation_type = /obj/singularity
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
default_unfasten_wrench(user, W, 0)
else
return ..()
@@ -63,7 +63,7 @@
switch(construction_state)
if(PA_CONSTRUCTION_UNSECURED)
if(istype(W, /obj/item/wrench) && !isinspace())
if(W.tool_behaviour == TOOL_WRENCH && !isinspace())
W.play_tool_sound(src, 75)
anchored = TRUE
user.visible_message("[user.name] secures the [name] to the floor.", \
@@ -71,7 +71,7 @@
construction_state = PA_CONSTRUCTION_UNWIRED
did_something = TRUE
if(PA_CONSTRUCTION_UNWIRED)
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
W.play_tool_sound(src, 75)
anchored = FALSE
user.visible_message("[user.name] detaches the [name] from the floor.", \
@@ -86,18 +86,18 @@
construction_state = PA_CONSTRUCTION_PANEL_OPEN
did_something = TRUE
if(PA_CONSTRUCTION_PANEL_OPEN)
if(istype(W, /obj/item/wirecutters))//TODO:Shock user if its on?
if(W.tool_behaviour == TOOL_WIRECUTTER)//TODO:Shock user if its on?
user.visible_message("[user.name] removes some wires from the [name].", \
"You remove some wires.")
construction_state = PA_CONSTRUCTION_UNWIRED
did_something = TRUE
else if(istype(W, /obj/item/screwdriver))
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message("[user.name] closes the [name]'s access panel.", \
"You close the access panel.")
construction_state = PA_CONSTRUCTION_COMPLETE
did_something = TRUE
if(PA_CONSTRUCTION_COMPLETE)
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message("[user.name] opens the [name]'s access panel.", \
"You open the access panel.")
construction_state = PA_CONSTRUCTION_PANEL_OPEN
@@ -271,7 +271,7 @@
switch(construction_state)
if(PA_CONSTRUCTION_UNSECURED)
if(istype(W, /obj/item/wrench) && !isinspace())
if(W.tool_behaviour == TOOL_WRENCH && !isinspace())
W.play_tool_sound(src, 75)
anchored = TRUE
user.visible_message("[user.name] secures the [name] to the floor.", \
@@ -279,7 +279,7 @@
construction_state = PA_CONSTRUCTION_UNWIRED
did_something = TRUE
if(PA_CONSTRUCTION_UNWIRED)
if(istype(W, /obj/item/wrench))
if(W.tool_behaviour == TOOL_WRENCH)
W.play_tool_sound(src, 75)
anchored = FALSE
user.visible_message("[user.name] detaches the [name] from the floor.", \
@@ -294,18 +294,18 @@
construction_state = PA_CONSTRUCTION_PANEL_OPEN
did_something = TRUE
if(PA_CONSTRUCTION_PANEL_OPEN)
if(istype(W, /obj/item/wirecutters))//TODO:Shock user if its on?
if(W.tool_behaviour == TOOL_WIRECUTTER)//TODO:Shock user if its on?
user.visible_message("[user.name] removes some wires from the [name].", \
"You remove some wires.")
construction_state = PA_CONSTRUCTION_UNWIRED
did_something = TRUE
else if(istype(W, /obj/item/screwdriver))
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message("[user.name] closes the [name]'s access panel.", \
"You close the access panel.")
construction_state = PA_CONSTRUCTION_COMPLETE
did_something = TRUE
if(PA_CONSTRUCTION_COMPLETE)
if(istype(W, /obj/item/screwdriver))
if(W.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message("[user.name] opens the [name]'s access panel.", \
"You open the access panel.")
construction_state = PA_CONSTRUCTION_PANEL_OPEN
+1 -1
View File
@@ -151,7 +151,7 @@
log_game("[src] has been deconstructed by [key_name(user)] at [AREACOORD(src)]")
investigate_log("SMES deconstructed by [key_name(user)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
return
else if(panel_open && istype(I, /obj/item/crowbar))
else if(panel_open && I.tool_behaviour == TOOL_CROWBAR)
return
return ..()
+3 -3
View File
@@ -203,7 +203,7 @@
glass_type = null
/obj/item/solar_assembly/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/wrench) && isturf(loc))
if(W.tool_behaviour == TOOL_WRENCH && isturf(loc))
if(isinspace())
to_chat(user, "<span class='warning'>You can't secure [src] here.</span>")
return
@@ -245,7 +245,7 @@
user.visible_message("[user] inserts the electronics into the solar assembly.", "<span class='notice'>You insert the electronics into the solar assembly.</span>")
return 1
else
if(istype(W, /obj/item/crowbar))
if(W.tool_behaviour == TOOL_CROWBAR)
new /obj/item/electronics/tracker(src.loc)
tracker = 0
user.visible_message("[user] takes out the electronics from the solar assembly.", "<span class='notice'>You take out the electronics from the solar assembly.</span>")
@@ -411,7 +411,7 @@
return FALSE
/obj/machinery/power/solar_control/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/screwdriver))
if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(I.use_tool(src, user, 20, volume=50))
if (src.stat & BROKEN)
to_chat(user, "<span class='notice'>The broken glass falls out.</span>")
@@ -25,7 +25,7 @@
/obj/item/ammo_casing/caseless/foam_dart/attackby(obj/item/A, mob/user, params)
var/obj/item/projectile/bullet/reusable/foam_dart/FD = BB
if (istype(A, /obj/item/screwdriver) && !modified)
if (A.tool_behaviour == TOOL_SCREWDRIVER && !modified)
modified = TRUE
FD.modified = TRUE
FD.damage_type = BRUTE
+1 -1
View File
@@ -360,7 +360,7 @@
knife_overlay.pixel_x = knife_x_offset
knife_overlay.pixel_y = knife_y_offset
add_overlay(knife_overlay, TRUE)
else if(istype(I, /obj/item/screwdriver))
else if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(gun_light)
var/obj/item/flashlight/seclite/S = gun_light
to_chat(user, "<span class='notice'>You unscrew the seclite from \the [src].</span>")
+1 -1
View File
@@ -135,7 +135,7 @@
boom()
/obj/structure/reagent_dispensers/fueltank/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/weldingtool))
if(I.tool_behaviour == TOOL_WELDER)
if(!reagents.has_reagent(/datum/reagent/fuel))
to_chat(user, "<span class='warning'>[src] is out of fuel!</span>")
return
+150 -122
View File
@@ -2,23 +2,37 @@
//note that corner pieces transfer stuff clockwise when running forward, and anti-clockwise backwards.
GLOBAL_LIST_EMPTY(conveyors_by_id)
#define MAX_CONVEYOR_ITEMS_MOVE 30
/obj/machinery/conveyor
icon = 'icons/obj/recycling.dmi'
icon_state = "conveyor_map"
name = "conveyor belt"
desc = "A conveyor belt."
layer = BELOW_OPEN_DOOR_LAYER
var/operating = 0 // 1 if running forward, -1 if backwards, 0 if off
var/operable = 1 // true if can operate (no broken segments in this belt run)
var/forwards // this is the default (forward) direction, set by the map dir
var/backwards // hopefully self-explanatory
var/movedir // the actual direction to move stuff in
var/list/affecting // the list of all items that will be moved this ptick
var/id = "" // the control ID - must match controller ID
var/verted = 1 // Inverts the direction the conveyor belt moves.
/// 1 if running forward, -1 if backwards, 0 if off
var/operating = 0
/// true if can operate (no broken segments in this belt run)
var/operable = 1
/// this is the default (forward) direction, set by the map dir
var/forwards
/// The opposite of forwards. It's set in a special var for corner belts, which aren't using the opposite direction when in reverse.
var/backwards
/// the actual direction to move stuff in
var/movedir
/// The control ID - must match at least one conveyor switch's ID to be useful.
var/id = ""
// Inverts the direction the conveyor belt moves when true.
var/inverted = FALSE
speed_process = TRUE
/// Are we currently conveying items?
var/conveying = FALSE
/obj/machinery/conveyor/examine(mob/user)
. = ..()
if(inverted)
. += span_notice("It is currently set to go in reverse.")
. += "\nLeft-click with a <b>wrench</b> to rotate."
. += "Left-click with a <b>screwdriver</b> to invert its direction."
/obj/machinery/conveyor/centcom_auto
id = "round_end_belt"
@@ -26,7 +40,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
/obj/machinery/conveyor/inverted //Directions inverted so you can use different corner peices.
icon_state = "conveyor_map_inverted"
verted = -1
inverted = TRUE
/obj/machinery/conveyor/inverted/Initialize(mapload)
. = ..()
@@ -41,17 +55,8 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
update_move_direction()
/obj/machinery/conveyor/auto/update()
if(stat & BROKEN)
icon_state = "conveyor-broken"
operating = FALSE
return
else if(!operable)
operating = FALSE
else if(stat & NOPOWER)
operating = FALSE
else
operating = TRUE
icon_state = "conveyor[operating * verted]"
. = ..()
operating = .
// create a conveyor
/obj/machinery/conveyor/Initialize(mapload, newdir, newid)
@@ -102,7 +107,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
if(SOUTHWEST)
forwards = WEST
backwards = NORTH
if(verted == -1)
if(inverted)
var/temp = forwards
forwards = backwards
backwards = temp
@@ -112,61 +117,82 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
movedir = backwards
update()
/obj/machinery/conveyor/update_icon()
if(!operating)
icon_state = "conveyor[inverted ? "-0" : "0"]"
else
icon_state = "conveyor[inverted ? -operating : operating]"
/obj/machinery/conveyor/proc/update()
if(stat & BROKEN)
icon_state = "conveyor-broken"
operating = FALSE
return
if(!operable)
operating = FALSE
. = TRUE
if(stat & NOPOWER)
operating = FALSE
icon_state = "conveyor[operating * verted]"
. = FALSE
update_icon()
// machine process
// move items to the target location
/obj/machinery/conveyor/process()
if(stat & (BROKEN | NOPOWER))
return
if(!operating)
if(!operating || conveying)
return
use_power(6)
affecting = loc.contents - src // moved items will be all in loc
addtimer(CALLBACK(src,PROC_REF(convey), affecting), 1)
//get the first 30 items in contents
var/turf/locturf = loc
var/list/items = locturf.contents - src - locturf.lighting_object
if(!LAZYLEN(items))//Dont do anything at all if theres nothing there but the conveyor
return
var/list/affecting
if(length(items) > MAX_CONVEYOR_ITEMS_MOVE)
affecting = items.Copy(1, MAX_CONVEYOR_ITEMS_MOVE + 1)//Lists start at 1 lol
else
affecting = items
conveying = TRUE
addtimer(CALLBACK(src, .proc/convey, affecting), 1)//Movement effect
/obj/machinery/conveyor/proc/convey(list/affecting)
var/turf/T = get_step(src, movedir)
if(length(T.contents) > 150)
return
for(var/atom/movable/A in affecting)
if((A.loc == loc) && A.has_gravity())
A.ConveyorMove(movedir)
for(var/am in affecting)
if(!ismovable(am)) //This is like a third faster than for(var/atom/movable in affecting)
continue
var/atom/movable/movable_thing = am
//Give this a chance to yield if the server is busy
stoplag()
if(QDELETED(movable_thing) || (movable_thing.loc != loc))
continue
if(iseffect(movable_thing) || isdead(movable_thing))
continue
if(isliving(movable_thing))
var/mob/living/zoommob = movable_thing
if((zoommob.movement_type & FLYING) && !zoommob.stat)
continue
if(!movable_thing.anchored && movable_thing.has_gravity())
step(movable_thing, movedir)
conveying = FALSE
// attack with item, place item on conveyor
/obj/machinery/conveyor/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/crowbar))
if(I.tool_behaviour == TOOL_CROWBAR)
user.visible_message("<span class='notice'>[user] struggles to pry up \the [src] with \the [I].</span>", \
"<span class='notice'>You struggle to pry up \the [src] with \the [I].</span>")
if(I.use_tool(src, user, 40, volume=40))
if(!(stat & BROKEN))
var/obj/item/conveyor_construct/C = new/obj/item/conveyor_construct(src.loc)
C.id = id
transfer_fingerprints_to(C)
var/obj/item/stack/conveyor/C = new/obj/item/stack/conveyor(loc, 1, TRUE, id)
C.id = id
transfer_fingerprints_to(C)
to_chat(user, "<span class='notice'>You remove the conveyor belt.</span>")
qdel(src)
else if(istype(I, /obj/item/wrench))
if(!(stat & BROKEN))
I.play_tool_sound(src)
setDir(turn(dir,-45))
update_move_direction()
to_chat(user, "<span class='notice'>You rotate [src].</span>")
else if(I.tool_behaviour == TOOL_WRENCH)
I.play_tool_sound(src)
setDir(turn(dir,-45))
update_move_direction()
to_chat(user, "<span class='notice'>You rotate [src].</span>")
else if(istype(I, /obj/item/screwdriver))
if(!(stat & BROKEN))
verted = verted * -1
update_move_direction()
to_chat(user, "<span class='notice'>You reverse [src]'s direction.</span>")
else if(I.tool_behaviour == TOOL_SCREWDRIVER)
inverted = !inverted
update_move_direction()
to_chat(user, "<span class='notice'>You set [src]'s direction [inverted ? "backwards" : "back to default"].</span>")
update_icon()
else if(user.a_intent != INTENT_HARM)
user.transferItemToLoc(I, drop_location())
@@ -180,34 +206,6 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
return
user.Move_Pulled(src)
// make the conveyor broken
// also propagate inoperability to any connected conveyor with the same ID
/obj/machinery/conveyor/proc/broken()
stat |= BROKEN
update()
var/obj/machinery/conveyor/C = locate() in get_step(src, dir)
if(C)
C.set_operable(dir, id, 0)
C = locate() in get_step(src, turn(dir,180))
if(C)
C.set_operable(turn(dir,180), id, 0)
//set the operable var if ID matches, propagating in the given direction
/obj/machinery/conveyor/proc/set_operable(stepdir, match_id, op)
if(id != match_id)
return
operable = op
update()
var/obj/machinery/conveyor/C = locate() in get_step(src, stepdir)
if(C)
C.set_operable(stepdir, id, op)
/obj/machinery/conveyor/power_change()
..()
update()
@@ -309,12 +307,23 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
CHECK_TICK
/obj/machinery/conveyor_switch/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/crowbar))
var/obj/item/conveyor_switch_construct/C = new/obj/item/conveyor_switch_construct(src.loc)
C.id = id
transfer_fingerprints_to(C)
to_chat(user, "<span class='notice'>You detach the conveyor switch.</span>")
qdel(src)
switch(I.tool_behaviour)
if(TOOL_CROWBAR)
var/obj/item/conveyor_switch_construct/C = new/obj/item/conveyor_switch_construct(src.loc)
C.id = id
transfer_fingerprints_to(C)
to_chat(user, "<span class='notice'>You detach the conveyor switch.</span>")
qdel(src)
if(TOOL_WRENCH)
if(position)
to_chat(user, span_warning("\The [src] must be off before attempting to change it's direction!"))
return FALSE
oneway = !oneway
I.play_tool_sound(src, 75)
user.visible_message("<span class='notice'>[user] sets \the [src] to [oneway ? "one-way" : "two-way"].</span>",
"<span class='notice'>You set \the [src] to [oneway ? "one-way" : "two-way"].</span>",
"<span class='italics'>You hear a ratchet.</span>")
/obj/machinery/conveyor_switch/oneway
icon_state = "conveyor_switch_oneway"
@@ -326,37 +335,6 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
if((dir == NORTH) || (dir == WEST))
invert_icon = TRUE
//
// CONVEYOR CONSTRUCTION STARTS HERE
//
/obj/item/conveyor_construct
icon = 'icons/obj/recycling.dmi'
icon_state = "conveyor_construct"
name = "conveyor belt assembly"
desc = "A conveyor belt assembly."
w_class = WEIGHT_CLASS_BULKY
var/id = "" //inherited by the belt
/obj/item/conveyor_construct/attackby(obj/item/I, mob/user, params)
..()
if(istype(I, /obj/item/conveyor_switch_construct))
to_chat(user, "<span class='notice'>You link the switch to the conveyor belt assembly.</span>")
var/obj/item/conveyor_switch_construct/C = I
id = C.id
/obj/item/conveyor_construct/afterattack(atom/A, mob/user, proximity)
. = ..()
if(!proximity || user.stat || !isfloorturf(A) || istype(A, /area/shuttle))
return
var/cdir = get_dir(A, user)
if(A == user.loc)
to_chat(user, "<span class='notice'>You cannot place a conveyor belt under yourself.</span>")
return
var/obj/machinery/conveyor/C = new/obj/machinery/conveyor(A, cdir, id)
transfer_fingerprints_to(C)
qdel(src)
/obj/item/conveyor_switch_construct
name = "conveyor switch assembly"
desc = "A conveyor control switch assembly."
@@ -385,6 +363,56 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
transfer_fingerprints_to(NC)
qdel(src)
/obj/item/conveyor_switch_construct/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_MULTITOOL)
id = "[rand()]"
to_chat(user, span_notice("You pulse \the [src]'s connection, randomly generating a new network ID."))
/obj/item/stack/conveyor
name = "conveyor belt assembly"
desc = "A conveyor belt assembly."
icon = 'icons/obj/recycling.dmi'
icon_state = "conveyor_construct"
max_amount = 30
singular_name = "conveyor belt"
w_class = WEIGHT_CLASS_BULKY
materials = list(/datum/material/metal = 1000)
///id for linking
var/id = "" //inherited by the belt
/obj/item/stack/conveyor/Initialize(mapload, new_amount, merge = TRUE, _id)
. = ..()
id = _id
/obj/item/stack/conveyor/afterattack(atom/A, mob/user, proximity)
. = ..()
if(!proximity || user.stat || !isfloorturf(A) || istype(A, /area/shuttle))
return
var/cdir = get_dir(A, user)
if(A == user.loc)
to_chat(user, "<span class='notice'>You cannot place a conveyor belt under yourself.</span>")
return
var/obj/machinery/conveyor/C = new/obj/machinery/conveyor(A, cdir, id)
transfer_fingerprints_to(C)
use(1)
/obj/item/stack/conveyor/attackby(obj/item/I, mob/user, params)
..()
if(istype(I, /obj/item/conveyor_switch_construct))
to_chat(user, "<span class='notice'>You link the switch to the conveyor belt assembly.</span>")
var/obj/item/conveyor_switch_construct/C = I
id = C.id
if(I.tool_behaviour == TOOL_MULTITOOL)
id = ""
to_chat(user, span_notice("You unlink the conveyor belt assembly from any switches it's connected to."))
/obj/item/stack/conveyor/update_weight()
return FALSE
/obj/item/stack/conveyor/thirty
amount = 30
/obj/item/paper/guides/conveyor
name = "paper- 'Nano-it-up U-build series, #9: Build your very own conveyor belt, in SPACE'"
info = "<h1>Congratulations!</h1><p>You are now the proud owner of the best conveyor set available for space mail order! We at Nano-it-up know you love to prepare your own structures without wasting time, so we have devised a special streamlined assembly procedure that puts all other mail-order products to shame!</p><p>Firstly, you need to link the conveyor switch assembly to each of the conveyor belt assemblies. After doing so, you simply need to install the belt assemblies onto the floor, et voila, belt built. Our special Nano-it-up smart switch will detected any linked assemblies as far as the eye can see! This convenience, you can only have it when you Nano-it-up. Stay nano!</p>"
#undef MAX_CONVEYOR_ITEMS_MOVE
@@ -87,9 +87,10 @@
name = "Conveyor Belt"
id = "conveyor_belt"
build_type = AUTOLATHE
materials = list(MAT_METAL = 5000)
build_path = /obj/item/conveyor_construct
materials = list(MAT_METAL = 3000)
build_path = /obj/item/stack/conveyor
category = list("initial", "Construction")
maxstack = 30
/datum/design/conveyor_switch
name = "Conveyor Belt Switch"
@@ -138,7 +138,9 @@
current_potion = O
to_chat(user, "<span class='notice'>You load [O] in the console's potion slot[replaced ? ", replacing the one that was there before" : ""].</span>")
return
else if(istype(O, /obj/item/multitool))
else if(O.tool_behaviour == TOOL_MULTITOOL)
if(!multitool_check_buffer(user, O))
return
var/obj/item/multitool/M = O
if(istype(M.buffer))
to_chat(user, "<span class='notice'>You link [src] with [M.buffer] in [M] buffer.</span>")
+5 -3
View File
@@ -40,7 +40,9 @@
icon_state = "power_box"
/obj/machinery/bsa/back/multitool_act(mob/living/user, obj/item/I)
if(istype(I, /obj/item/multitool)) // Only this multitool type has a data buffer.
if(I.tool_behaviour == TOOL_MULTITOOL) // Only this multitool type has a data buffer.
if(!multitool_check_buffer(user, I))
return
var/obj/item/multitool/M = I
M.buffer = src
to_chat(user, "<span class='notice'>You store linkage information in [I]'s buffer.</span>")
@@ -54,7 +56,7 @@
icon_state = "emitter_center"
/obj/machinery/bsa/front/multitool_act(mob/living/user, obj/item/I)
if(istype(I, /obj/item/multitool)) // Only this multitool type has a data buffer.
if(I.tool_behaviour == TOOL_MULTITOOL) // Only this multitool type has a data buffer.
var/obj/item/multitool/M = I
M.buffer = src
to_chat(user, "<span class='notice'>You store linkage information in [I]'s buffer.</span>")
@@ -70,7 +72,7 @@
var/obj/machinery/bsa/front/front
/obj/machinery/bsa/middle/multitool_act(mob/living/user, obj/item/I)
if(istype(I, /obj/item/multitool)) // Only this multitool type has a data buffer.
if(I.tool_behaviour == TOOL_MULTITOOL) // Only this multitool type has a data buffer.
var/obj/item/multitool/M = I
if(M.buffer)
if(istype(M.buffer, /obj/machinery/bsa/back))
+1 -1
View File
@@ -122,7 +122,7 @@
icon_state = active ? "sat_active" : "sat_inactive"
/obj/machinery/satellite/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/multitool))
if(I.tool_behaviour == TOOL_MULTITOOL)
to_chat(user, "<span class='notice'>// NTSAT-[id] // Mode : [active ? "PRIMARY" : "STANDBY"] //[(obj_flags & EMAGGED) ? "DEBUG_MODE //" : ""]</span>")
else
return ..()
@@ -198,7 +198,7 @@
else
src.flash1 = F
to_chat(user, "<span class='notice'>You insert the flash into the eye socket.</span>")
else if(istype(W, /obj/item/crowbar))
else if(W.tool_behaviour == TOOL_CROWBAR)
if(flash1 || flash2)
W.play_tool_sound(src)
to_chat(user, "<span class='notice'>You remove the flash from [src].</span>")