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
@@ -236,19 +236,19 @@
for(var/obj/item/integrated_circuit/input/sensor/S in contents)
S.sense(target, user)
/obj/item/device/electronic_assembly/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/integrated_circuit))
if(!user.unEquip(I))
/obj/item/device/electronic_assembly/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/integrated_circuit))
if(!user.unEquip(attacking_item))
return FALSE
if(add_circuit(I, user))
to_chat(user, "<span class='notice'>You slide \the [I] inside \the [src].</span>")
if(add_circuit(attacking_item, user))
to_chat(user, "<span class='notice'>You slide \the [attacking_item] inside \the [src].</span>")
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
interact(user)
return TRUE
else if(I.iswrench() && can_anchor)
playsound(src.loc, I.usesound, 50, 1)
else if(attacking_item.iswrench() && can_anchor)
playsound(src.loc, attacking_item.usesound, 50, 1)
anchored = !anchored
if(anchored)
on_anchored()
@@ -257,14 +257,14 @@
user.visible_message("[user] has wrenched [src]'s anchoring bolts [anchored ? "into" : "out of"] place.", "You wrench [src]'s anchoring bolts [anchored ? "into" : "out of"] place.", "You hear the sound of a ratcheting wrench turning.")
return TRUE
else if(I.iscrowbar())
playsound(get_turf(src), I.usesound, 50, 1)
else if(attacking_item.iscrowbar())
playsound(get_turf(src), attacking_item.usesound, 50, 1)
opened = !opened
to_chat(user, "<span class='notice'>You [opened ? "open" : "close"] \the [src].</span>")
update_icon()
return TRUE
else if(istype(I, /obj/item/device/integrated_electronics/wirer) || istype(I, /obj/item/device/integrated_electronics/debugger) || I.ismultitool() || I.isscrewdriver())
else if(istype(attacking_item, /obj/item/device/integrated_electronics/wirer) || istype(attacking_item, /obj/item/device/integrated_electronics/debugger) || attacking_item.ismultitool() || attacking_item.isscrewdriver())
if(opened)
interact(user)
else
@@ -272,38 +272,38 @@
Try using a crowbar.</span>")
return TRUE
else if(istype(I, /obj/item/cell/device))
else if(istype(attacking_item, /obj/item/cell/device))
if(!opened)
to_chat(user, "<span class='warning'>\The [src] isn't open, so you can't put anything inside. Try using a crowbar.</span>")
for(var/obj/item/integrated_circuit/input/S in contents)
S.attackby_react(I,user,user.a_intent)
S.attackby_react(attacking_item,user,user.a_intent)
return FALSE
if(battery)
to_chat(user, "<span class='warning'>\The [src] already has \a [battery] inside. Remove it first if you want to replace it.</span>")
for(var/obj/item/integrated_circuit/input/S in contents)
S.attackby_react(I,user,user.a_intent)
S.attackby_react(attacking_item,user,user.a_intent)
return FALSE
var/obj/item/cell/device/cell = I
var/obj/item/cell/device/cell = attacking_item
user.drop_from_inventory(cell,src)
battery = cell
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
to_chat(user, "<span class='notice'>You slot \the [cell] inside \the [src]'s power supply.</span>")
interact(user)
return TRUE
else if(istype(I, /obj/item/device/integrated_electronics/detailer))
var/obj/item/device/integrated_electronics/detailer/D = I
else if(istype(attacking_item, /obj/item/device/integrated_electronics/detailer))
var/obj/item/device/integrated_electronics/detailer/D = attacking_item
detail_color = D.detail_color
update_icon()
return TRUE
else
for(var/obj/item/integrated_circuit/insert_slot/S in contents) //Attempt to insert the item into any contained insert_slots
if(S.insert(I, user))
if(S.insert(attacking_item, user))
return TRUE
for(var/obj/item/integrated_circuit/input/S in contents) // Attempt to swipe on scanners
if(S.attackby_react(I,user,user.a_intent))
if(S.attackby_react(attacking_item,user,user.a_intent))
return TRUE
return ..()
@@ -61,9 +61,12 @@
examinate(user, IC)
. = ..()
/obj/item/clothing/attackby(obj/item/I, mob/user)
if(IC && (istype(I, /obj/item/integrated_circuit) || I.iswrench() || I.iscrowbar() || istype(I, /obj/item/device/integrated_electronics/wirer) || istype(I, /obj/item/device/integrated_electronics/debugger) || I.ismultitool() || I.isscrewdriver() || istype(I, /obj/item/cell/device)))
IC.attackby(I, user)
/obj/item/clothing/attackby(obj/item/attacking_item, mob/user)
if(IC && (istype(attacking_item, /obj/item/integrated_circuit) || attacking_item.iswrench() || attacking_item.iscrowbar() || \
istype(attacking_item, /obj/item/device/integrated_electronics/wirer) || istype(attacking_item, /obj/item/device/integrated_electronics/debugger) || \
attacking_item.ismultitool() || attacking_item.isscrewdriver() || istype(attacking_item, /obj/item/cell/device)))
IC.attackby(attacking_item, user)
else
..()
@@ -17,11 +17,11 @@
. = ..()
/obj/item/device/assembly/electronic_assembly/attackby(obj/item/I, mob/user)
if (I.iscrowbar())
/obj/item/device/assembly/electronic_assembly/attackby(obj/item/attacking_item, mob/user)
if (attacking_item.iscrowbar())
toggle_open(user)
else if (opened)
EA.attackby(I, user)
EA.attackby(attacking_item, user)
else
..()
@@ -16,9 +16,9 @@
upgraded = TRUE
can_clone = TRUE
/obj/item/device/integrated_circuit_printer/attackby(var/obj/item/O, var/mob/user)
if(istype(O,/obj/item/stack/material))
var/obj/item/stack/material/stack = O
/obj/item/device/integrated_circuit_printer/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item,/obj/item/stack/material))
var/obj/item/stack/material/stack = attacking_item
if(stack.material.name == DEFAULT_WALL_MATERIAL)
var/num = min((max_metal - metal) / metal_per_sheet, stack.amount)
if(num < 1)
@@ -29,26 +29,26 @@
metal += num * metal_per_sheet
return TRUE
if(istype(O,/obj/item/integrated_circuit))
if(istype(attacking_item,/obj/item/integrated_circuit))
to_chat(user, "<span class='notice'>You insert the circuit into \the [src]. </span>")
user.unEquip(O)
metal = min(metal + O.w_class, max_metal)
qdel(O)
user.unEquip(attacking_item)
metal = min(metal + attacking_item.w_class, max_metal)
qdel(attacking_item)
return TRUE
if(istype(O,/obj/item/disk/integrated_circuit/upgrade/advanced))
if(istype(attacking_item,/obj/item/disk/integrated_circuit/upgrade/advanced))
if(upgraded)
to_chat(user, "<span class='warning'>\The [src] already has this upgrade. </span>")
return TRUE
to_chat(user, "<span class='notice'>You install \the [O] into \the [src]. </span>")
to_chat(user, "<span class='notice'>You install \the [attacking_item] into \the [src]. </span>")
upgraded = TRUE
return TRUE
if(istype(O,/obj/item/disk/integrated_circuit/upgrade/clone))
if(istype(attacking_item,/obj/item/disk/integrated_circuit/upgrade/clone))
if(can_clone)
to_chat(user, "<span class='warning'>\The [src] already has this upgrade. </span>")
return TRUE
to_chat(user, "<span class='notice'>You install \the [O] into \the [src]. </span>")
to_chat(user, "<span class='notice'>You install \the [attacking_item] into \the [src]. </span>")
can_clone = TRUE
return TRUE
@@ -28,9 +28,9 @@
QDEL_NULL(installed_gun)
. = ..()
/obj/item/integrated_circuit/manipulation/weapon_firing/attackby(var/obj/O, var/mob/user)
if(istype(O, /obj/item/gun))
var/obj/item/gun/gun = O
/obj/item/integrated_circuit/manipulation/weapon_firing/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/gun))
var/obj/item/gun/gun = attacking_item
if(installed_gun)
to_chat(user, "<span class='warning'>There's already a weapon installed.</span>")
return
@@ -138,7 +138,8 @@
detach_grenade()
. = ..()
/obj/item/integrated_circuit/manipulation/grenade/attackby(var/obj/item/grenade/G, var/mob/user)
/obj/item/integrated_circuit/manipulation/grenade/attackby(obj/item/attacking_item, mob/user)
var/obj/item/grenade/G = attacking_item
if(istype(G))
if(attached_grenade)
to_chat(user, "<span class='warning'>There is already a grenade attached!</span>")