Merge pull request #8073 from Loganbacca/projectilescleanup

Code cleanup
This commit is contained in:
Ccomp5950
2015-02-07 00:17:24 -05:00
2 changed files with 197 additions and 201 deletions

View File

@@ -50,7 +50,7 @@
var/agony = 0
var/embed = 0 // whether or not the projectile can embed itself in the mob
proc/on_hit(var/atom/target, var/blocked = 0)
/obj/item/projectile/proc/on_hit(var/atom/target, var/blocked = 0)
if(blocked >= 2) return 0//Full block
if(!isliving(target)) return 0
if(isanimal(target)) return 0
@@ -58,7 +58,7 @@
L.apply_effects(stun, weaken, paralyze, irradiate, stutter, eyeblur, drowsy, agony, blocked) // add in AGONY!
return 1
proc/check_fire(var/mob/living/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not.
/obj/item/projectile/proc/check_fire(var/mob/living/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not.
if(!istype(target) || !istype(user))
return 0
var/obj/item/projectile/test/in_chamber = new /obj/item/projectile/test(get_step_to(user,target)) //Making the test....
@@ -70,7 +70,7 @@
del(in_chamber) //No need for it anymore
return output //Send it back to the gun!
Bump(atom/A as mob|obj|turf|area)
/obj/item/projectile/Bump(atom/A as mob|obj|turf|area)
if(A == firer)
loc = A.loc
return 0 //cannot shoot yourself
@@ -131,8 +131,7 @@
del(src)
return 1
CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
/obj/item/projectile/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
if(istype(mover, /obj/item/projectile))
@@ -140,8 +139,7 @@
else
return 1
process()
/obj/item/projectile/process()
if(kill_count < 1)
del(src)
kill_count--
@@ -167,7 +165,7 @@
var/target = null
var/result = 0 //To pass the message back to the gun.
Bump(atom/A as mob|obj|turf|area)
/obj/item/projectile/test/Bump(atom/A as mob|obj|turf|area)
if(A == firer)
loc = A.loc
return //cannot shoot yourself
@@ -179,7 +177,7 @@
result = 1
return
process()
/obj/item/projectile/test/process()
var/turf/curloc = get_turf(src)
var/turf/targloc = get_turf(target)
if(!curloc || !targloc)

View File

@@ -17,7 +17,8 @@ var/list/beam_master = list()
flag = "laser"
eyeblur = 4
var/frequency = 1
process()
/obj/item/projectile/beam/process()
var/reference = "\ref[src]" //So we do not have to recalculate it a ton
var/first = 1 //So we don't make the overlay in the same tile as the firer
spawn while(src) //Move until we hit something
@@ -66,11 +67,11 @@ var/list/beam_master = list()
cleanup(reference)
return
Del()
/obj/item/projectile/beam/Del()
cleanup("\ref[src]")
..()
proc/cleanup(reference) //Waits .3 seconds then removes the overlay.
/obj/item/projectile/beam/proc/cleanup(reference) //Waits .3 seconds then removes the overlay.
src = null //we're getting deleted! this will keep the code running
spawn(3)
var/list/turf_master = beam_master[reference]
@@ -89,7 +90,6 @@ var/list/beam_master = list()
flag = "laser"
eyeblur = 2
/obj/item/projectile/beam/heavylaser
name = "heavy laser"
icon_state = "heavylaser"
@@ -105,13 +105,11 @@ var/list/beam_master = list()
icon_state = "u_laser"
damage = 50
/obj/item/projectile/beam/emitter
name = "emitter beam"
icon_state = "emitter"
damage = 30
/obj/item/projectile/beam/lastertag/blue
name = "lasertag beam"
icon_state = "bluelaser"
@@ -120,7 +118,7 @@ var/list/beam_master = list()
damage_type = BURN
flag = "laser"
on_hit(var/atom/target, var/blocked = 0)
/obj/item/projectile/beam/lastertag/blue/on_hit(var/atom/target, var/blocked = 0)
if(istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/M = target
if(istype(M.wear_suit, /obj/item/clothing/suit/redtag))
@@ -135,7 +133,7 @@ var/list/beam_master = list()
damage_type = BURN
flag = "laser"
on_hit(var/atom/target, var/blocked = 0)
/obj/item/projectile/beam/lastertag/red/on_hit(var/atom/target, var/blocked = 0)
if(istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/M = target
if(istype(M.wear_suit, /obj/item/clothing/suit/bluetag))
@@ -150,7 +148,7 @@ var/list/beam_master = list()
damage_type = BURN
flag = "laser"
on_hit(var/atom/target, var/blocked = 0)
/obj/item/projectile/beam/lastertag/omni/on_hit(var/atom/target, var/blocked = 0)
if(istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/M = target
if((istype(M.wear_suit, /obj/item/clothing/suit/bluetag))||(istype(M.wear_suit, /obj/item/clothing/suit/redtag)))