From 240d910679389b929a07d0ee281db1e330b63aed Mon Sep 17 00:00:00 2001 From: "johnsonmt88@gmail.com" Date: Sat, 25 Aug 2012 16:39:18 +0000 Subject: [PATCH] Meteor guns! It's a gun that fires meteors! Admin spawn only. They do not shoot 'real' meteors, they shoot a projectile that acts like meteors. Note: The meteor projectile calls 'meteorhit()' which some objects and turfs do not have, so some things won't really be affected by them. The gun itself has a potato battery, meaning it starts with a charge of 100 and has a maximum charge of 300. It costs 100 to fire and recharges 100 every 5 ticks. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4538 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/atom.dm | 2 +- code/game/gamemodes/meteor/meteors.dm | 49 +------------------ .../projectiles/guns/energy/special.dm | 47 ++++++++++++++++-- code/modules/projectiles/guns/energy/stun.dm | 4 +- .../modules/projectiles/projectile/special.dm | 30 ++++++++++++ 5 files changed, 78 insertions(+), 54 deletions(-) diff --git a/code/defines/atom.dm b/code/defines/atom.dm index 7c9e59c36a1..93d24b96f6c 100644 --- a/code/defines/atom.dm +++ b/code/defines/atom.dm @@ -68,7 +68,7 @@ obj else return null -/atom/proc/meteorhit(obj/effect/meteor as obj) +/atom/proc/meteorhit(obj/meteor as obj) return /atom/proc/allow_drop() diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 57feddf7cac..0aa28f8cf0d 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -163,51 +163,4 @@ if(istype(W, /obj/item/weapon/pickaxe)) del(src) return - ..() - -/* -//Testing purposes only! -/obj/item/weapon/meteorgun - name = "Meteor Gun" - desc = "This beast fires meteors!. TESTING PURPOSES ONLY, This gun is incomplete!" - icon = 'icons/obj/gun.dmi' - icon_state = "lasercannon" - item_state = "gun" - -/obj/item/weapon/meteorgun/attack_self() - var/start_x = usr.loc.x - var/start_y = usr.loc.y - var/start_z = usr.loc.z - var/end_x = 0 - var/end_y = 0 - var/end_z = 0 - - switch(usr.dir) - if(NORTH) - end_x = start_x - end_y = world.maxy-TRANSITIONEDGE - if(SOUTH) - end_x = start_x - end_y = TRANSITIONEDGE - if(EAST) - end_x = world.maxx-TRANSITIONEDGE - end_y = start_y - if(WEST) - end_x = TRANSITIONEDGE - end_y = start_y - else //north - end_x = start_x - end_y = TRANSITIONEDGE - end_z = start_z - - var/start = locate(start_x, start_y, start_z) - var/end = locate(end_x, end_y, end_z) - var/obj/effect/meteor/M = new /obj/effect/meteor(start) - - M.dest = end - - spawn(0) - walk_towards(M, M.dest, 1) - - return -*/ \ No newline at end of file + ..() \ No newline at end of file diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 7cfb312c334..fad12395e4f 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -28,7 +28,7 @@ obj/item/weapon/gun/energy/staff name = "staff of change" - desc = "an artefact that spits bolts of coruscating energy which cause the target's very form to reshape itself" + desc = "An artefact that spits bolts of coruscating energy which cause the target's very form to reshape itself" icon = 'icons/obj/gun.dmi' icon_state = "staffofchange" item_state = "staffofchange" @@ -66,7 +66,7 @@ obj/item/weapon/gun/energy/staff name = "floral somatoray" desc = "A tool that discharges controlled radiation which induces mutation in plant cells." icon_state = "floramut100" - item_state = "gun" + item_state = "obj/item/gun.dmi" fire_sound = 'sound/effects/stealthoff.ogg' charge_cost = 100 projectile_type = "/obj/item/projectile/energy/floramut" @@ -109,4 +109,45 @@ obj/item/weapon/gun/energy/staff projectile_type = "/obj/item/projectile/energy/floramut" modifystate = "floramut" update_icon() - return \ No newline at end of file + return + +/obj/item/weapon/gun/energy/meteorgun + name = "meteor gun" + desc = "For the love of god, make sure you're aiming this the right way!" + icon_state = "riotgun" + item_state = "c20r" + w_class = 4 + projectile_type = "/obj/item/projectile/meteor" + charge_cost = 100 + cell_type = "/obj/item/weapon/cell/potato" + clumsy_check = 0 //Admin spawn only, might as well let clowns use it. + var/charge_tick = 0 + var/recharge_time = 5 //Time it takes for shots to recharge (in ticks) + + New() + ..() + processing_objects.Add(src) + + + Del() + processing_objects.Remove(src) + ..() + + process() + charge_tick++ + if(charge_tick < recharge_time) return 0 + charge_tick = 0 + if(!power_supply) return 0 + power_supply.give(100) + + update_icon() + return + + +/obj/item/weapon/gun/energy/meteorgun/pen + name = "meteor pen" + desc = "The pen is mightier than the sword." + icon = 'icons/obj/bureaucracy.dmi' + icon_state = "pen" + item_state = "pen" + w_class = 1 \ No newline at end of file diff --git a/code/modules/projectiles/guns/energy/stun.dm b/code/modules/projectiles/guns/energy/stun.dm index a4edec8a8a3..cbffb4f3ed4 100644 --- a/code/modules/projectiles/guns/energy/stun.dm +++ b/code/modules/projectiles/guns/energy/stun.dm @@ -17,7 +17,7 @@ projectile_type = "/obj/item/projectile/energy/electrode" cell_type = "/obj/item/weapon/cell/secborg" var/charge_tick = 0 - var/recharge_time = 10 //Time it takes for shots to recharge (in seconds) + var/recharge_time = 10 //Time it takes for shots to recharge (in ticks) New() ..() @@ -28,7 +28,7 @@ processing_objects.Remove(src) ..() - process() //Every [recharge_time] seconds, recharge a shot for the cyborg + process() //Every [recharge_time] ticks, recharge a shot for the cyborg charge_tick++ if(charge_tick < recharge_time) return 0 charge_tick = 0 diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm index e9b64f7cc04..8a9d20262d6 100644 --- a/code/modules/projectiles/projectile/special.dm +++ b/code/modules/projectiles/projectile/special.dm @@ -39,6 +39,36 @@ M.bodytemperature = temperature return 1 +/obj/item/projectile/meteor + name = "meteor" + icon = 'icons/obj/meteor.dmi' + icon_state = "smallf" + damage = 0 + damage_type = BRUTE + nodamage = 1 + flag = "bullet" + + Bump(atom/A as mob|obj|turf|area) + if(A == firer) + loc = A.loc + return + + sleep(-1) //Might not be important enough for a sleep(-1) but the sleep/spawn itself is necessary thanks to explosions and metoerhits + + if(src)//Do not add to this if() statement, otherwise the meteor won't delete them + if(A) + + A.meteorhit(src) + playsound(src.loc, 'sound/effects/meteorimpact.ogg', 40, 1) + + for(var/mob/M in range(10, src)) + if(!M.stat && !istype(M, /mob/living/silicon/ai))\ + shake_camera(M, 3, 1) + del(src) + return 1 + else + return 0 + /obj/item/projectile/energy/floramut name = "alpha somatoray" icon_state = "energy"