Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attack chain migration: /obj/machinery #27784

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fd4a747
one at a time let's go
warriorstar-orion Dec 8, 2024
fea26f1
air alarm
warriorstar-orion Dec 8, 2024
f24ab9f
so many
warriorstar-orion Dec 8, 2024
fec795b
meh
warriorstar-orion Dec 8, 2024
154ec25
hell
warriorstar-orion Dec 9, 2024
efe9c4d
hell
warriorstar-orion Dec 9, 2024
85ef735
hmm
warriorstar-orion Dec 12, 2024
3d01d51
Attack chain migration: /obj/machinery
warriorstar-orion Dec 6, 2024
82918b1
what the fuck?
warriorstar-orion Dec 31, 2024
0b181e2
hell
warriorstar-orion Jan 1, 2025
e5923a9
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 10, 2025
204b6b3
review fixes
warriorstar-orion Jan 10, 2025
a409091
whoops
warriorstar-orion Jan 10, 2025
e34414a
fix build
warriorstar-orion Jan 10, 2025
dd3e054
nuke fixes, more tests
warriorstar-orion Jan 10, 2025
db39f38
Merge branch 'attack-chain-migration/machinery' of github.com:warrior…
warriorstar-orion Jan 16, 2025
4b019b4
gland dispsenser and start of autolathe test
warriorstar-orion Jan 17, 2025
cb75313
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 17, 2025
49adeff
var renames
warriorstar-orion Jan 17, 2025
38937f0
small fixes
warriorstar-orion Jan 18, 2025
eba8331
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 18, 2025
1469fc0
i tire of life
warriorstar-orion Jan 18, 2025
67b5fe8
more tests
warriorstar-orion Jan 18, 2025
5ce8c3f
more tests
warriorstar-orion Jan 18, 2025
552a5e3
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 18, 2025
1202c99
more tests
warriorstar-orion Jan 18, 2025
b0d7067
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 19, 2025
4fcc452
shrink map
warriorstar-orion Jan 19, 2025
9024c12
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 20, 2025
ccb8cd7
customize autolathe design disk load delay
warriorstar-orion Jan 20, 2025
67dcfda
cell charger
warriorstar-orion Jan 20, 2025
3a23acf
fire alarm frame installation test
warriorstar-orion Jan 20, 2025
d48413b
funny and burz reviews
warriorstar-orion Jan 20, 2025
01adf5d
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 24, 2025
3199696
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 25, 2025
07d931d
nuke fixes
warriorstar-orion Jan 25, 2025
4cceb9d
Merge remote-tracking branch 'upstream/master' into attack-chain-migr…
warriorstar-orion Jan 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
617 changes: 617 additions & 0 deletions _maps/map_files/tests/test_attack_chain_machinery.dmm

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@

/proc/get_mobs_in_view(R, atom/source, include_clientless = FALSE)
// Returns a list of mobs in range of R from source. Used in radio and say code.
#ifdef GAME_TESTS
// kind of feels cleaner clobbering here than changing the loop?
include_clientless = TRUE
#endif

var/turf/T = get_turf(source)
var/list/hear = list()
Expand Down
1 change: 1 addition & 0 deletions code/game/area/misc_areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

/area/game_test
name = "Game Test Area"
requires_power = FALSE

//SYNDICATES

Expand Down
51 changes: 26 additions & 25 deletions code/game/dna/dna_modifier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,47 +190,47 @@
QDEL_LIST_CONTENTS(L.grabbed_by)
return TRUE

/obj/machinery/dna_scannernew/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(istype(I, /obj/item/reagent_containers/glass))
/obj/machinery/dna_scannernew/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/reagent_containers/glass))
if(beaker)
to_chat(user, "<span class='warning'>A beaker is already loaded into the machine.</span>")
return
return ITEM_INTERACT_COMPLETE

if(!user.drop_item())
to_chat(user, "<span class='warning'>\The [I] is stuck to you!</span>")
return
to_chat(user, "<span class='warning'>\The [used] is stuck to you!</span>")
return ITEM_INTERACT_COMPLETE

beaker = I
beaker = used
SStgui.update_uis(src)
I.forceMove(src)
user.visible_message("[user] adds \a [I] to \the [src]!", "You add \a [I] to \the [src]!")
return
used.forceMove(src)
user.visible_message("[user] adds \a [used] to \the [src]!", "You add \a [used] to \the [src]!")
return ITEM_INTERACT_COMPLETE

