From 5a06fd98ed71c67b086f74864415cec830ce6cd6 Mon Sep 17 00:00:00 2001
From: iksyp <33264221+iskyp@users.noreply.github.com>
Date: Wed, 11 Apr 2018 02:59:03 -0700
Subject: [PATCH 1/2] Whether or not a pacifist can fire a gun is no longer
based on the gun being harmful, but the chambered round being harmful
(#36670)
fix: makes dragnet non harmful
tweak: pacifists can now use any disabler or stun setting on any energy gun
code: removed all of the pacifism check code from code/modules/mob/living/living.dm
code: gun objects no longer have a harmful variable, instead, ammo_casing objects now have a harmful variable, which is by default set to TRUE
code: if a pacifist fires a gun, it checks whether or not the round chambered is lethal, instead of whether or not the gun itself is lethal.
---
code/modules/mob/living/living.dm | 8 --------
code/modules/projectiles/ammunition/_ammunition.dm | 1 +
code/modules/projectiles/ammunition/caseless/foam.dm | 2 ++
code/modules/projectiles/ammunition/energy/laser.dm | 4 ++++
code/modules/projectiles/ammunition/energy/special.dm | 3 +++
code/modules/projectiles/ammunition/energy/stun.dm | 2 ++
code/modules/projectiles/ammunition/special/magic.dm | 3 +++
code/modules/projectiles/gun.dm | 9 ++++++++-
code/modules/projectiles/guns/ballistic/toy.dm | 3 ---
code/modules/projectiles/guns/energy/special.dm | 1 -
code/modules/projectiles/guns/energy/stun.dm | 5 -----
code/modules/projectiles/guns/magic/staff.dm | 3 ---
code/modules/projectiles/guns/magic/wand.dm | 4 ----
code/modules/projectiles/guns/misc/medbeam.dm | 1 -
14 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 9c0152a973..cbf093e815 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -879,14 +879,6 @@
if(G.trigger_guard != TRIGGER_GUARD_ALLOW_ALL && !IsAdvancedToolUser())
to_chat(src, "You don't have the dexterity to do this!")
return FALSE
- var/obj/item/gun/shooty
- if(istype(G, /obj/item/gun))
- shooty = G
- if(has_trait(TRAIT_PACIFISM))
- if(shooty && !shooty.harmful)
- return TRUE
- to_chat(src, "You don't want to risk harming anyone!")
- return FALSE
return TRUE
diff --git a/code/modules/projectiles/ammunition/_ammunition.dm b/code/modules/projectiles/ammunition/_ammunition.dm
index 3eab64e600..c2c477f49b 100644
--- a/code/modules/projectiles/ammunition/_ammunition.dm
+++ b/code/modules/projectiles/ammunition/_ammunition.dm
@@ -18,6 +18,7 @@
var/click_cooldown_override = 0 //Override this to make your gun have a faster fire rate, in tenths of a second. 4 is the default gun cooldown.
var/firing_effect_type = /obj/effect/temp_visual/dir_setting/firing_effect //the visual effect appearing when the ammo is fired.
var/heavy_metal = TRUE
+ var/harmful = TRUE //pacifism check for boolet, set to FALSE if bullet is non-lethal
/obj/item/ammo_casing/Initialize()
diff --git a/code/modules/projectiles/ammunition/caseless/foam.dm b/code/modules/projectiles/ammunition/caseless/foam.dm
index fdf685e001..0cc4578c32 100644
--- a/code/modules/projectiles/ammunition/caseless/foam.dm
+++ b/code/modules/projectiles/ammunition/caseless/foam.dm
@@ -6,6 +6,7 @@
icon = 'icons/obj/guns/toy.dmi'
icon_state = "foamdart"
var/modified = 0
+ harmful = FALSE
/obj/item/ammo_casing/caseless/foam_dart/update_icon()
..()
@@ -32,6 +33,7 @@
else if (istype(A, /obj/item/pen))
if(modified)
if(!FD.pen)
+ harmful = TRUE
if(!user.transferItemToLoc(A, FD))
return
FD.pen = A
diff --git a/code/modules/projectiles/ammunition/energy/laser.dm b/code/modules/projectiles/ammunition/energy/laser.dm
index c87ea2ffbd..089c79effd 100644
--- a/code/modules/projectiles/ammunition/energy/laser.dm
+++ b/code/modules/projectiles/ammunition/energy/laser.dm
@@ -18,6 +18,7 @@
/obj/item/ammo_casing/energy/laser/practice
projectile_type = /obj/item/projectile/beam/practice
select_name = "practice"
+ harmful = FALSE
/obj/item/ammo_casing/energy/laser/scatter
projectile_type = /obj/item/projectile/beam/scatter
@@ -29,6 +30,7 @@
projectile_type = /obj/item/projectile/beam/disabler
pellets = 3
variance = 15
+ harmful = FALSE
/obj/item/ammo_casing/energy/laser/heavy
projectile_type = /obj/item/projectile/beam/laser/heavylaser
@@ -44,6 +46,7 @@
/obj/item/ammo_casing/energy/laser/bluetag
projectile_type = /obj/item/projectile/beam/lasertag/bluetag
select_name = "bluetag"
+ harmful = FALSE
/obj/item/ammo_casing/energy/laser/bluetag/hitscan
projectile_type = /obj/item/projectile/beam/lasertag/bluetag/hitscan
@@ -51,6 +54,7 @@
/obj/item/ammo_casing/energy/laser/redtag
projectile_type = /obj/item/projectile/beam/lasertag/redtag
select_name = "redtag"
+ harmful = FALSE
/obj/item/ammo_casing/energy/laser/redtag/hitscan
projectile_type = /obj/item/projectile/beam/lasertag/redtag/hitscan
diff --git a/code/modules/projectiles/ammunition/energy/special.dm b/code/modules/projectiles/ammunition/energy/special.dm
index 0438baf490..0879506036 100644
--- a/code/modules/projectiles/ammunition/energy/special.dm
+++ b/code/modules/projectiles/ammunition/energy/special.dm
@@ -10,6 +10,7 @@
/obj/item/ammo_casing/energy/flora
fire_sound = 'sound/effects/stealthoff.ogg'
+ harmful = FALSE
/obj/item/ammo_casing/energy/flora/yield
projectile_type = /obj/item/projectile/energy/florayield
@@ -38,10 +39,12 @@
select_name = "netting"
pellets = 6
variance = 40
+ harmful = FALSE
/obj/item/ammo_casing/energy/trap
projectile_type = /obj/item/projectile/energy/trap
select_name = "snare"
+ harmful = FALSE
/obj/item/ammo_casing/energy/instakill
projectile_type = /obj/item/projectile/beam/instakill
diff --git a/code/modules/projectiles/ammunition/energy/stun.dm b/code/modules/projectiles/ammunition/energy/stun.dm
index 5a88a97b08..9b24571d12 100644
--- a/code/modules/projectiles/ammunition/energy/stun.dm
+++ b/code/modules/projectiles/ammunition/energy/stun.dm
@@ -3,6 +3,7 @@
select_name = "stun"
fire_sound = 'sound/weapons/taser.ogg'
e_cost = 200
+ harmful = FALSE
/obj/item/ammo_casing/energy/electrode/spec
e_cost = 100
@@ -22,3 +23,4 @@
select_name = "disable"
e_cost = 50
fire_sound = 'sound/weapons/taser2.ogg'
+ harmful = FALSE
diff --git a/code/modules/projectiles/ammunition/special/magic.dm b/code/modules/projectiles/ammunition/special/magic.dm
index 6ebf5739a9..6e1d60c11f 100644
--- a/code/modules/projectiles/ammunition/special/magic.dm
+++ b/code/modules/projectiles/ammunition/special/magic.dm
@@ -13,15 +13,18 @@
/obj/item/ammo_casing/magic/heal
projectile_type = /obj/item/projectile/magic/resurrection
+ harmful = FALSE
/obj/item/ammo_casing/magic/death
projectile_type = /obj/item/projectile/magic/death
/obj/item/ammo_casing/magic/teleport
projectile_type = /obj/item/projectile/magic/teleport
+ harmful = FALSE
/obj/item/ammo_casing/magic/door
projectile_type = /obj/item/projectile/magic/door
+ harmful = FALSE
/obj/item/ammo_casing/magic/fireball
projectile_type = /obj/item/projectile/magic/aoe/fireball
diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm
index 6500374a6a..9aa320dc91 100644
--- a/code/modules/projectiles/gun.dm
+++ b/code/modules/projectiles/gun.dm
@@ -35,7 +35,6 @@
var/weapon_weight = WEAPON_LIGHT
var/spread = 0 //Spread induced by the gun itself.
var/randomspread = 1 //Set to 0 for shotguns. This is used for weapons that don't fire all their bullets at once.
- var/harmful = TRUE //some arent harmful and should have this set to false. used for pacifists with tasers, medibeams, etc
lefthand_file = 'icons/mob/inhands/weapons/guns_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/guns_righthand.dmi'
@@ -218,6 +217,10 @@
firing_burst = FALSE
return FALSE
if(chambered && chambered.BB)
+ if(user.has_trait(TRAIT_PACIFISM)) // If the user has the pacifist trait, then they won't be able to fire [src] if the round chambered inside of [src] is lethal.
+ if(chambered.harmful) // Is the bullet chambered harmful?
+ to_chat(user, " [src] is lethally chambered! You don't want to risk harming anyone...")
+ return
if(randomspread)
sprd = round((rand() - 0.5) * DUALWIELD_PENALTY_EXTRA_MULTIPLIER * (randomized_gun_spread + randomized_bonus_spread))
else //Smart spread
@@ -263,6 +266,10 @@
addtimer(CALLBACK(src, .proc/process_burst, user, target, message, params, zone_override, sprd, randomized_gun_spread, randomized_bonus_spread, rand_spr, i), fire_delay * (i - 1))
else
if(chambered)
+ if(user.has_trait(TRAIT_PACIFISM)) // If the user has the pacifist trait, then they won't be able to fire [src] if the round chambered inside of [src] is lethal.
+ if(chambered.harmful) // Is the bullet chambered harmful?
+ to_chat(user, " [src] is lethally chambered! You don't want to risk harming anyone...")
+ return
sprd = round((rand() - 0.5) * DUALWIELD_PENALTY_EXTRA_MULTIPLIER * (randomized_gun_spread + randomized_bonus_spread))
if(!chambered.fire_casing(target, user, params, , suppressed, zone_override, sprd))
shoot_with_empty_chamber(user)
diff --git a/code/modules/projectiles/guns/ballistic/toy.dm b/code/modules/projectiles/guns/ballistic/toy.dm
index 44b0a70dd5..2089354e4f 100644
--- a/code/modules/projectiles/guns/ballistic/toy.dm
+++ b/code/modules/projectiles/guns/ballistic/toy.dm
@@ -13,7 +13,6 @@
clumsy_check = 0
item_flags = NONE
casing_ejector = FALSE
- harmful = FALSE
/obj/item/gun/ballistic/automatic/toy/unrestricted
pin = /obj/item/device/firing_pin
@@ -28,7 +27,6 @@
burst_size = 1
fire_delay = 0
actions_types = list()
- harmful = FALSE
/obj/item/gun/ballistic/automatic/toy/pistol/update_icon()
..()
@@ -58,7 +56,6 @@
item_flags = NONE
casing_ejector = FALSE
can_suppress = FALSE
- harmful = FALSE
/obj/item/gun/ballistic/shotgun/toy/process_chamber(empty_chamber = 0)
..()
diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm
index b1d34b0614..547e49cbdf 100644
--- a/code/modules/projectiles/guns/energy/special.dm
+++ b/code/modules/projectiles/guns/energy/special.dm
@@ -49,7 +49,6 @@
modifystate = 1
ammo_x_offset = 1
selfcharge = 1
- harmful = FALSE
/obj/item/gun/energy/meteorgun
name = "meteor gun"
diff --git a/code/modules/projectiles/guns/energy/stun.dm b/code/modules/projectiles/guns/energy/stun.dm
index d7b62879dd..77281497ba 100644
--- a/code/modules/projectiles/guns/energy/stun.dm
+++ b/code/modules/projectiles/guns/energy/stun.dm
@@ -5,7 +5,6 @@
item_state = null //so the human update icon uses the icon_state instead.
ammo_type = list(/obj/item/ammo_casing/energy/electrode)
ammo_x_offset = 3
- harmful = FALSE
/obj/item/gun/energy/tesla_revolver
name = "tesla gun"
@@ -23,7 +22,6 @@
icon_state = "advtaser"
ammo_type = list(/obj/item/ammo_casing/energy/electrode, /obj/item/ammo_casing/energy/disabler)
ammo_x_offset = 2
- harmful = FALSE
/obj/item/gun/energy/e_gun/advtaser/cyborg
name = "cyborg taser"
@@ -31,7 +29,6 @@
can_flashlight = 0
can_charge = 0
use_cyborg_cell = 1
- harmful = FALSE
/obj/item/gun/energy/disabler
name = "disabler"
@@ -40,11 +37,9 @@
item_state = null
ammo_type = list(/obj/item/ammo_casing/energy/disabler)
ammo_x_offset = 3
- harmful = FALSE
/obj/item/gun/energy/disabler/cyborg
name = "cyborg disabler"
desc = "An integrated disabler that draws from a cyborg's power cell. This weapon contains a limiter to prevent the cyborg's power cell from overheating."
can_charge = 0
use_cyborg_cell = 1
- harmful = FALSE
diff --git a/code/modules/projectiles/guns/magic/staff.dm b/code/modules/projectiles/guns/magic/staff.dm
index 617de22baa..c268c15272 100644
--- a/code/modules/projectiles/guns/magic/staff.dm
+++ b/code/modules/projectiles/guns/magic/staff.dm
@@ -27,7 +27,6 @@
ammo_type = /obj/item/ammo_casing/magic/heal
icon_state = "staffofhealing"
item_state = "staffofhealing"
- harmful = FALSE
/obj/item/gun/magic/staff/healing/handle_suicide() //Stops people trying to commit suicide to heal themselves
return
@@ -60,7 +59,6 @@
max_charges = 10
recharge_rate = 2
no_den_usage = 1
- harmful = FALSE
/obj/item/gun/magic/staff/honk
name = "staff of the honkmother"
@@ -71,7 +69,6 @@
item_state = "honker"
max_charges = 4
recharge_rate = 8
- harmful = FALSE
/obj/item/gun/magic/staff/spellblade
name = "spellblade"
diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm
index 6d094c6ff7..bf3ade0748 100644
--- a/code/modules/projectiles/guns/magic/wand.dm
+++ b/code/modules/projectiles/guns/magic/wand.dm
@@ -8,7 +8,6 @@
can_charge = 0
max_charges = 100 //100, 50, 50, 34 (max charge distribution by 25%ths)
var/variable_charges = 1
- harmful = FALSE
/obj/item/gun/magic/wand/Initialize()
if(prob(75) && variable_charges) //25% chance of listed max charges, 50% chance of 1/2 max charges, 25% chance of 1/3 max charges
@@ -86,7 +85,6 @@
fire_sound = 'sound/magic/staff_healing.ogg'
icon_state = "revivewand"
max_charges = 10 //10, 5, 5, 4
- harmful = FALSE
/obj/item/gun/magic/wand/resurrection/zap_self(mob/living/user)
user.revive(full_heal = 1)
@@ -127,7 +125,6 @@
icon_state = "telewand"
max_charges = 10 //10, 5, 5, 4
no_den_usage = 1
- harmful = FALSE
/obj/item/gun/magic/wand/teleport/zap_self(mob/living/user)
if(do_teleport(user, user, 10))
@@ -149,7 +146,6 @@
fire_sound = 'sound/magic/staff_door.ogg'
max_charges = 20 //20, 10, 10, 7
no_den_usage = 1
- harmful = FALSE
/obj/item/gun/magic/wand/door/zap_self(mob/living/user)
to_chat(user, "You feel vaguely more open with your feelings.")
diff --git a/code/modules/projectiles/guns/misc/medbeam.dm b/code/modules/projectiles/guns/misc/medbeam.dm
index 0626505791..8fb07c32e3 100644
--- a/code/modules/projectiles/guns/misc/medbeam.dm
+++ b/code/modules/projectiles/guns/misc/medbeam.dm
@@ -5,7 +5,6 @@
icon_state = "chronogun"
item_state = "chronogun"
w_class = WEIGHT_CLASS_NORMAL
- harmful = FALSE
var/mob/living/current_target
var/last_check = 0