New bullet types, projectile rewrite

* Refactors projectile Bump()
* Converts projectile_type var strings to paths
* Reorganizes bullet projectile paths
* Made a pass through all the bullet_act() definitions. Mainly ensured that damage_type is checked when dealing damage to certain objects. Removed stupid /turf bullet_act() override, replaced with on_hit() overrides on the relevant projectiles.

* Adds shotgun pellets projectile. Adds Raptor's shotgun slug sprite.
* Gives stunshots more of their own identity, refluffs them as taser cartridges for shotguns. They still aren't obtainable anywhere unless spawned.
* Makes projectiles pass through girders and cultgirders with a certain probability, unless the girder itself was clicked.
* Projectiles are also able to pass through grilles. Low damage projectiles have a chance to be blocked by grilles. High damage projectiles have a chance to have some damage absorbed by the grille.
* Makes projectiles for blanks invisible.
* Adds flash bullet types
* Adds support for 'penetrating' projectiles
* Swaps .45 and 9mm projectile types. .45s hit slightly harder, 9mils have more ammo capacity.
This commit is contained in:
unknown
2015-02-04 17:56:43 -05:00
committed by mwerezak
parent c9eae483c6
commit 39b467c9da
41 changed files with 542 additions and 283 deletions

View File

@@ -105,6 +105,10 @@ var/list/beam_master = list()
icon_state = "u_laser"
damage = 50
/obj/item/projectile/beam/pulse/on_hit(var/atom/target, var/blocked = 0)
if(isturf(target))
target.ex_act(2)
..()
/obj/item/projectile/beam/emitter
name = "emitter beam"
@@ -169,5 +173,6 @@ var/list/beam_master = list()
name = "stun beam"
icon_state = "stun"
nodamage = 1
taser_effect = 1
agony = 40
damage_type = HALLOSS

View File

