From 9e7bb4b09eab17471e00e4ed520cc6e1957483a6 Mon Sep 17 00:00:00 2001 From: thgvr Date: Thu, 29 Feb 2024 02:16:39 -0800 Subject: [PATCH 1/5] Edits gun.dm Brings back old suicide_act on handle_suicide proc of guns. --- code/modules/projectiles/gun.dm | 44 +++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index f6470af9a846..011a12b5a57b 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -740,6 +740,9 @@ safety_overlay.icon_state = "safety-off" . += safety_overlay +#define BRAINS_BLOWN_THROW_RANGE 2 +#define BRAINS_BLOWN_THROW_SPEED 1 + /obj/item/gun/proc/handle_suicide(mob/living/carbon/human/user, mob/living/carbon/human/target, params, bypass_timer) if(!ishuman(user) || !ishuman(target)) return @@ -747,32 +750,47 @@ if(semicd) return + if(!can_shoot()) //Just because you can pull the trigger doesn't mean it can shoot. + shoot_with_empty_chamber(user) + return + if(user == target) - target.visible_message("[user] sticks [src] in [user.p_their()] mouth, ready to pull the trigger...", \ - "You stick [src] in your mouth, ready to pull the trigger...") + target.visible_message(span_warning("[user] sticks [src] in [user.p_their()] mouth, ready to pull the trigger..."), \ + span_userdanger("You stick [src] in your mouth, ready to pull the trigger...")) else - target.visible_message("[user] points [src] at [target]'s head, ready to pull the trigger...", \ - "[user] points [src] at your head, ready to pull the trigger...") + target.visible_message(span_warning("[user] points [src] at [target]'s head, ready to pull the trigger..."), \ + span_userdanger("[user] points [src] at your head, ready to pull the trigger...")) semicd = TRUE - if(!bypass_timer && (!do_mob(user, target, 120) || user.zone_selected != BODY_ZONE_PRECISE_MOUTH)) + if(!bypass_timer && (!do_mob(user, target, 100) || user.zone_selected != BODY_ZONE_PRECISE_MOUTH)) if(user) if(user == target) - user.visible_message("[user] decided not to shoot.") + user.visible_message(span_notice("[user] decided not to shoot.")) else if(target && target.Adjacent(user)) - target.visible_message("[user] has decided to spare [target]", "[user] has decided to spare your life!") + target.visible_message(span_notice("[user] has decided to spare [target]."), span_notice("[user] has decided to spare your life!")) semicd = FALSE return semicd = FALSE - target.visible_message("[user] pulls the trigger!", "[(user == target) ? "You pull" : "[user] pulls"] the trigger!") - - if(chambered && chambered.BB) - chambered.BB.damage *= 5 - - process_fire(target, user, TRUE, params, BODY_ZONE_HEAD) + target.visible_message(span_warning("[user] pulls the trigger!"), span_userdanger("[(user == target) ? "You pull" : "[user] pulls"] the trigger!")) + + //Sort of reimplements old suicide behavior just for guns. + var/obj/item/organ/brain/shotbrain = target.getorganslot(ORGAN_SLOT_BRAIN) + if(chambered?.BB) + var/turf/splat_turf = get_turf(target) + var/turf/splat_target = get_ranged_target_turf(target, REVERSE_DIR(target.dir), BRAINS_BLOWN_THROW_RANGE) + chambered.BB.damage *= 4 + process_fire(target, user, TRUE, params, BODY_ZONE_HEAD) + if(shotbrain && chambered.BB.damage > 0) + var/datum/callback/gibspawner = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_atom_to_turf), /obj/effect/gibspawner/generic, shotbrain, 1, FALSE, target) + shotbrain.Remove(target) + shotbrain.forceMove(splat_turf) + shotbrain.throw_at(splat_target, BRAINS_BLOWN_THROW_RANGE, BRAINS_BLOWN_THROW_SPEED, callback = gibspawner) + +#undef BRAINS_BLOWN_THROW_RANGE +#undef BRAINS_BLOWN_THROW_SPEED /obj/item/gun/proc/unlock() //used in summon guns and as a convience for admins if(pin) From 73952c7cb4a95df5106e8113ca9276301422bb84 Mon Sep 17 00:00:00 2001 From: thgvr Date: Thu, 29 Feb 2024 03:48:58 -0800 Subject: [PATCH 2/5] Edits gun.dm --- code/modules/projectiles/gun.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 011a12b5a57b..afd0e38618c8 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -777,13 +777,13 @@ target.visible_message(span_warning("[user] pulls the trigger!"), span_userdanger("[(user == target) ? "You pull" : "[user] pulls"] the trigger!")) //Sort of reimplements old suicide behavior just for guns. - var/obj/item/organ/brain/shotbrain = target.getorganslot(ORGAN_SLOT_BRAIN) if(chambered?.BB) - var/turf/splat_turf = get_turf(target) - var/turf/splat_target = get_ranged_target_turf(target, REVERSE_DIR(target.dir), BRAINS_BLOWN_THROW_RANGE) chambered.BB.damage *= 4 process_fire(target, user, TRUE, params, BODY_ZONE_HEAD) if(shotbrain && chambered.BB.damage > 0) + var/obj/item/organ/brain/shotbrain = target.getorganslot(ORGAN_SLOT_BRAIN) + var/turf/splat_turf = get_turf(target) + var/turf/splat_target = get_ranged_target_turf(target, REVERSE_DIR(target.dir), BRAINS_BLOWN_THROW_RANGE) var/datum/callback/gibspawner = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_atom_to_turf), /obj/effect/gibspawner/generic, shotbrain, 1, FALSE, target) shotbrain.Remove(target) shotbrain.forceMove(splat_turf) From 09b5be7551aa1d60c1f8bd3a513cb4cbe5d1f39a Mon Sep 17 00:00:00 2001 From: thgvr Date: Thu, 29 Feb 2024 09:44:26 -0800 Subject: [PATCH 3/5] Edits gun.dm --- code/modules/projectiles/gun.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index afd0e38618c8..20bfc7d3f651 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -780,8 +780,8 @@ if(chambered?.BB) chambered.BB.damage *= 4 process_fire(target, user, TRUE, params, BODY_ZONE_HEAD) + var/obj/item/organ/brain/shotbrain = target.getorganslot(ORGAN_SLOT_BRAIN) if(shotbrain && chambered.BB.damage > 0) - var/obj/item/organ/brain/shotbrain = target.getorganslot(ORGAN_SLOT_BRAIN) var/turf/splat_turf = get_turf(target) var/turf/splat_target = get_ranged_target_turf(target, REVERSE_DIR(target.dir), BRAINS_BLOWN_THROW_RANGE) var/datum/callback/gibspawner = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_atom_to_turf), /obj/effect/gibspawner/generic, shotbrain, 1, FALSE, target) From 69117f823ed2ff0ef617773a1b288e51461ef61b Mon Sep 17 00:00:00 2001 From: thgvr Date: Sat, 30 Mar 2024 06:22:57 -0700 Subject: [PATCH 4/5] a --- code/modules/projectiles/gun.dm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 20bfc7d3f651..bd9e79d00470 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -776,18 +776,17 @@ target.visible_message(span_warning("[user] pulls the trigger!"), span_userdanger("[(user == target) ? "You pull" : "[user] pulls"] the trigger!")) - //Sort of reimplements old suicide behavior just for guns. - if(chambered?.BB) + // Check if the gun is usable, a round is chambered, and if the chambered round's projectile has damage + var/obj/item/organ/brain/brain_to_blast = target.getorganslot(ORGAN_SLOT_BRAIN) + if(chambered?.BB && brain_to_blast && can_trigger_gun(user) && chambered.BB.damage > 0) + var/turf/splat_turf = get_turf(target) + var/turf/splat_target = get_ranged_target_turf(target, REVERSE_DIR(target.dir), BRAINS_BLOWN_THROW_RANGE) + var/datum/callback/gibspawner = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_atom_to_turf), /obj/effect/gibspawner/generic, shotbrain, 1, FALSE, target) chambered.BB.damage *= 4 process_fire(target, user, TRUE, params, BODY_ZONE_HEAD) - var/obj/item/organ/brain/shotbrain = target.getorganslot(ORGAN_SLOT_BRAIN) - if(shotbrain && chambered.BB.damage > 0) - var/turf/splat_turf = get_turf(target) - var/turf/splat_target = get_ranged_target_turf(target, REVERSE_DIR(target.dir), BRAINS_BLOWN_THROW_RANGE) - var/datum/callback/gibspawner = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_atom_to_turf), /obj/effect/gibspawner/generic, shotbrain, 1, FALSE, target) - shotbrain.Remove(target) - shotbrain.forceMove(splat_turf) - shotbrain.throw_at(splat_target, BRAINS_BLOWN_THROW_RANGE, BRAINS_BLOWN_THROW_SPEED, callback = gibspawner) + brain_to_blast.Remove(target) + brain_to_blast.forceMove(splat_turf) + brain_to_blast.throw_at(splat_target, BRAINS_BLOWN_THROW_RANGE, BRAINS_BLOWN_THROW_SPEED, callback = gibspawner) #undef BRAINS_BLOWN_THROW_RANGE #undef BRAINS_BLOWN_THROW_SPEED From 1b334fbb745c5b95e4a38169b9e82bb9a06598c7 Mon Sep 17 00:00:00 2001 From: thgvr Date: Sat, 30 Mar 2024 07:15:24 -0700 Subject: [PATCH 5/5] Cleans up code, implements damage type check --- code/modules/projectiles/gun.dm | 32 ++++++++++++++++++-------- code/modules/projectiles/projectile.dm | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 14885a531236..9aa8ac60326f 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -780,17 +780,29 @@ target.visible_message(span_warning("[user] pulls the trigger!"), span_userdanger("[(user == target) ? "You pull" : "[user] pulls"] the trigger!")) - // Check if the gun is usable, a round is chambered, and if the chambered round's projectile has damage - var/obj/item/organ/brain/brain_to_blast = target.getorganslot(ORGAN_SLOT_BRAIN) - if(chambered?.BB && brain_to_blast && can_trigger_gun(user) && chambered.BB.damage > 0) - var/turf/splat_turf = get_turf(target) - var/turf/splat_target = get_ranged_target_turf(target, REVERSE_DIR(target.dir), BRAINS_BLOWN_THROW_RANGE) - var/datum/callback/gibspawner = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_atom_to_turf), /obj/effect/gibspawner/generic, shotbrain, 1, FALSE, target) - chambered.BB.damage *= 4 + if(chambered && chambered.BB && can_trigger_gun(user)) + chambered.BB.damage *= 3 + //Check is here for safeties and such, brain will be removed after process_fire(target, user, TRUE, params, BODY_ZONE_HEAD) - brain_to_blast.Remove(target) - brain_to_blast.forceMove(splat_turf) - brain_to_blast.throw_at(splat_target, BRAINS_BLOWN_THROW_RANGE, BRAINS_BLOWN_THROW_SPEED, callback = gibspawner) + + var/obj/item/organ/brain/brain_to_blast = target.getorganslot(ORGAN_SLOT_BRAIN) + if(brain_to_blast) + + //Check if the projectile is actually damaging and not of type STAMINA + if(chambered.BB.nodamage || !chambered.BB.damage || chambered.BB.damage_type == STAMINA) + return + + //Remove brain of the mob shot + brain_to_blast.Remove(target) + + var/turf/splat_turf = get_turf(target) + //Move the brain of the person shot to selected turf + brain_to_blast.forceMove(splat_turf) + + var/turf/splat_target = get_ranged_target_turf(target, REVERSE_DIR(target.dir), BRAINS_BLOWN_THROW_RANGE) + var/datum/callback/gibspawner = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(spawn_atom_to_turf), /obj/effect/gibspawner/generic, brain_to_blast, 1, FALSE, target) + //Throw the brain that has been removed away and place a gibspawner on landing + brain_to_blast.throw_at(splat_target, BRAINS_BLOWN_THROW_RANGE, BRAINS_BLOWN_THROW_SPEED, callback = gibspawner) #undef BRAINS_BLOWN_THROW_RANGE #undef BRAINS_BLOWN_THROW_SPEED diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 7cc9b1c6ebb4..85c4558343d9 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -133,7 +133,7 @@ var/homing_offset_y = 0 var/damage = 10 - var/damage_type = BRUTE //BRUTE, BURN, TOX, OXY, CLONE are the only things that should be in here + var/damage_type = BRUTE //BRUTE, BURN, TOX, OXY, CLONE, STAMINA are the only things that should be in here var/nodamage = FALSE //Determines if the projectile will skip any damage inflictions var/flag = "bullet" //Defines what armor to use when it hits things. Must be set to bullet, laser, energy,or bomb ///How much armor this projectile pierces.