mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-31 20:43:12 +00:00
Cleanup can_fire(), projectile flag
Removes can_fire() and moves some of it's functionality into get_next_projectile(), which was renamed to consume_next_projectile() to indicate the possibility of side-effects. Also renamed flag var to check_armour
This commit is contained in:
@@ -50,10 +50,7 @@
|
||||
/obj/item/weapon/gun/launcher/spikethrower/update_release_force()
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/launcher/spikethrower/can_fire()
|
||||
return (spikes >= 1)
|
||||
|
||||
/obj/item/weapon/gun/launcher/spikethrower/get_next_projectile()
|
||||
/obj/item/weapon/gun/launcher/spikethrower/consume_next_projectile()
|
||||
if(spikes < 1) return null
|
||||
spikes--
|
||||
return new /obj/item/weapon/spike(src)
|
||||
@@ -100,7 +97,7 @@
|
||||
icon_state = "particle"
|
||||
damage = 60
|
||||
damage_type = BRUTE
|
||||
flag = "bullet"
|
||||
check_armour = "bullet"
|
||||
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
|
||||
|
||||
embed = 0
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/gun/energy/get_next_projectile()
|
||||
/obj/item/weapon/gun/energy/consume_next_projectile()
|
||||
if(!power_supply) return null
|
||||
if(!ispath(projectile_type)) return null
|
||||
if(!power_supply.use(charge_cost)) return null
|
||||
|
||||
@@ -35,16 +35,8 @@
|
||||
if(ispath(magazine_type) && (load_method & MAGAZINE))
|
||||
ammo_magazine = new magazine_type(src)
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/gun/projectile/can_fire()
|
||||
var/obj/item/ammo_casing/C
|
||||
if(loaded.len)
|
||||
C = loaded[1]
|
||||
else if(ammo_magazine && ammo_magazine.stored_ammo.len)
|
||||
C = ammo_magazine.stored_ammo[1]
|
||||
return (C && C.BB)
|
||||
|
||||
/obj/item/weapon/gun/projectile/get_next_projectile()
|
||||
/obj/item/weapon/gun/projectile/consume_next_projectile()
|
||||
//store the next ammo_casing in a var so that handle_post_fire() knows which one to eject
|
||||
//also we might as well remove chambered here, so that we don't have to figure out where it came from later
|
||||
if(loaded.len)
|
||||
|
||||
@@ -66,19 +66,13 @@
|
||||
if(cell && severity)
|
||||
cell.use(100*severity)
|
||||
|
||||
/obj/item/weapon/gun/launcher/crossbow/special_check(user)
|
||||
if(tension <= 0)
|
||||
user << "\red \The [src] is not drawn back!"
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/gun/launcher/crossbow/update_release_force()
|
||||
release_force = tension*release_speed
|
||||
|
||||
/obj/item/weapon/gun/launcher/crossbow/can_fire()
|
||||
return (tension && bolt)
|
||||
|
||||
/obj/item/weapon/gun/launcher/crossbow/get_next_projectile()
|
||||
/obj/item/weapon/gun/launcher/crossbow/consume_next_projectile(mob/user=null)
|
||||
if(tension <= 0)
|
||||
user << "\red \The [src] is not drawn back!"
|
||||
return null
|
||||
return bolt
|
||||
|
||||
/obj/item/weapon/gun/launcher/crossbow/handle_post_fire(mob/user, atom/target)
|
||||
|
||||
@@ -86,16 +86,19 @@
|
||||
user << "There is nothing to remove in \the [src]."
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/get_next_projectile()
|
||||
/obj/item/weapon/gun/launcher/pneumatic/consume_next_projectile(mob/user=null)
|
||||
if(!contents.len)
|
||||
return null
|
||||
return contents[1]
|
||||
if (!tank)
|
||||
user << "There is no gas tank in [src]!"
|
||||
return null
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/can_fire()
|
||||
if(!contents.len)
|
||||
return 0
|
||||
var/fire_pressure = (tank.air_contents.return_pressure()/100)*pressure_setting
|
||||
return (fire_pressure >= minimum_tank_pressure)
|
||||
if(fire_pressure < minimum_tank_pressure)
|
||||
user << "There isn't enough gas in the tank to fire [src]."
|
||||
return null
|
||||
|
||||
return contents[1]
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/examine(mob/user)
|
||||
if(!..(user, 2))
|
||||
@@ -106,18 +109,6 @@
|
||||
else
|
||||
user << "Nothing is attached to the tank valve!"
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/special_check(user)
|
||||
if (!tank)
|
||||
user << "There is no gas tank in [src]!"
|
||||
return 0
|
||||
|
||||
fire_pressure = (tank.air_contents.return_pressure()/100)*pressure_setting
|
||||
if (fire_pressure < minimum_tank_pressure)
|
||||
user << "There isn't enough gas in the tank to fire [src]."
|
||||
return 0
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/update_release_force(obj/item/projectile)
|
||||
if(tank)
|
||||
release_force = ((fire_pressure*tank.volume)/projectile.w_class)/force_divisor //projectile speed.
|
||||
|
||||
@@ -81,88 +81,3 @@
|
||||
caliber = "38"
|
||||
desc = initial(desc)
|
||||
user << "<span class='warning'>You remove the modifications on [src]! Now it will fire .38 rounds.</span>"
|
||||
|
||||
/*
|
||||
// A gun to play Russian Roulette!
|
||||
// You can spin the chamber to randomize the position of the bullet.
|
||||
/obj/item/weapon/gun/projectile/russian
|
||||
name = "\improper Russian revolver"
|
||||
desc = "A Russian made revolver. Uses .357 ammo. It has a single slot in it's chamber for a bullet."
|
||||
max_shells = 6
|
||||
origin_tech = "combat=2;materials=2"
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/New()
|
||||
Spin()
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/proc/Spin()
|
||||
for(var/obj/item/ammo_casing/AC in loaded)
|
||||
del(AC)
|
||||
loaded = list()
|
||||
var/random = rand(1, max_shells)
|
||||
for(var/i = 1; i <= max_shells; i++)
|
||||
if(i != random)
|
||||
loaded += i // Basically null
|
||||
else
|
||||
loaded += new ammo_type(src)
|
||||
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/attackby(var/obj/item/A as obj, mob/user as mob)
|
||||
if(!A) return
|
||||
|
||||
var/num_loaded = 0
|
||||
if(istype(A, /obj/item/ammo_magazine))
|
||||
|
||||
if((load_method == MAGAZINE) && loaded.len) return
|
||||
var/obj/item/ammo_magazine/AM = A
|
||||
for(var/obj/item/ammo_casing/AC in AM.stored_ammo)
|
||||
if(getAmmo() > 0 || loaded.len >= max_shells)
|
||||
break
|
||||
if(AC.caliber == caliber && loaded.len < max_shells)
|
||||
AC.loc = src
|
||||
AM.stored_ammo -= AC
|
||||
loaded += AC
|
||||
num_loaded++
|
||||
break
|
||||
A.update_icon()
|
||||
|
||||
if(num_loaded)
|
||||
user.visible_message("<span class='warning'>[user] loads a single bullet into the revolver and spins the chamber.</span>", "<span class='warning'>You load a single bullet into the chamber and spin it.</span>")
|
||||
else
|
||||
user.visible_message("<span class='warning'>[user] spins the chamber of the revolver.</span>", "<span class='warning'>You spin the revolver's chamber.</span>")
|
||||
if(getAmmo() > 0)
|
||||
Spin()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/attack_self(mob/user as mob)
|
||||
user.visible_message("<span class='warning'>[user] spins the chamber of the revolver.</span>", "<span class='warning'>You spin the revolver's chamber.</span>")
|
||||
if(getAmmo() > 0)
|
||||
Spin()
|
||||
|
||||
/obj/item/weapon/gun/projectile/russian/attack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj)
|
||||
if(!loaded.len)
|
||||
user.visible_message("\red *click*", "\red *click*")
|
||||
playsound(user, 'sound/weapons/empty.ogg', 100, 1)
|
||||
return
|
||||
|
||||
if(isliving(target) && isliving(user))
|
||||
if(target == user)
|
||||
var/datum/organ/external/affecting = user.zone_sel.selecting
|
||||
if(affecting == "head")
|
||||
|
||||
var/obj/item/ammo_casing/AC = loaded[1]
|
||||
if(!load_into_chamber())
|
||||
user.visible_message("\red *click*", "\red *click*")
|
||||
playsound(user, 'sound/weapons/empty.ogg', 100, 1)
|
||||
return
|
||||
if(!in_chamber)
|
||||
return
|
||||
var/obj/item/projectile/P = new AC.projectile_type
|
||||
playsound(user, fire_sound, 50, 1)
|
||||
user.visible_message("<span class='danger'>[user.name] fires [src] at \his head!</span>", "<span class='danger'>You fire [src] at your head!</span>", "You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!")
|
||||
if(!P.nodamage)
|
||||
user.apply_damage(300, BRUTE, affecting, sharp=1) // You are dead, dead, dead.
|
||||
return
|
||||
..()
|
||||
*/
|
||||
@@ -33,10 +33,7 @@
|
||||
else
|
||||
usr << "\red [src] cannot hold more rockets."
|
||||
|
||||
/obj/item/weapon/gun/launcher/rocket/can_fire()
|
||||
return rockets.len
|
||||
|
||||
/obj/item/weapon/gun/launcher/rocket/get_next_projectile()
|
||||
/obj/item/weapon/gun/launcher/rocket/consume_next_projectile()
|
||||
if(rockets.len)
|
||||
var/obj/item/ammo_casing/rocket/I = rockets[1]
|
||||
var/obj/item/missile/M = new (src)
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
handle_casings = HOLD_CASINGS
|
||||
var/recentpump = 0 // to prevent spammage
|
||||
|
||||
/obj/item/weapon/gun/projectile/shotgun/pump/can_fire()
|
||||
return (chambered && chambered.BB)
|
||||
|
||||
/obj/item/weapon/gun/projectile/shotgun/pump/get_next_projectile()
|
||||
/obj/item/weapon/gun/projectile/shotgun/pump/consume_next_projectile()
|
||||
if(chambered)
|
||||
return chambered.BB
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user