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

migrates /obj/effect to the new attack chain #28066

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions code/datums/spells/spacetime_dist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@
if(!cant_teleport)
walk_link(entered)

/obj/effect/cross_action/spacetime_dist/attackby__legacy__attackchain(obj/item/W, mob/user, params)
if(user.drop_item(W))
walk_link(W)
/obj/effect/cross_action/spacetime_dist/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(user.drop_item(used))
walk_link(used)
else
walk_link(user)
return ITEM_INTERACT_COMPLETE

//ATTACK HAND IGNORING PARENT RETURN VALUE
/obj/effect/cross_action/spacetime_dist/attack_hand(mob/user, list/modifiers)
Expand Down
9 changes: 4 additions & 5 deletions code/game/gamemodes/cult/cult_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -811,13 +811,12 @@
if(target)
exit = new /obj/effect/cult_portal_exit(target)

/obj/effect/portal/cult/attackby__legacy__attackchain(obj/I, mob/user, params)
if(istype(I, /obj/item/melee/cultblade/dagger) && IS_CULTIST(user) || istype(I, /obj/item/nullrod) && HAS_MIND_TRAIT(user, TRAIT_HOLY))
to_chat(user, "<span class='notice'>You close the portal with your [I].</span>")
/obj/effect/portal/cult/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/melee/cultblade/dagger) && IS_CULTIST(user) || istype(used, /obj/item/nullrod) && HAS_MIND_TRAIT(user, TRAIT_HOLY))
to_chat(user, "<span class='notice'>You close the portal with your [used].</span>")
playsound(src, 'sound/magic/magic_missile.ogg', 100, TRUE)
qdel(src)
return
return ..()
return ITEM_INTERACT_COMPLETE

/obj/effect/portal/cult/Destroy()
QDEL_NULL(exit)
Expand Down
39 changes: 20 additions & 19 deletions code/game/gamemodes/cult/runes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,28 @@ To draw a rune, use a ritual dagger.
if(req_keyword && keyword)
. += "<b>Keyword:</b> <span class='cultitalic'>[keyword]</span>"

/obj/effect/rune/attackby__legacy__attackchain(obj/I, mob/user, params)
if(istype(I, /obj/item/melee/cultblade/dagger) && IS_CULTIST(user))
/obj/effect/rune/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/melee/cultblade/dagger) && IS_CULTIST(user))
if(!can_dagger_erase_rune(user))
return
return ITEM_INTERACT_COMPLETE

var/obj/item/melee/cultblade/dagger/D = I
user.visible_message("<span class='warning'>[user] begins to erase [src] with [I].</span>")
if(do_after(user, initial(scribe_delay) * D.scribe_multiplier, target = src))
var/obj/item/melee/cultblade/dagger/dagger = used
user.visible_message("<span class='warning'>[user] begins to erase [src] with [dagger].</span>")
if(do_after(user, initial(scribe_delay) * dagger.scribe_multiplier, target = src))
to_chat(user, "<span class='notice'>You carefully erase the [lowertext(cultist_name)] rune.</span>")
qdel(src)
return
if(istype(I, /obj/item/nullrod))
if(IS_CULTIST(user))//cultist..what are doing..cultist..staph...
return ITEM_INTERACT_COMPLETE

if(istype(used, /obj/item/nullrod))
var/obj/item/nullrod/nullrod = used
if(IS_CULTIST(user)) // cultist..what are doing..cultist..staph...
user.drop_item()
user.visible_message("<span class='warning'>[I] suddenly glows with a white light, forcing [user] to drop it in pain!</span>", \
"<span class='danger'>[I] suddenly glows with a white light that sears your hand, forcing you to drop it!</span>") // TODO: Make this actually burn your hand
return
to_chat(user,"<span class='danger'>You disrupt the magic of [src] with [I].</span>")
user.visible_message("<span class='warning'>[nullrod] suddenly glows with a white light, forcing [user] to drop it in pain!</span>", \
"<span class='danger'>[nullrod] suddenly glows with a white light that sears your hand, forcing you to drop it!</span>") // TODO: Make this actually burn your hand
return ITEM_INTERACT_COMPLETE
to_chat(user,"<span class='danger'>You disrupt the magic of [src] with [nullrod].</span>")
qdel(src)
return
return ..()
return ITEM_INTERACT_COMPLETE

/obj/effect/rune/proc/can_dagger_erase_rune(mob/user)
return TRUE
Expand Down Expand Up @@ -1097,11 +1098,11 @@ structure_check() searches for nearby cultist structures required for the invoca
sleep(40)
new /obj/singularity/narsie/large(T) //Causes Nar'Sie to spawn even if the rune has been removed

