Moved can_trigger_gun to item/weapon parent
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
var/create_full = FALSE
|
||||
var/create_with_tank = FALSE
|
||||
var/igniter_type = /obj/item/device/assembly/igniter
|
||||
trigger_guard = TRIGGER_GUARD_NORMAL
|
||||
|
||||
/obj/item/weapon/flamethrower/Destroy()
|
||||
if(weldtool)
|
||||
@@ -69,12 +70,7 @@
|
||||
if(flag)
|
||||
return // too close
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.dna.check_mutation(HULK))
|
||||
to_chat(user, "<span class='warning'>Your meaty finger is much too large for the trigger guard!</span>")
|
||||
return
|
||||
if(NOGUNS in H.dna.species.species_traits)
|
||||
to_chat(user, "<span class='warning'>Your fingers don't fit in the trigger guard!</span>")
|
||||
if(!can_trigger_gun(user))
|
||||
return
|
||||
if(user && user.get_active_held_item() == src) // Make sure our user is still holding us
|
||||
var/turf/target_turf = get_turf(target)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
var/fire_mode = PCANNON_FIREALL
|
||||
var/automatic = FALSE
|
||||
var/clumsyCheck = TRUE
|
||||
trigger_guard = TRIGGER_GUARD_NORMAL
|
||||
|
||||
/obj/item/weapon/pneumatic_cannon/CanItemAutoclick()
|
||||
return automatic
|
||||
@@ -108,11 +109,7 @@
|
||||
if(!istype(user) && !target)
|
||||
return
|
||||
var/discharge = 0
|
||||
if(user.dna.check_mutation(HULK))
|
||||
to_chat(user, "<span class='warning'>Your meaty finger is much too large for the trigger guard!</span>")
|
||||
return
|
||||
if(NOGUNS in user.dna.species.species_traits)
|
||||
to_chat(user, "<span class='warning'>Your fingers don't fit in the trigger guard!</span>")
|
||||
if(!can_trigger_gun(user))
|
||||
return
|
||||
if(!loadedItems || !loadedWeightClass)
|
||||
to_chat(user, "<span class='warning'>\The [src] has nothing loaded.</span>")
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/obj/item/weapon
|
||||
var/trigger_guard = TRIGGER_GUARD_NONE
|
||||
|
||||
/obj/item/weapon/banhammer
|
||||
desc = "A banhammer"
|
||||
@@ -584,3 +585,8 @@
|
||||
throwforce = 0
|
||||
flags = DROPDEL | ABSTRACT
|
||||
attack_verb = list("bopped")
|
||||
|
||||
/obj/item/weapon/proc/can_trigger_gun(mob/living/user)
|
||||
if(!user.can_use_guns(src))
|
||||
return FALSE
|
||||
return TRUE
|
||||
@@ -143,7 +143,7 @@
|
||||
var/protection = (prot["head"] + prot["arms"] + prot["feet"] + prot["legs"] + prot["groin"] + prot["chest"] + prot["hands"])/7
|
||||
return protection
|
||||
|
||||
/mob/living/carbon/human/can_use_guns(var/obj/item/weapon/gun/G)
|
||||
/mob/living/carbon/human/can_use_guns(var/obj/item/weapon/G)
|
||||
. = ..()
|
||||
|
||||
if(G.trigger_guard == TRIGGER_GUARD_NORMAL)
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/monkey/can_use_guns(var/obj/item/weapon/gun/G)
|
||||
/mob/living/carbon/monkey/can_use_guns(var/obj/item/weapon/G)
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/monkey/angry
|
||||
|
||||
@@ -795,7 +795,7 @@
|
||||
else
|
||||
to_chat(src, "<span class='warning'>You don't have the dexterity to do this!</span>")
|
||||
return
|
||||
/mob/living/proc/can_use_guns(var/obj/item/weapon/gun/G)
|
||||
/mob/living/proc/can_use_guns(var/obj/item/weapon/G)
|
||||
if (G.trigger_guard != TRIGGER_GUARD_ALLOW_ALL && !IsAdvancedToolUser())
|
||||
to_chat(src, "<span class='warning'>You don't have the dexterity to do this!</span>")
|
||||
return 0
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
else
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/drone/cogscarab/can_use_guns(obj/item/weapon/gun/G)
|
||||
/mob/living/simple_animal/drone/cogscarab/can_use_guns(obj/item/weapon/G)
|
||||
return GLOB.ratvar_awakens
|
||||
|
||||
/mob/living/simple_animal/drone/cogscarab/get_armor_effectiveness()
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
var/recoil = 0 //boom boom shake the room
|
||||
var/clumsy_check = 1
|
||||
var/obj/item/ammo_casing/chambered = null
|
||||
var/trigger_guard = TRIGGER_GUARD_NORMAL //trigger guard on the weapon, hulks can't fire them with their big meaty fingers
|
||||
trigger_guard = TRIGGER_GUARD_NORMAL //trigger guard on the weapon, hulks can't fire them with their big meaty fingers
|
||||
var/sawn_desc = null //description change if weapon is sawn-off
|
||||
var/sawn_state = SAWN_INTACT
|
||||
var/burst_size = 1 //how large a burst is
|
||||
@@ -188,12 +188,10 @@
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/gun/proc/can_trigger_gun(var/mob/living/user)
|
||||
|
||||
if(!handle_pins(user) || !user.can_use_guns(src))
|
||||
return 0
|
||||
|
||||
return 1
|
||||
/obj/item/weapon/gun/can_trigger_gun(mob/living/user)
|
||||
. = ..()
|
||||
if(!handle_pins(user))
|
||||
return FALSE
|
||||
|
||||
/obj/item/weapon/gun/proc/handle_pins(mob/living/user)
|
||||
if(pin)
|
||||
|
||||
Reference in New Issue
Block a user