if(istype(I, /obj/item/grab))
var/obj/item/grab/G = I
if(istype(used, /obj/item/grab))
var/obj/item/grab/G = used
if(!ismob(G.affecting))
return
return ITEM_INTERACT_COMPLETE

if(occupant)
to_chat(user, "<span class='boldnotice'>The scanner is already occupied!</span>")
return
return ITEM_INTERACT_COMPLETE

if(G.affecting.abiotic())
to_chat(user, "<span class='boldnotice'>Subject may not hold anything in their hands.</span>")
return
return ITEM_INTERACT_COMPLETE

if(G.affecting.has_buckled_mobs()) //mob attached to us
to_chat(user, "<span class='warning'>[G] will not fit into [src] because [G.affecting.p_they()] [G.affecting.p_have()] a slime latched onto [G.affecting.p_their()] head.</span>")
return
return ITEM_INTERACT_COMPLETE

if(panel_open)
to_chat(usr, "<span class='boldnotice'>Close the maintenance panel first.</span>")
return
return ITEM_INTERACT_COMPLETE

put_in(G.affecting)
add_fingerprint(user)
qdel(G)
return
return ITEM_INTERACT_COMPLETE

return ..()

Expand Down Expand Up @@ -327,17 +327,18 @@
idle_power_consumption = 10
active_power_consumption = 400

/obj/machinery/computer/scan_consolenew/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(istype(I, /obj/item/disk/data)) //INSERT SOME diskS
/obj/machinery/computer/scan_consolenew/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/disk/data)) //INSERT SOME diskS
if(!disk)
user.drop_item()
I.forceMove(src)
disk = I
to_chat(user, "You insert [I].")
used.forceMove(src)
disk = used
to_chat(user, "You insert [used].")
SStgui.update_uis(src)
return
else
return ..()

return ITEM_INTERACT_COMPLETE

return ..()

/obj/machinery/computer/scan_consolenew/Initialize(mapload)
. = ..()
Expand Down
12 changes: 7 additions & 5 deletions code/game/gamemodes/miniantags/abduction/machinery/console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,15 @@
vest = V
return TRUE

/obj/machinery/abductor/console/attackby__legacy__attackchain(obj/O, mob/user, params)
if(istype(O, /obj/item/abductor/gizmo) && AddGizmo(O))
/obj/machinery/abductor/console/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/abductor/gizmo) && AddGizmo(used))
to_chat(user, "<span class='notice'>You link the tool to the console.</span>")
else if(istype(O, /obj/item/clothing/suit/armor/abductor/vest) && AddVest(O))
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/clothing/suit/armor/abductor/vest) && AddVest(used))
to_chat(user, "<span class='notice'>You link the vest to the console.</span>")
else
return ..()
return ITEM_INTERACT_COMPLETE

return ..()

/obj/machinery/abductor/console/proc/Dispense(item,cost=1)
if(experiment && experiment.credits >= cost)
Expand Down
15 changes: 8 additions & 7 deletions code/game/gamemodes/miniantags/abduction/machinery/dispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,17 @@
return
ui_interact(user)

/obj/machinery/abductor/gland_dispenser/attackby__legacy__attackchain(obj/item/W, mob/user, params)
if(istype(W, /obj/item/organ/internal/heart/gland))
/obj/machinery/abductor/gland_dispenser/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/organ/internal/heart/gland))
if(!user.drop_item())
return
W.forceMove(src)
return ITEM_INTERACT_COMPLETE
used.forceMove(src)
for(var/i in 1 to length(gland_colors))
if(gland_types[i] == W.type)
if(gland_types[i] == used.type)
amounts[i]++
else
return ..()
return ITEM_INTERACT_COMPLETE
warriorstar-orion marked this conversation as resolved.
Show resolved Hide resolved

return ..()

/obj/machinery/abductor/gland_dispenser/proc/Dispense(count)
if(amounts[count]>0)
Expand Down
19 changes: 10 additions & 9 deletions code/game/gamemodes/miniantags/abduction/machinery/experiment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,29 @@
H.clear_restraints()
return