/obj/effect/rune/narsie/attackby__legacy__attackchain(obj/I, mob/user, params) //Since the narsie rune takes a long time to make, add logging to removal.
if((istype(I, /obj/item/melee/cultblade/dagger) && IS_CULTIST(user)))
/obj/effect/rune/narsie/item_interaction(mob/living/user, obj/item/used, list/modifiers)
..()
if((istype(used, /obj/item/melee/cultblade/dagger) && IS_CULTIST(user)))
log_game("Summon Narsie rune erased by [key_name(user)] with a cult dagger")
message_admins("[key_name_admin(user)] erased a Narsie rune with a cult dagger")
if(istype(I, /obj/item/nullrod)) //Begone foul magiks. You cannot hinder me.
if(istype(used, /obj/item/nullrod)) //Begone foul magiks. You cannot hinder me.
log_game("Summon Narsie rune erased by [key_name(user)] using a null rod")
message_admins("[key_name_admin(user)] erased a Narsie rune with a null rod")
return ..()
11 changes: 7 additions & 4 deletions code/game/gamemodes/miniantags/guardian/types/protector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,13 @@
P.on_hit(src, 0)
return FALSE

/obj/effect/guardianshield/attacked_by__legacy__attackchain(obj/item/I, mob/living/user)
if(I.force)
user.visible_message("<span class='danger'>[user] has hit [src] with [I]!</span>", "<span class='danger'>You hit [src] with [I]!</span>")
linked_guardian.apply_damage(I.force, I.damtype)
/obj/effect/guardianshield/attack_by(obj/item/attacking, mob/user, params)
if(..() || !attacking.force)
return FINISH_ATTACK

user.visible_message("<span class='danger'>[user] has hit [src] with [attacking]!</span>", "<span class='danger'>You hit [src] with [attacking]!</span>")
linked_guardian.apply_damage(attacking.force, attacking.damtype)
return FINISH_ATTACK

/obj/effect/guardianshield/Destroy()
linked_guardian = null
Expand Down
9 changes: 4 additions & 5 deletions code/game/gamemodes/wizard/artefact.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,11 @@
if(spawn_amt_left <= 0)
qdel(src)

/obj/effect/rend/attackby__legacy__attackchain(obj/item/I as obj, mob/user as mob)
if(istype(I, /obj/item/nullrod))
user.visible_message("<span class='danger'>[user] seals \the [src] with \the [I].</span>")
/obj/effect/rend/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/nullrod))
user.visible_message("<span class='danger'>[user] seals \the [src] with \the [used].</span>")
qdel(src)
return
return ..()
return ITEM_INTERACT_COMPLETE

/obj/effect/rend/singularity_pull()
return
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/effects/anomalies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@
// Else, anomaly core gets deleted by qdel(src).
qdel(src)

/obj/effect/anomaly/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(istype(I, /obj/item/analyzer))
/obj/effect/anomaly/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/analyzer))
to_chat(user, "<span class='notice'>Analyzing... [src]'s unstable field is fluctuating along frequency [format_frequency(aSignal.frequency)], code [aSignal.code].</span>")
return ITEM_INTERACT_COMPLETE

/obj/effect/anomaly/grav
name = "gravitational anomaly"
Expand Down
14 changes: 8 additions & 6 deletions code/game/objects/effects/decals/Cleanable/tar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
playsound(L, 'sound/effects/attackblob.ogg', 50, TRUE)
to_chat(L, "<span class='userdanger'>[src] sticks to you!</span>")

/obj/effect/decal/cleanable/tar/attackby__legacy__attackchain(obj/item/welder, mob/living/user, params)
if(!welder.get_heat() || !Adjacent(user))
return
playsound(welder, 'sound/items/welder.ogg', 50, TRUE)
/obj/effect/decal/cleanable/tar/item_interaction(mob/living/user, obj/item/used, list/modifiers)
var/obj/item/weldingtool/fire_tool = used
if(!fire_tool.get_heat() || !Adjacent(user))
return ITEM_INTERACT_COMPLETE
playsound(fire_tool, 'sound/items/welder.ogg', 50, TRUE)
if(do_after(user, 3 SECONDS, FALSE, user))
if(welder.get_heat() && Adjacent(user))
user.visible_message("<span class='danger'>[user] burns away [src] with [welder]!</span>", "<span class='danger'>You burn away [src]!</span>")
if(fire_tool.get_heat() && Adjacent(user))
user.visible_message("<span class='danger'>[user] burns away [src] with [fire_tool]!</span>", "<span class='danger'>You burn away [src]!</span>")
qdel(src)
return ITEM_INTERACT_COMPLETE
11 changes: 7 additions & 4 deletions code/game/objects/effects/effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
move_resist = INFINITY
anchored = TRUE
can_be_hit = FALSE
new_attack_chain = TRUE

/obj/effect/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir)
return
Expand Down Expand Up @@ -103,11 +104,13 @@
if(desc)
. += desc