@@ -8,62 +8,153 @@
embed = 1
sharp = 1
on_hit(var/atom/target, var/blocked = 0)
if (..(target, blocked))
var/mob/living/L = target
shake_camera(L, 3, 2)
/obj/item/projectile/bullet/on_hit(var/atom/target, var/blocked = 0)
if (..(target, blocked))
var/mob/living/L = target
shake_camera(L, 3, 2)
/obj/item/projectile/bullet/weakbullet // "rubber" bullets
/obj/item/projectile/bullet/on_penetrate(var/atom/A)
if(!A) return 1 //if whatever it was got destroyed when we hit it, then I guess we can just keep going
if(istype(A, /obj/mecha))
return 1 //mecha have their own penetration handling
if(ismob(A))
if(iscarbon(A))
//squishy mobs absorb KE
if (damage <= 20) return 0
damage *= 0.7
return 1
if(istype(A, /obj/machinery) || istype(A, /obj/structure))
var/chance = 15
if(istype(A, /turf/simulated/wall))
var/turf/simulated/wall/W = A
chance = round(damage/W.damage_cap*100)
else if(istype(A, /obj/machinery/door))
var/obj/machinery/door/D = A
chance = round(damage/D.maxhealth*100)
else if(istype(A, /obj/structure/girder) || istype(A, /obj/structure/cultgirder))
chance = 100
if(prob(chance))
if(A.opacity)
//display a message so that people on the other side aren't so confused
A.visible_message("<span class='warning'>\The [src] pierces through \the [A]!")
return 1
return 0
//For projectiles that actually represent clouds of projectiles
/obj/item/projectile/bullet/pellet
name = "shrapnel" //'shrapnel' sounds more dangerous (i.e. cooler) than 'pellet'
damage = 20
//icon_state = "bullet" //TODO: would be nice to have it's own icon state
var/pellets = 4 //number of pellets
var/range_step = 2 //effective pellet count decreases every few tiles
var/base_spread = 90 //lower means the pellets spread more across body parts
var/spread_step = 10 //higher means the pellets spread more across body parts with distance
/obj/item/projectile/bullet/pellet/Bumped()
. = ..()
bumped = 0 //can hit all mobs in a tile. pellets is decremented inside attack_mob so this should be fine.
/obj/item/projectile/bullet/pellet/attack_mob(var/mob/living/target_mob, var/distance)
if (pellets < 0) return 1
var/pellet_loss = round((distance - 1)/range_step) //pellets lost due to distance
var/total_pellets = max(pellets - pellet_loss, 1)
var/spread = max(base_spread - (spread_step*distance), 0)
var/hits = 0
for (var/i in 1 to total_pellets)
//pellet hits spread out across different zones, but 'aim at' the targeted zone with higher probability
//whether the pellet actually hits the def_zone or a different zone should still be determined by the parent using get_zone_with_miss_chance().
var/old_zone = def_zone
def_zone = ran_zone(def_zone, spread)
if (..()) hits++
def_zone = old_zone //restore the original zone the projectile was aimed at
pellets -= hits //each hit reduces the number of pellets left
if (hits >= total_pellets || pellets <= 0)
return 1
return 0
/* short-casing projectiles, like the kind used in pistols or SMGs */
/obj/item/projectile/bullet/pistol
damage = 20
/obj/item/projectile/bullet/pistol/medium
damage = 25
/obj/item/projectile/bullet/pistol/strong //revolvers and matebas
damage = 60
/obj/item/projectile/bullet/pistol/rubber //"rubber" bullets
name = "rubber bullet"
damage = 10
agony = 40
embed = 0
sharp = 0
/obj/item/projectile/bullet/weakbullet/beanbag //because beanbags are not bullets
/* shotgun projectiles */
/obj/item/projectile/bullet/shotgun
name = "slug"
damage = 60
/obj/item/projectile/bullet/shotgun/beanbag //because beanbags are not bullets
name = "beanbag"
damage = 20
agony = 60
embed = 0
sharp = 0
/obj/item/projectile/bullet/weakbullet/rubber
name = "rubber bullet"
//Should do about 80 damage at 1 tile distance (adjacent), and 50 damage at 3 tiles distance.
//Overall less damage than slugs in exchange for more damage at very close range and more embedding
/obj/item/projectile/bullet/pellet/shotgun
name = "shrapnel"
damage = 13
pellets = 6
range_step = 1
spread_step = 10
/obj/item/projectile/bullet/midbullet
damage = 20
/* "Rifle" rounds */
/obj/item/projectile/bullet/midbullet2
/obj/item/projectile/bullet/rifle/a762
damage = 25
/obj/item/projectile/bullet/rifle/a145
damage = 90
penetrating = 5
/* Miscellaneous */
/obj/item/projectile/bullet/suffocationbullet//How does this even work?
name = "co bullet"
damage = 20
damage_type = OXY
/obj/item/projectile/bullet/cyanideround
name = "poison bullet"
damage = 40
damage_type = TOX
/obj/item/projectile/bullet/burstbullet//I think this one needs something for the on hit
/obj/item/projectile/bullet/burstbullet
name = "exploding bullet"
damage = 20
embed = 0
edge = 1
/obj/item/projectile/bullet/gyro/on_hit(var/atom/target, var/blocked = 0)
if(isturf(target))
explosion(target, -1, 0, 2)
..()
/obj/item/projectile/bullet/stunshot
name = "stunshot"
damage = 5
agony = 80
stutter = 10
/obj/item/projectile/bullet/blank
invisibility = 101
damage = 1
embed = 0
sharp = 0
/obj/item/projectile/bullet/a762
damage = 25
/obj/item/projectile/bullet/chameleon
damage = 1 // stop trying to murderbone with a fake gun dumbass!!!

View File

@@ -6,6 +6,35 @@
flag = "energy"
//releases a very short burst of light on impact, mainly used to blind people
/obj/item/projectile/energy/flash
name = "shell" //a chemical filled shell or something
icon_state = "bullet"
damage = 5
var/flash_range = 1
var/brightness = 5
var/light_duration = 10
/obj/item/projectile/energy/flash/on_impact()
var/turf/T = get_turf(src)
if(!istype(T)) return
src.visible_message("<span class='warning'>\The [src] explodes in a bright flash!</span>")
for (var/mob/living/carbon/M in viewers(T, flash_range))
if(M.eyecheck() < 1)
flick("e_flash", M.flash)
playsound(src, 'sound/effects/snap.ogg', 50, 1)
new/obj/effect/effect/smoke/illumination(src.loc, brightness=max(flash_range*2, brightness), lifetime=light_duration)
//blinds people like the flash round, but can also be used for temporary illumination
/obj/item/projectile/energy/flash/flare
damage = 10
flash_range = 1
brightness = 7 //similar to a flare
light_duration = 150
/obj/item/projectile/energy/electrode
name = "electrode"
icon_state = "spark"
@@ -15,11 +44,16 @@
weaken = 10
stutter = 10
*/
taser_effect = 1
agony = 40
damage_type = HALLOSS
//Damage will be handled on the MOB side, to prevent window shattering.
/obj/item/projectile/energy/electrode/stunshot
name = "stunshot"
damage = 5
taser_effect = 1
agony = 80
/obj/item/projectile/energy/declone
name = "declone"