Skip to content

Commit

Permalink
[MIRROR] Yeets ATTACK_QDELETED, fixes welding torches not using fue…
Browse files Browse the repository at this point in the history
…l on attacking non-mobs (2 year old bug) (#2030)

* Yeets `ATTACK_QDELETED`, fixes welding torches not using fuel on attacking non-mobs (2 year old bug)  (#82694)

## About The Pull Request

- Deletes `ATTACK_QDELETED`
- May have been necessary in the past but it's pointless now. All it
does is clutter the attack chain. Perish.

- Fixes welders not using fuel on attacking non-mobs
- #65762 "fixed" welders consuming fuel on clicking turfs by adding an
`isliving` check and not an `ismovable` check?


## Changelog

:cl: Melbert
fix: Blobs may rejoice, welding torches now consume fuel when attacking
objects again after two years.
/:cl:

* Yeets `ATTACK_QDELETED`, fixes welding torches not using fuel on attacking non-mobs (2 year old bug)

* Electric welders are hot too now. Starting fires is definitely in their wheelhouse

---------

Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: Mal <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Apr 17, 2024
1 parent 8bced08 commit 5163217
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 39 deletions.
2 changes: 0 additions & 2 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@
#define COMSIG_MOB_ITEM_AFTERATTACK "mob_item_afterattack"
///from base of obj/item/afterattack_secondary(): (atom/target, obj/item/weapon, proximity_flag, click_parameters)
#define COMSIG_MOB_ITEM_AFTERATTACK_SECONDARY "mob_item_afterattack_secondary"
///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, proximity_flag, click_parameters)
#define COMSIG_MOB_ITEM_ATTACK_QDELETED "mob_item_attack_qdeleted"
///from base of mob/RangedAttack(): (atom/A, modifiers)
#define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged"
///from base of mob/ranged_secondary_attack(): (atom/target, modifiers)
Expand Down
2 changes: 0 additions & 2 deletions code/__DEFINES/dcs/signals/signals_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,6 @@
#define COMPONENT_AFTERATTACK_PROCESSED_ITEM (1<<0)
///from base of obj/item/afterattack_secondary(): (atom/target, mob/user, proximity_flag, click_parameters)
#define COMSIG_ITEM_AFTERATTACK_SECONDARY "item_afterattack_secondary"
///from base of obj/item/attack_qdeleted(): (atom/target, mob/user, params)
#define COMSIG_ITEM_ATTACK_QDELETED "item_attack_qdeleted"
///from base of obj/item/embedded(): (atom/target, obj/item/bodypart/part)
#define COMSIG_ITEM_EMBEDDED "item_embedded"
///from base of datum/component/embedded/safeRemove(): (mob/living/carbon/victim)
Expand Down
9 changes: 0 additions & 9 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
if (attackby_result)
return TRUE

if(QDELETED(src) || QDELETED(target))
attack_qdeleted(target, user, TRUE, params)
return TRUE

if (is_right_clicking)
var/after_attack_secondary_result = afterattack_secondary(target, user, TRUE, params)

Expand Down Expand Up @@ -472,11 +468,6 @@

return SECONDARY_ATTACK_CALL_NORMAL

/// Called if the target gets deleted by our attack
/obj/item/proc/attack_qdeleted(atom/target, mob/user, proximity_flag, click_parameters)
SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_QDELETED, target, user, proximity_flag, click_parameters)
SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK_QDELETED, target, user, proximity_flag, click_parameters)

/obj/item/proc/get_clamped_volume()
if(w_class)
if(force)
Expand Down
26 changes: 4 additions & 22 deletions code/game/objects/items/tools/weldingtool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@
if(!proximity)
return

if(isOn())
if(isOn() && ismovable(attacked_atom))
use(1)
var/turf/location = get_turf(user)
location.hotspot_expose(700, 50, 1)
. |= AFTERATTACK_PROCESSED_ITEM
if (!QDELETED(attacked_atom) && isliving(attacked_atom)) // can't ignite something that doesn't exist
handle_fuel_and_temps(1, user)
var/mob/living/attacked_mob = attacked_atom
if(attacked_mob.ignite_mob())
message_admins("[ADMIN_LOOKUPFLW(user)] set [key_name_admin(attacked_mob)] on fire with [src] at [AREACOORD(user)]")
Expand All @@ -184,21 +186,6 @@