/obj/effect/decal/attackby__legacy__attackchain(obj/item/I, mob/user)
if(istype(I, /obj/item/reagent_containers/glass) || istype(I, /obj/item/reagent_containers/drinks))
scoop(I, user)
/obj/effect/decal/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/reagent_containers/glass) || istype(used, /obj/item/reagent_containers/drinks))
scoop(used, user)
return ITEM_INTERACT_COMPLETE
else if(issimulatedturf(loc))
I.melee_attack_chain(user, loc)
used.melee_attack_chain(user, loc)
return ITEM_INTERACT_COMPLETE

/obj/effect/decal/attack_animal(mob/living/simple_animal/M)
if(issimulatedturf(loc))
Expand Down
7 changes: 3 additions & 4 deletions code/game/objects/effects/meteors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,11 @@ GLOBAL_LIST_INIT(meteors_gore, list(/obj/effect/meteor/meaty = 5, /obj/effect/me
/obj/effect/meteor/ex_act()
return

/obj/effect/meteor/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(istype(I, /obj/item/pickaxe))
/obj/effect/meteor/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/pickaxe))
make_debris()
qdel(src)
return
return ..()
return ITEM_INTERACT_COMPLETE

/obj/effect/meteor/proc/make_debris()
for(var/throws = dropamt, throws > 0, throws--)
Expand Down
18 changes: 8 additions & 10 deletions code/game/objects/effects/snowcloud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,15 @@
user.put_in_hands(SB)
to_chat(user, "<span class='notice'>You scoop up some snow and make \a [SB]!</span>")

/obj/effect/snow/attackby__legacy__attackchain(obj/item/I, mob/user)
if(istype(I, /obj/item/shovel))
var/obj/item/shovel/S = I
/obj/effect/snow/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/shovel))
var/obj/item/shovel/shovel = used
user.visible_message("<span class='notice'>[user] is clearing away [src]...</span>", "<span class='notice'>You begin clearing away [src]...</span>", "<span class='warning'>You hear a wettish digging sound.</span>")
playsound(loc, S.usesound, 50, TRUE)
if(!do_after(user, 50 * S.toolspeed, target = src))
return
user.visible_message("<span class='notice'>[user] clears away [src]!</span>", "<span class='notice'>You clear away [src]!</span>")
qdel(src)
else
return ..()
playsound(loc, shovel.usesound, 50, TRUE)
if(do_after(user, 50 * shovel.toolspeed, target = src))
user.visible_message("<span class='notice'>[user] clears away [src]!</span>", "<span class='notice'>You clear away [src]!</span>")
qdel(src)
return ITEM_INTERACT_COMPLETE

/obj/effect/snow/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume, global_overlay = TRUE)
..()
Expand Down
18 changes: 10 additions & 8 deletions code/game/objects/items/devices/chameleonproj.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@
master = C
master.active_dummy = src

/obj/effect/dummy/chameleon/attackby__legacy__attackchain()
for(var/mob/M in src)
/obj/effect/dummy/chameleon/attack_by(obj/item/attacking, mob/user, params)
if(..())
return FINISH_ATTACK
for(var/mob/M in src)
to_chat(M, "<span class='danger'>Your [src] deactivates.</span>")
master.disrupt()

Expand Down Expand Up @@ -186,8 +188,8 @@
item_state = "electronic"
w_class = WEIGHT_CLASS_SMALL
var/active = FALSE
var/activationCost = 300
var/activationUpkeep = 50
var/activation_cost = 300
var/activation_upkeep = 50
var/image/disguise
var/mob/living/silicon/robot/syndicate/saboteur/S

Expand All @@ -205,13 +207,13 @@
disrupt(user)

/obj/item/borg_chameleon/attack_self__legacy__attackchain(mob/living/silicon/robot/syndicate/saboteur/user)
if(user && user.cell && user.cell.charge > activationCost)
if(user && user.cell && user.cell.charge > activation_cost)
if(isturf(user.loc))
toggle(user)
else
to_chat(user, "<span class='warning'>You can't use [src] while inside something!</span>")
else
to_chat(user, "<span class='warning'>You need at least [activationCost] charge in your cell to use [src]!</span>")
to_chat(user, "<span class='warning'>You need at least [activation_cost] charge in your cell to use [src]!</span>")

/obj/item/borg_chameleon/proc/toggle(mob/living/silicon/robot/syndicate/saboteur/user)
if(active)
Expand All @@ -220,7 +222,7 @@
return
to_chat(user, "<span class='notice'>You activate [src].</span>")
apply_wibbly_filters(user)
if(do_after(user, 5 SECONDS, target = user) && user.cell.use(activationCost))
if(do_after(user, 5 SECONDS, target = user) && user.cell.use(activation_cost))
activate(user)
else
to_chat(user, "<span class='warning'>The chameleon field fizzles.</span>")
Expand All @@ -229,7 +231,7 @@

