From fd67a22afda1eeb18a2aabbd943e5dccaaf51739 Mon Sep 17 00:00:00 2001 From: "vageyenaman@gmail.com" Date: Thu, 24 Nov 2011 00:29:36 +0000 Subject: [PATCH] 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 --- code/game/machinery/magnet.dm | 12 +++++- code/game/objects/shooting_range.dm | 66 ++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm index 26df61b01f5..59f052e7eb4 100644 --- a/code/game/machinery/magnet.dm +++ b/code/game/machinery/magnet.dm @@ -224,15 +224,23 @@ if(autolink) for(var/obj/machinery/magnetic_module/M in world) - if(M.freq == frequency && code == code) + if(M.freq == frequency && M.code == code) magnets.Add(M) - spawn(15) // must wait for map loading to finish + spawn(45) // must wait for map loading to finish if(radio_controller) radio_connection = radio_controller.add_object(src, frequency, RADIO_MAGNETS) + process() + ..() + if(magnets.len == 0 && autolink) + for(var/obj/machinery/magnetic_module/M in world) + if(M.freq == frequency && M.code == code) + magnets.Add(M) + + attack_ai(mob/user as mob) return src.attack_hand(user) diff --git a/code/game/objects/shooting_range.dm b/code/game/objects/shooting_range.dm index b7c142ced8d..4af1363c874 100644 --- a/code/game/objects/shooting_range.dm +++ b/code/game/objects/shooting_range.dm @@ -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) + + + + + + + +