/obj/machinery/abductor/experiment/attackby__legacy__attackchain(obj/item/G, mob/user)
if(istype(G, /obj/item/grab))
var/obj/item/grab/grabbed = G
/obj/machinery/abductor/experiment/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/grab))
var/obj/item/grab/grabbed = used
if(!ishuman(grabbed.affecting))
return
return ITEM_INTERACT_COMPLETE
if(isabductor(grabbed.affecting))
return
return ITEM_INTERACT_COMPLETE
if(occupant)
to_chat(user, "<span class='notice'>[src] is already occupied!</span>")
return
return ITEM_INTERACT_COMPLETE
if(grabbed.affecting.has_buckled_mobs()) //mob attached to us
to_chat(user, "<span class='warning'>[grabbed.affecting] will not fit into [src] because [grabbed.affecting.p_they()] [grabbed.affecting.p_have()] a slime latched onto [grabbed.affecting.p_their()] head.</span>")
return
return ITEM_INTERACT_COMPLETE
visible_message("<span class='notice'>[user] puts [grabbed.affecting] into [src].</span>")
var/mob/living/carbon/human/H = grabbed.affecting
H.forceMove(src)
occupant = H
flash = "Machine ready."
update_icon(UPDATE_ICON_STATE)
add_fingerprint(user)
qdel(G)
return
qdel(used)
return ITEM_INTERACT_COMPLETE

return ..()

/obj/machinery/abductor/experiment/ex_act(severity)
Expand Down
83 changes: 44 additions & 39 deletions code/game/gamemodes/nuclear/nuclearbomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,77 +168,78 @@ GLOBAL_VAR(bomb_set)
if(NUKE_CORE_FULLY_EXPOSED)
. += core ? "nukecore3" : "nukecore4"

/obj/machinery/nuclearbomb/attackby__legacy__attackchain(obj/item/O as obj, mob/user as mob, params)
if(istype(O, /obj/item/disk/nuclear))
/obj/machinery/nuclearbomb/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/disk/nuclear))
if(extended)
if(auth)
to_chat(user, "<span class='warning'>There's already a disk in the slot!</span>")
return
if((istype(O, /obj/item/disk/nuclear/training) && !training) || (training && !istype(O, /obj/item/disk/nuclear/training)))
to_chat(user, "<span class='warning'>[O] doesn't fit into [src]!</span>")
return
return ITEM_INTERACT_COMPLETE
if((istype(used, /obj/item/disk/nuclear/training) && !training) || (training && !istype(used, /obj/item/disk/nuclear/training)))
to_chat(user, "<span class='warning'>[used] doesn't fit into [src]!</span>")
return ITEM_INTERACT_COMPLETE
if(!user.drop_item())
to_chat(user, "<span class='notice'>[O] is stuck to your hand!</span>")
return
O.forceMove(src)
auth = O
to_chat(user, "<span class='notice'>[used] is stuck to your hand!</span>")
return ITEM_INTERACT_COMPLETE
used.forceMove(src)
auth = used
add_fingerprint(user)
return attack_hand(user)
attack_hand(user)
return ITEM_INTERACT_COMPLETE
else
to_chat(user, "<span class='notice'>You need to deploy [src] first.</span>")
return
if(istype(O, /obj/item/stack/sheet/mineral/titanium) && removal_stage == NUKE_CORE_FULLY_EXPOSED)
var/obj/item/stack/S = O
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/stack/sheet/mineral/titanium) && removal_stage == NUKE_CORE_FULLY_EXPOSED)
var/obj/item/stack/S = used
if(S.get_amount() < sheets_to_fix)
to_chat(user, "<span class='warning'>You need at least [sheets_to_fix] sheets of titanium to repair [src]'s inner core plate!</span>")
return
return ITEM_INTERACT_COMPLETE
if(do_after(user, 2 SECONDS, target = src))
if(!loc || !S || S.get_amount() < sheets_to_fix)
return
return ITEM_INTERACT_COMPLETE
S.use(sheets_to_fix)
user.visible_message("<span class='notice'>[user] repairs [src]'s inner core plate.</span>", \
"<span class='notice'>You repair [src]'s inner core plate. The radiation is contained.</span>")
removal_stage = NUKE_CORE_PANEL_UNWELDED
if(core)
STOP_PROCESSING(SSobj, core)
update_icon(UPDATE_OVERLAYS)
return
if(istype(O, /obj/item/stack/sheet/metal) && removal_stage == NUKE_CORE_PANEL_EXPOSED)
var/obj/item/stack/S = O
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/stack/sheet/metal) && removal_stage == NUKE_CORE_PANEL_EXPOSED)
var/obj/item/stack/S = used
if(S.get_amount() < sheets_to_fix)
to_chat(user, "<span class='warning'>You need at least [sheets_to_fix] sheets of metal to repair [src]'s outer core plate!</span>")
return
if(do_after(user, 2 SECONDS, target = src))
else if(do_after(user, 2 SECONDS, target = src))
if(!loc || !S || S.get_amount() < sheets_to_fix)
return
return ITEM_INTERACT_COMPLETE
S.use(sheets_to_fix)
user.visible_message("<span class='notice'>[user] repairs [src]'s outer core plate.</span>", \
"<span class='notice'>You repair [src]'s outer core plate.</span>")
removal_stage = NUKE_CORE_EVERYTHING_FINE
update_icon(UPDATE_OVERLAYS)
return
if(istype(O, /obj/item/nuke_core/plutonium) && removal_stage == NUKE_CORE_FULLY_EXPOSED)
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/nuke_core/plutonium) && removal_stage == NUKE_CORE_FULLY_EXPOSED)
if(do_after(user, 2 SECONDS, target = src))
if(!user.drop_item_to_ground(O))
to_chat(user, "<span class='notice'>The [O] is stuck to your hand!</span>")
if(!user.drop_item_to_ground(used))
to_chat(user, "<span class='notice'>The [used] is stuck to your hand!</span>")
return
user.visible_message("<span class='notice'>[user] puts [O] back in [src].</span>", "<span class='notice'>You put [O] back in [src].</span>")
O.forceMove(src)
core = O
user.visible_message("<span class='notice'>[user] puts [used] back in [src].</span>", "<span class='notice'>You put [used] back in [src].</span>")
used.forceMove(src)
core = used
update_icon(UPDATE_OVERLAYS)
return