/obj/item/borg_chameleon/process()
if(S)
if(!S.cell || !S.cell.use(activationUpkeep))
if(!S.cell || !S.cell.use(activation_upkeep))
disrupt(S)
return
return PROCESS_KILL
Expand Down
11 changes: 4 additions & 7 deletions code/game/objects/items/weapons/gift_wrappaper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,16 @@
return
to_chat(user, "<span class='notice'>You can't move.</span>")

/obj/effect/spresent/attackby__legacy__attackchain(obj/item/W as obj, mob/user as mob, params)
..()

if(!istype(W, /obj/item/wirecutters))
/obj/effect/spresent/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(!istype(used, /obj/item/wirecutters))
to_chat(user, "<span class='notice'>I need wirecutters for that.</span>")
return
return ITEM_INTERACT_COMPLETE

to_chat(user, "<span class='notice'>You cut open the present.</span>")

for(var/mob/M in src) //Should only be one but whatever.
M.forceMove(loc)

qdel(src)
return ITEM_INTERACT_COMPLETE

/obj/item/a_gift/attack_self__legacy__attackchain(mob/M as mob)
var/gift_type = pick(
Expand Down
8 changes: 3 additions & 5 deletions code/game/objects/items/weapons/mop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@
reagents.reaction(T, REAGENT_TOUCH, 10) //10 is the multiplier for the reaction effect. probably needed to wet the floor properly.
reagents.remove_any(1) //reaction() doesn't use up the reagents

/obj/effect/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(istype(I, /obj/item/mop) || istype(I, /obj/item/soap))
return
else
return ..()
/obj/effect/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/mop) || istype(used, /obj/item/soap))
return ITEM_INTERACT_COMPLETE

/obj/item/mop/wash(mob/user, atom/source)
reagents.add_reagent("water", 5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,13 @@
create(ckey = user.ckey, name = user.real_name)
user.death()

/obj/effect/mob_spawn/human/alive/golem/attackby__legacy__attackchain(obj/item/I, mob/living/carbon/user, params)
if(!istype(I, /obj/item/slimepotion/transference))
return ..()
if(iscarbon(user) && can_transfer)
/obj/effect/mob_spawn/human/alive/golem/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/slimepotion/transference) && iscarbon(user) && can_transfer)
var/human_transfer_choice = tgui_alert(user, "Transfer your soul to [src]? (Warning, your old body will die!)", "Respawn", list("Yes", "No"))
if(human_transfer_choice != "Yes")
return
if(QDELETED(src) || uses <= 0 || user.stat >= 1 || QDELETED(I))
return
handle_becoming_golem(I, user)
if(human_transfer_choice != "Yes" || QDELETED(src) || uses <= 0 || user.stat >= 1 || QDELETED(used))
return ITEM_INTERACT_COMPLETE
handle_becoming_golem(used, user)
return ITEM_INTERACT_COMPLETE

/obj/effect/mob_spawn/human/alive/golem/proc/handle_becoming_golem(obj/item/I, mob/living/carbon/user)
if(isgolem(user) && can_transfer)
Expand Down
10 changes: 5 additions & 5 deletions code/modules/hallucinations/effects/major.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@
target.visible_message("<span class='warning'>[target] trips over nothing.</span>",
"<span class='userdanger'>You get stuck in [src]!</span>")

/obj/effect/hallucination/tripper/spider_web/attackby__legacy__attackchain(obj/item/I, mob/user, params)
/obj/effect/hallucination/tripper/spider_web/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(user != target)
return

return ITEM_INTERACT_COMPLETE
step_towards(target, get_turf(src))
target.Weaken(4 SECONDS)
target.visible_message("<span class='warning'>[target] flails [target.p_their()] [I.name] as if striking something, only to trip!</span>",
"<span class='userdanger'>[src] vanishes as you strike it with [I], causing you to stumble forward!</span>")
target.visible_message("<span class='warning'>[target] flails [target.p_their()] [used.name] as if striking something, only to trip!</span>",
"<span class='userdanger'>[src] vanishes as you strike it with [used], causing you to stumble forward!</span>")
qdel(src)
return ITEM_INTERACT_COMPLETE

/**
* # Hallucination - Abduction
Expand Down
3 changes: 0 additions & 3 deletions code/modules/mining/lavaland/loot/tendril_loot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,6 @@
. = ..()
ADD_TRAIT(src, TRAIT_EFFECT_CAN_TELEPORT, ROUNDSTART_TRAIT)

/obj/effect/immortality_talisman/attackby__legacy__attackchain()
return

/obj/effect/immortality_talisman/ex_act()
return

Expand Down
Loading
Loading