return .

/obj/item/weldingtool/attack_qdeleted(atom/attacked_atom, mob/user, proximity)
. = ..()
if(!proximity)
return

if(isOn())
handle_fuel_and_temps(1, user)

if(!QDELETED(attacked_atom) && isliving(attacked_atom)) // can't ignite something that doesn't exist
var/mob/living/attacked_mob = attacked_atom
if(attacked_mob.ignite_mob())
message_admins("[ADMIN_LOOKUPFLW(user)] set [key_name_admin(attacked_mob)] on fire with [src] at [AREACOORD(user)].")
user.log_message("set [key_name(attacked_mob)] on fire with [src]", LOG_ATTACK)


/obj/item/weldingtool/attack_self(mob/user)
if(src.reagents.has_reagent(/datum/reagent/toxin/plasma))
message_admins("[ADMIN_LOOKUPFLW(user)] activated a rigged welder at [AREACOORD(user)].")
Expand All @@ -208,11 +195,6 @@

update_appearance()

/obj/item/weldingtool/proc/handle_fuel_and_temps(used = 0, mob/living/user)
use(used)
var/turf/location = get_turf(user)
location.hotspot_expose(700, 50, 1)

/// Returns the amount of fuel in the welder
/obj/item/weldingtool/proc/get_fuel()
return reagents.get_reagent_amount(/datum/reagent/fuel)
Expand Down
1 change: 1 addition & 0 deletions code/modules/unit_tests/_unit_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
#include "closets.dm"
#include "clothing_under_armor_subtype_check.dm"
#include "combat.dm"
#include "combat_welder.dm"
#include "component_tests.dm"
#include "confusion.dm"
#include "connect_loc.dm"
Expand Down
26 changes: 26 additions & 0 deletions code/modules/unit_tests/combat_welder.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/datum/unit_test/welder_combat

/datum/unit_test/welder_combat/Run()
var/mob/living/carbon/human/tider = allocate(__IMPLIED_TYPE__, run_loc_floor_bottom_left)
var/mob/living/carbon/human/victim = allocate(__IMPLIED_TYPE__, run_loc_floor_bottom_left)
var/obj/item/weldingtool/weapon = allocate(__IMPLIED_TYPE__, run_loc_floor_bottom_left)

tider.put_in_active_hand(weapon, forced = TRUE)
tider.set_combat_mode(TRUE)
weapon.attack_self(tider)
weapon.melee_attack_chain(tider, victim)

TEST_ASSERT_NOTEQUAL(victim.getFireLoss(), 0, "Victim did not get burned by welder.")
TEST_ASSERT_EQUAL(weapon.get_fuel(), weapon.max_fuel - 1, "Welder did not consume fuel on attacking a mob")

var/obj/structure/blob/blobby = allocate(__IMPLIED_TYPE__, run_loc_floor_bottom_left)
weapon.melee_attack_chain(tider, blobby)

TEST_ASSERT_NOTEQUAL(blobby.get_integrity(), blobby.max_integrity, "Blob did not get burned by welder.")
TEST_ASSERT_EQUAL(weapon.get_fuel(), weapon.max_fuel - 2, "Welder did not consume fuel on attacking a blob")

weapon.force = 999
weapon.melee_attack_chain(tider, blobby)

TEST_ASSERT(QDELETED(blobby), "Blob was not destroyed by welder.")
TEST_ASSERT_EQUAL(weapon.get_fuel(), weapon.max_fuel - 3, "Welder did not consume fuel on deleting a blob")
4 changes: 0 additions & 4 deletions modular_nova/modules/electric_welder/code/electric_welder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@
/obj/item/weldingtool/electric/use(used = 0)
return isOn()

// This is what starts fires. Overriding it stops it starting fires
/obj/item/weldingtool/electric/handle_fuel_and_temps(used = 0, mob/living/user)
return

/obj/item/weldingtool/electric/examine()
. = ..()
. += "[src] is currently [powered ? "powered" : "unpowered"]."
Expand Down

0 comments on commit 5163217

Please sign in to comment.