if(istype(O, /obj/item/disk/plantgene))
return ITEM_INTERACT_COMPLETE

if(istype(used, /obj/item/disk/plantgene))
to_chat(user, "<span class='warning'>You try to plant the disk, but despite rooting around, it won't fit! After you branch out to read the instructions, you find out where the problem stems from. You've been bamboo-zled, this isn't a nuclear disk at all!</span>")
return
return ITEM_INTERACT_COMPLETE

else if(istype(O, /obj/item/disk))
if(O.icon_state == "datadisk4") //A similar green disk icon
else if(istype(used, /obj/item/disk))
if(used.icon_state == "datadisk4") //A similar green disk icon
to_chat(user, "<span class='warning'>You try to slot in the disk, but it won't fit! This isn't the NAD! If only you'd read the label...</span>")
return
return ITEM_INTERACT_COMPLETE
else
to_chat(user, "<span class='warning'>You try to slot in the disk, but it won't fit. This isn't the NAD! It's not even the right colour...</span>")
return
return ITEM_INTERACT_COMPLETE

return ..()

Expand Down Expand Up @@ -386,20 +387,24 @@ GLOBAL_VAR(bomb_set)

/obj/machinery/nuclearbomb/attack_hand(mob/user as mob)
if(!panel_open)
return ui_interact(user)
ui_interact(user)
return FINISH_ATTACK
if(!Adjacent(user))
return
if(removal_stage != NUKE_CORE_FULLY_EXPOSED || !core)
return wires.Interact(user)
wires.Interact(user)
return FINISH_ATTACK
if(timing) //removing the core is less risk then cutting wires, and doesnt take long, so we should not let crew do it while the nuke is armed. You can however get to it, without the special screwdriver, if you put the NAD in.
to_chat(user, "<span class='warning'>[core] won't budge, metal clamps keep it in!</span>")
return
return FINISH_ATTACK
user.visible_message("<span class='notice'>[user] starts to pull [core] out of [src]!</span>", "<span class='notice'>You start to pull [core] out of [src]!</span>")
if(do_after(user, 5 SECONDS, target = src))
user.visible_message("<span class='notice'>[user] pulls [core] out of [src]!</span>", "<span class='notice'>You pull [core] out of [src]! Might want to put it somewhere safe.</span>")
core.forceMove(loc)
core = null

update_icon(UPDATE_OVERLAYS)
return FINISH_ATTACK

/obj/machinery/nuclearbomb/ui_state(mob/user)
return GLOB.physical_state
Expand Down
13 changes: 7 additions & 6 deletions code/game/machinery/PDApainter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@
storedpda = null
update_icon()

/obj/machinery/pdapainter/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(default_unfasten_wrench(user, I))
/obj/machinery/pdapainter/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(default_unfasten_wrench(user, used))
power_change()
return
if(istype(I, /obj/item/pda))
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/pda))
insertpda(user)
else
return ..()
return ITEM_INTERACT_COMPLETE

return ..()

/obj/machinery/pdapainter/welder_act(mob/user, obj/item/I)
. = TRUE
Expand Down
Loading
Loading