Final fixes for the firing range. This SHOULD be the last of them.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2550 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
vageyenaman@gmail.com
2011-11-24 00:29:36 +00:00
parent c0290481e7
commit fd67a22afd
2 changed files with 61 additions and 17 deletions
+51 -15
View File
@@ -68,6 +68,7 @@
density = 0
var/hp = 1800
var/icon/virtualIcon
var/list/bulletholes = list()
Del()
// if a target is deleted and associated with a stake, force stake to forget
@@ -132,11 +133,11 @@
syndicate
icon_state = "target_s"
desc = "A shooting target that looks like a syndicate scum."
hp = 2000 // i guess syndie targets are sturdier?
hp = 2600 // i guess syndie targets are sturdier?
alien
icon_state = "target_q"
desc = "A shooting target that looks like a xenomorphic alien."
hp = 2450 // alium ones too
hp = 2350 // alium onest too kinda
/obj/item/target/bullet_act(var/obj/item/projectile/Proj)
var/p_x = Proj.p_x + pick(0,0,0,0,0,-1,1) // really ugly way of coding "sometimes offset Proj.p_x!"
@@ -147,8 +148,7 @@
decaltype = 2
if(!virtualIcon)
virtualIcon = new(icon, icon_state) // if can't locate virtualIcon, make one!
virtualIcon = new(icon, icon_state)
if( virtualIcon.GetPixel(p_x, p_y) ) // if the located pixel isn't blank (null)
@@ -186,30 +186,66 @@
// Bullets are hard. They make dents!
bmark.icon_state = "dent"
var/bullethole = 0 // 1 if makes bullet hole
if(Proj.damage >= 10)
if(Proj.damage >= 10 && bulletholes.len <= 35) // maximum of 35 bullet holes
if(decaltype == 2) // bullet
if(prob(Proj.damage+30)) // bullets make holes more commonly!
bullethole = 1
new/datum/bullethole(src, bmark.pixel_x, bmark.pixel_y) // create new bullet hole
else // Lasers!
if(prob(Proj.damage-10)) // lasers make holes less commonly
bullethole = 1
if(bullethole) // draw a simple bullet hole circle thing, not horrendously fancy but it does the job
virtualIcon.DrawBox(null, bmark.pixel_x-pick(1,1,1,1,1,1,2,3,4), bmark.pixel_y, bmark.pixel_x+pick(1,1,1,1,1,1,2,3,4), bmark.pixel_y) // horizontal line
virtualIcon.DrawBox(null, bmark.pixel_x, bmark.pixel_y+pick(1,1,1,1,1,1,2,3,4), bmark.pixel_x, bmark.pixel_y-pick(1,1,1,1,1,1,2,3,4)) // vertical line
icon = virtualIcon // apply changes
new/datum/bullethole(src, bmark.pixel_x, bmark.pixel_y) // create new bullet hole
// draw bullet holes
for(var/datum/bullethole/B in bulletholes)
virtualIcon.DrawBox(null, B.b1x1, B.b1y, B.b1x2, B.b1y) // horizontal line, left to right
virtualIcon.DrawBox(null, B.b2x, B.b2y1, B.b2x, B.b2y2) // vertical line, top to bottom
overlays += bmark // add the decal
icon = virtualIcon // apply bulletholes over decals
return
return -1 // the bullet/projectile goes through the target! Ie, you missed
// Small memory holder entity for transparent bullet holes
/datum/bullethole
// First box
var/b1x1 = 0
var/b1x2 = 0
var/b1y = 0
// Second box
var/b2x = 0
var/b2y1 = 0
var/b2y2 = 0
New(var/obj/item/target/Target, var/pixel_x = 0, var/pixel_y = 0)
if(!Target) return
// Randomize the first box
b1x1 = pixel_x - pick(1,1,1,1,2,2,3,3,4)
b1x2 = pixel_x + pick(1,1,1,1,2,2,3,3,4)
b1y = pixel_y
if(prob(35))
b1y += rand(-4,4)
// Randomize the second box
b2x = pixel_x
if(prob(35))
b2x += rand(-4,4)
b2y1 = pixel_y + pick(1,1,1,1,2,2,3,3,4)
b2y2 = pixel_y - pick(1,1,1,1,2,2,3,3,4)
Target.bulletholes.Add(src)