Some refactors, DMDoc and UT (#18365)

* dsfa

* accessories fix

* fixed "has been hit by" message with intent check

* sdfa
This commit is contained in:
Fluffy
2024-02-12 15:32:23 +00:00
committed by GitHub
parent 58dbaf8be6
commit 9afe761db3
620 changed files with 5733 additions and 5200 deletions
@@ -121,17 +121,17 @@
GLOB.ntnet_global.add_log("Quantum relay connection severed. Current amount of linked relays: [NTNet.relays.len]")
return ..()
/obj/machinery/ntnet_relay/attackby(obj/item/W, mob/user)
if(W.isscrewdriver())
playsound(get_turf(src), W.usesound, 50, TRUE)
/obj/machinery/ntnet_relay/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.isscrewdriver())
playsound(get_turf(src), attacking_item.usesound, 50, TRUE)
panel_open = !panel_open
to_chat(user, SPAN_NOTICE("You [panel_open ? "open" : "close"] the maintenance hatch."))
return
if(W.iscrowbar())
if(attacking_item.iscrowbar())
if(!panel_open)
to_chat(user, SPAN_WARNING("Open the maintenance panel first."))
return
playsound(get_turf(src), W.usesound, 50, 1)
playsound(get_turf(src), attacking_item.usesound, 50, 1)
to_chat(user, SPAN_NOTICE("You disassemble \the [src]!"))
for(var/atom/movable/A in component_parts)
@@ -205,8 +205,8 @@
else if(!enabled && screen_on)
turn_on(user)
/obj/item/modular_computer/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/card/tech_support))
/obj/item/modular_computer/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/card/tech_support))
if(!can_reset)
to_chat(user, SPAN_WARNING("You cannot reset this type of device."))
return TRUE
@@ -220,8 +220,8 @@
hard_drive.reset_drive()
audible_message("[icon2html(src, viewers(get_turf(src)))] <b>[src]</b> pings, <span class='notice'>\"Enrollment status reset! Have a NanoTrasen day.\"</span>")
return TRUE
if(istype(W, /obj/item/card/id)) // ID Card, try to insert it.
var/obj/item/card/id/I = W
if(istype(attacking_item, /obj/item/card/id)) // ID Card, try to insert it.
var/obj/item/card/id/I = attacking_item
if(!card_slot)
to_chat(user, SPAN_WARNING("You try to insert \the [I] into \the [src], but it does not have an ID card slot installed."))
return TRUE
@@ -234,54 +234,54 @@
update_uis()
to_chat(user, SPAN_NOTICE("You insert \the [I] into \the [src]."))
return TRUE
if(is_type_in_list(W, card_slot?.allowed_items))
if(is_type_in_list(attacking_item, card_slot?.allowed_items))
if(!card_slot)
to_chat(user, SPAN_WARNING("You try to insert \the [W] into \the [src], but it does not have an ID card slot installed."))
to_chat(user, SPAN_WARNING("You try to insert \the [attacking_item] into \the [src], but it does not have an ID card slot installed."))
return TRUE
if(card_slot.stored_item)
to_chat(user, SPAN_WARNING("You try to insert \the [W] into \the [src], but its storage slot is occupied."))
to_chat(user, SPAN_WARNING("You try to insert \the [attacking_item] into \the [src], but its storage slot is occupied."))
return TRUE
user.drop_from_inventory(W, src)
card_slot.stored_item = W
user.drop_from_inventory(attacking_item, src)
card_slot.stored_item = attacking_item
update_uis()
verbs += /obj/item/modular_computer/proc/eject_item
to_chat(user, SPAN_NOTICE("You insert \the [W] into \the [src]."))
to_chat(user, SPAN_NOTICE("You insert \the [attacking_item] into \the [src]."))
return TRUE
if(istype(W, /obj/item/paper))
if(istype(attacking_item, /obj/item/paper))
if(!nano_printer)
return TRUE
nano_printer.attackby(W, user)
nano_printer.attackby(attacking_item, user)
return TRUE
if(istype(W, /obj/item/aicard))
if(istype(attacking_item, /obj/item/aicard))
if(ai_slot)
ai_slot.attackby(W, user)
ai_slot.attackby(attacking_item, user)
return TRUE
if(istype(W, /obj/item/computer_hardware))
var/obj/item/computer_hardware/C = W
if(istype(attacking_item, /obj/item/computer_hardware))
var/obj/item/computer_hardware/C = attacking_item
if(C.hardware_size <= max_hardware_size)
try_install_component(user, C)
else
to_chat(user, SPAN_WARNING("This component is too large for \the [src]."))
return TRUE
if(istype(W, /obj/item/device/paicard))
try_install_component(user, W)
if(istype(attacking_item, /obj/item/device/paicard))
try_install_component(user, attacking_item)
return TRUE
if(W.iswrench())
if(attacking_item.iswrench())
var/list/components = get_all_components()
if(components.len)
to_chat(user, SPAN_WARNING("You have to remove all the components from \the [src] before disassembling it."))
return TRUE
to_chat(user, SPAN_NOTICE("You begin to disassemble \the [src]."))
if(W.use_tool(src, user, 20, volume = 50))
if(attacking_item.use_tool(src, user, 20, volume = 50))
new /obj/item/stack/material/steel(get_turf(src), steel_sheet_cost)
user.visible_message(SPAN_NOTICE("\The [user] disassembles \the [src]."), SPAN_NOTICE("You disassemble \the [src]."), SPAN_NOTICE("You hear a ratcheting noise."))
qdel(src)
return TRUE
if(W.iswelder())
var/obj/item/weldingtool/WT = W
if(attacking_item.iswelder())
var/obj/item/weldingtool/WT = attacking_item
if(!WT.isOn())
to_chat(user, SPAN_WARNING("\The [W] is off."))
to_chat(user, SPAN_WARNING("\The [attacking_item] is off."))
return TRUE
if(!damage)
@@ -296,7 +296,7 @@
update_icon()
return TRUE
if(W.isscrewdriver())
if(attacking_item.isscrewdriver())
var/list/all_components = get_all_components()
if(!all_components.len)
to_chat(user, SPAN_WARNING("This device doesn't have any components installed."))
@@ -18,8 +18,8 @@
w_class = ITEMSIZE_HUGE
is_holographic = TRUE
/obj/item/modular_computer/telescreen/attackby(obj/item/W, mob/user)
if(W.iscrowbar())
/obj/item/modular_computer/telescreen/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.iscrowbar())
if(anchored)
shutdown_computer()
anchored = FALSE
@@ -28,7 +28,7 @@
pixel_y = 0
to_chat(user, SPAN_NOTICE("You unsecure \the [src]."))
else
var/choice = input(user, "Where do you want to place \the [src]?", "Offset selection") in list("North", "South", "West", "East", "This tile", "Cancel")
var/choice = tgui_input_list(user, "Where do you want to place \the [src]?", "Offset selection", list("North", "South", "West", "East", "This tile", "Cancel"), "Cancel")
var/valid = FALSE
switch(choice)
if("North")
@@ -17,17 +17,17 @@
return
power_usage = power_usage_occupied
/obj/item/computer_hardware/ai_slot/attackby(obj/item/W, mob/user)
/obj/item/computer_hardware/ai_slot/attackby(obj/item/attacking_item, mob/user)
if(..())
return TRUE
if(istype(W, /obj/item/aicard))
if(istype(attacking_item, /obj/item/aicard))
if(stored_card)
to_chat(user, SPAN_WARNING("\The [src] is already occupied."))
return
user.drop_from_inventory(W, src)
stored_card = W
user.drop_from_inventory(attacking_item, src)
stored_card = attacking_item
update_power_usage()
if(W.isscrewdriver())
if(attacking_item.isscrewdriver())
to_chat(user, SPAN_NOTICE("You manually remove \the [stored_card] from \the [src]."))
stored_card.forceMove(get_turf(src))
stored_card = null
@@ -175,8 +175,8 @@
remove_file(F)
install_default_programs()
/obj/item/computer_hardware/hard_drive/attackby(obj/item/W, mob/living/user)
if(istype(W, /obj/item/card/tech_support))
/obj/item/computer_hardware/hard_drive/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/card/tech_support))
reset_drive()
to_chat(user, SPAN_NOTICE("Drive successfully reset."))
else
@@ -26,21 +26,21 @@
return disable()
return enable()
/obj/item/computer_hardware/attackby(obj/item/W, mob/living/user)
/obj/item/computer_hardware/attackby(obj/item/attacking_item, mob/user)
// Multitool. Runs diagnostics
if(W.ismultitool())
if(attacking_item.ismultitool())
to_chat(user, SPAN_NOTICE("***** DIAGNOSTICS REPORT *****"))
diagnostics(user)
to_chat(user, SPAN_NOTICE("******************************"))
return 1
// Nanopaste. Repair all damage if present for a single unit.
var/obj/item/stack/S = W
var/obj/item/stack/S = attacking_item
if(istype(S, /obj/item/stack/nanopaste))
if(!damage)
to_chat(user, SPAN_WARNING("\The [src] doesn't seem to require repairs."))
return TRUE
if(S.use(1))
to_chat(user, SPAN_NOTICE("You apply a bit of \the [W] to \the [src], repairing it fully."))
to_chat(user, SPAN_NOTICE("You apply a bit of \the [attacking_item] to \the [src], repairing it fully."))
damage = 0
return TRUE
// Cable coil. Works as repair method, but will probably require multiple applications and more cable.
@@ -49,7 +49,7 @@
to_chat(user, SPAN_WARNING("\The [src] doesn't seem to require repairs."))
return TRUE
if(S.use(1))
to_chat(user, SPAN_NOTICE("You patch up \the [src] with a bit of \the [W]."))
to_chat(user, SPAN_NOTICE("You patch up \the [src] with a bit of \the [attacking_item]."))
take_damage(-10)
return TRUE
return ..()
@@ -31,13 +31,13 @@
stored_paper--
return P
/obj/item/computer_hardware/nano_printer/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/paper))
/obj/item/computer_hardware/nano_printer/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/paper))
if(stored_paper >= max_paper)
to_chat(user, SPAN_WARNING("You try to add \the [W] to the [src], but its paper bin is full."))
to_chat(user, SPAN_WARNING("You try to add \the [attacking_item] to the [src], but its paper bin is full."))
return
to_chat(user, SPAN_NOTICE("You insert \the [W] into [src]."))
qdel(W)
to_chat(user, SPAN_NOTICE("You insert \the [attacking_item] into [src]."))
qdel(attacking_item)
stored_paper++
else
..()
@@ -33,14 +33,14 @@
else
to_chat(user, SPAN_WARNING("You must be holding \the [src] in one of your hands before you can eject a drive."))
/obj/item/paper_scanner/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/computer_hardware/hard_drive/portable))
/obj/item/paper_scanner/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/computer_hardware/hard_drive/portable))
if(drive)
to_chat(user, SPAN_WARNING("\The [src] already has a drive installed!"))
return TRUE
to_chat(user, SPAN_NOTICE("You insert \the [W] into \the [src]."))
user.drop_from_inventory(W, src)
drive = W
to_chat(user, SPAN_NOTICE("You insert \the [attacking_item] into \the [src]."))
user.drop_from_inventory(attacking_item, src)
drive = attacking_item
update_icon()
return TRUE
else
@@ -262,8 +262,8 @@
ui.open()
ui.set_auto_update(1)
/obj/machinery/lapvend/attackby(obj/item/W, mob/user)
if(W.iswrench())
/obj/machinery/lapvend/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.iswrench())
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(anchored)
user.visible_message("<b>[user]</b> begins unsecuring \the [src] from the floor.", \
@@ -271,19 +271,19 @@
else
user.visible_message("<b>[user]</b> begins securing \the [src] to the floor.", \
SPAN_NOTICE("You start securing \the [src] to the floor."))
if(W.use_tool(src, user, 20, volume = 50))
if(attacking_item.use_tool(src, user, 20, volume = 50))
if(!src)
return
to_chat(user, SPAN_NOTICE("You [anchored ? "un" : ""]secured \the [src]!"))
anchored = !anchored
return
else if(state == 2) // awaiting payment state
if(istype(W, /obj/item/card/id))
var/obj/item/card/id/I = W.GetID()
if(process_payment(I, W))
if(istype(attacking_item, /obj/item/card/id))
var/obj/item/card/id/I = attacking_item.GetID()
if(process_payment(I, attacking_item))
create_device()
return TRUE
else if(istype(W, /obj/item/card/tech_support))
else if(istype(attacking_item, /obj/item/card/tech_support))
create_device("Have a NanoTrasen day!")
return TRUE
return ..()