Telegun Refactor

This commit is contained in:
Fox-McCloud
2015-09-23 00:44:50 -04:00
parent 13e0cec40b
commit cf5bfcaac1
4 changed files with 48 additions and 19 deletions
@@ -381,19 +381,6 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
update_icon()
return 1
// Telegun for Tator RDs
/obj/item/weapon/gun/energy/telegun
name = "Teleporter Gun"
desc = "An extremely high-tech bluespace energy gun capable of teleporting targets to far off locations."
icon_state = "telegun"
item_state = "ionrifle"
fire_sound = 'sound/weapons/wave.ogg'
origin_tech = "combat=6;materials=7;powerstorage=5;bluespace=5;syndicate=4"
cell_type = "/obj/item/weapon/stock_parts/cell/crap"
projectile_type = "/obj/item/projectile/energy/teleport"
charge_cost = 1250
/* 3d printer 'pseudo guns' for borgs */
/obj/item/weapon/gun/energy/printer
@@ -0,0 +1,39 @@
// Telegun for Tator RDs
/obj/item/weapon/gun/energy/telegun
name = "Teleporter Gun"
desc = "An extremely high-tech bluespace energy gun capable of teleporting targets to far off locations."
icon_state = "telegun"
item_state = "ionrifle"
fire_sound = 'sound/weapons/wave.ogg'
origin_tech = "combat=6;materials=7;powerstorage=5;bluespace=5;syndicate=4"
cell_type = "/obj/item/weapon/stock_parts/cell/crap"
projectile_type = "/obj/item/projectile/energy/teleport"
charge_cost = 1250
var/teleport_target = null
/obj/item/weapon/gun/energy/telegun/Destroy()
teleport_target = null
return ..()
/obj/item/weapon/gun/energy/telegun/attack_self(mob/living/user as mob)
var/list/L = list()
var/list/areaindex = list()
for(var/obj/item/device/radio/beacon/R in beacons)
var/turf/T = get_turf(R)
if (!T)
continue
if((T.z in config.admin_levels) || T.z > 7)
continue
if(R.syndicate == 1)
continue
var/tmpname = T.loc.name
if(areaindex[tmpname])
tmpname = "[tmpname] ([++areaindex[tmpname]])"
else
areaindex[tmpname] = 1
L[tmpname] = R
var/desc = input("Please select a location to lock in.", "Telegun Target Interface") in L
teleport_target = L[desc]
@@ -269,15 +269,17 @@ obj/item/projectile/kinetic/New()
icon_state = "bluespace"
damage = 0
nodamage = 1
var/obj/item/weapon/gun/energy/telegun/T = null
var/teleport_target = null
OnFired()
T = shot_from
teleport_target = T.teleport_target
/obj/item/projectile/energy/teleport/on_hit(var/atom/target, var/blocked = 0)
if(isliving(target))
var/obj/item/device/radio/beacon/teletarget = null
for(var/obj/machinery/computer/teleporter/com in machines)
if(com.target)
teletarget = com.target
if(teletarget)
do_teleport(target, teletarget, 0)//teleport what's in the tile to the beacon
if(teleport_target)
do_teleport(target, teleport_target, 0)//teleport what's in the tile to the beacon
else
do_teleport(target, target, 15) //Otherwise it just warps you off somewhere.