mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 03:33:21 +00:00
Merge pull request #8073 from Loganbacca/projectilescleanup
Code cleanup
This commit is contained in:
@@ -50,7 +50,7 @@
|
|||||||
var/agony = 0
|
var/agony = 0
|
||||||
var/embed = 0 // whether or not the projectile can embed itself in the mob
|
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(blocked >= 2) return 0//Full block
|
||||||
if(!isliving(target)) return 0
|
if(!isliving(target)) return 0
|
||||||
if(isanimal(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!
|
L.apply_effects(stun, weaken, paralyze, irradiate, stutter, eyeblur, drowsy, agony, blocked) // add in AGONY!
|
||||||
return 1
|
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))
|
if(!istype(target) || !istype(user))
|
||||||
return 0
|
return 0
|
||||||
var/obj/item/projectile/test/in_chamber = new /obj/item/projectile/test(get_step_to(user,target)) //Making the test....
|
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
|
del(in_chamber) //No need for it anymore
|
||||||
return output //Send it back to the gun!
|
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)
|
if(A == firer)
|
||||||
loc = A.loc
|
loc = A.loc
|
||||||
return 0 //cannot shoot yourself
|
return 0 //cannot shoot yourself
|
||||||
@@ -131,8 +131,7 @@
|
|||||||
del(src)
|
del(src)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
/obj/item/projectile/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||||
CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
|
||||||
if(air_group || (height==0)) return 1
|
if(air_group || (height==0)) return 1
|
||||||
|
|
||||||
if(istype(mover, /obj/item/projectile))
|
if(istype(mover, /obj/item/projectile))
|
||||||
@@ -140,8 +139,7 @@
|
|||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
/obj/item/projectile/process()
|
||||||
process()
|
|
||||||
if(kill_count < 1)
|
if(kill_count < 1)
|
||||||
del(src)
|
del(src)
|
||||||
kill_count--
|
kill_count--
|
||||||
@@ -167,7 +165,7 @@
|
|||||||
var/target = null
|
var/target = null
|
||||||
var/result = 0 //To pass the message back to the gun.
|
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)
|
if(A == firer)
|
||||||
loc = A.loc
|
loc = A.loc
|
||||||
return //cannot shoot yourself
|
return //cannot shoot yourself
|
||||||
@@ -179,7 +177,7 @@
|
|||||||
result = 1
|
result = 1
|
||||||
return
|
return
|
||||||
|
|
||||||
process()
|
/obj/item/projectile/test/process()
|
||||||
var/turf/curloc = get_turf(src)
|
var/turf/curloc = get_turf(src)
|
||||||
var/turf/targloc = get_turf(target)
|
var/turf/targloc = get_turf(target)
|
||||||
if(!curloc || !targloc)
|
if(!curloc || !targloc)
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ var/list/beam_master = list()
|
|||||||
flag = "laser"
|
flag = "laser"
|
||||||
eyeblur = 4
|
eyeblur = 4
|
||||||
var/frequency = 1
|
var/frequency = 1
|
||||||
process()
|
|
||||||
|
/obj/item/projectile/beam/process()
|
||||||
var/reference = "\ref[src]" //So we do not have to recalculate it a ton
|
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
|
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
|
spawn while(src) //Move until we hit something
|
||||||
@@ -66,11 +67,11 @@ var/list/beam_master = list()
|
|||||||
cleanup(reference)
|
cleanup(reference)
|
||||||
return
|
return
|
||||||
|
|
||||||
Del()
|
/obj/item/projectile/beam/Del()
|
||||||
cleanup("\ref[src]")
|
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
|
src = null //we're getting deleted! this will keep the code running
|
||||||
spawn(3)
|
spawn(3)
|
||||||
var/list/turf_master = beam_master[reference]
|
var/list/turf_master = beam_master[reference]
|
||||||
@@ -89,7 +90,6 @@ var/list/beam_master = list()
|
|||||||
flag = "laser"
|
flag = "laser"
|
||||||
eyeblur = 2
|
eyeblur = 2
|
||||||
|
|
||||||
|
|
||||||
/obj/item/projectile/beam/heavylaser
|
/obj/item/projectile/beam/heavylaser
|
||||||
name = "heavy laser"
|
name = "heavy laser"
|
||||||
icon_state = "heavylaser"
|
icon_state = "heavylaser"
|
||||||
@@ -105,13 +105,11 @@ var/list/beam_master = list()
|
|||||||
icon_state = "u_laser"
|
icon_state = "u_laser"
|
||||||
damage = 50
|
damage = 50
|
||||||
|
|
||||||
|
|
||||||
/obj/item/projectile/beam/emitter
|
/obj/item/projectile/beam/emitter
|
||||||
name = "emitter beam"
|
name = "emitter beam"
|
||||||
icon_state = "emitter"
|
icon_state = "emitter"
|
||||||
damage = 30
|
damage = 30
|
||||||
|
|
||||||
|
|
||||||
/obj/item/projectile/beam/lastertag/blue
|
/obj/item/projectile/beam/lastertag/blue
|
||||||
name = "lasertag beam"
|
name = "lasertag beam"
|
||||||
icon_state = "bluelaser"
|
icon_state = "bluelaser"
|
||||||
@@ -120,7 +118,7 @@ var/list/beam_master = list()
|
|||||||
damage_type = BURN
|
damage_type = BURN
|
||||||
flag = "laser"
|
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))
|
if(istype(target, /mob/living/carbon/human))
|
||||||
var/mob/living/carbon/human/M = target
|
var/mob/living/carbon/human/M = target
|
||||||
if(istype(M.wear_suit, /obj/item/clothing/suit/redtag))
|
if(istype(M.wear_suit, /obj/item/clothing/suit/redtag))
|
||||||
@@ -135,7 +133,7 @@ var/list/beam_master = list()
|
|||||||
damage_type = BURN
|
damage_type = BURN
|
||||||
flag = "laser"
|
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))
|
if(istype(target, /mob/living/carbon/human))
|
||||||
var/mob/living/carbon/human/M = target
|
var/mob/living/carbon/human/M = target
|
||||||
if(istype(M.wear_suit, /obj/item/clothing/suit/bluetag))
|
if(istype(M.wear_suit, /obj/item/clothing/suit/bluetag))
|
||||||
@@ -150,7 +148,7 @@ var/list/beam_master = list()
|
|||||||
damage_type = BURN
|
damage_type = BURN
|
||||||
flag = "laser"
|
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))
|
if(istype(target, /mob/living/carbon/human))
|
||||||
var/mob/living/carbon/human/M = target
|
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)))
|
if((istype(M.wear_suit, /obj/item/clothing/suit/bluetag))||(istype(M.wear_suit, /obj/item/clothing/suit/redtag)))
|
||||||
|
|||||||
Reference in New Issue
Block a user