polishing

This commit is contained in:
DeityLink
2015-08-10 01:05:04 +02:00
parent 92a84648e4
commit 182ef129d0
6 changed files with 98 additions and 42 deletions

View File

@@ -50,7 +50,7 @@ obj/item/weapon/gun/energy/laser/retro
item_state = null
inhand_states = list("left_hand" = 'icons/mob/in-hand/left/guninhands_left.dmi', "right_hand" = 'icons/mob/in-hand/right/guninhands_right.dmi')
desc = "An older model of the basic lasergun, no longer used by Nanotrasen's security or military forces. Nevertheless, it is still quite deadly and easy to maintain, making it a favorite amongst pirates and other outlaws."
projectile_type = /obj/item/projectile/beam/retro
/obj/item/weapon/gun/energy/laser/captain
icon_state = "caplaser"

View File

@@ -266,17 +266,16 @@ var/list/impact_master = list()
for(var/mob/M in A)
M.bullet_act(src, def_zone)
if(bounces || phases)
//the bullets first checks if it can bounce off the obstacle, and if it cannot it then checks if it can phase through it, if it cannot either then it dies.
var/reaction_type = A.projectile_check()
if(bounces && (bounce_type & reaction_type))
rebound(A)
bounces--
return 1
else if(phases && (phase_type & reaction_type))
src.forceMove(get_step(src.loc,dir))
phases--
return 1
//the bullets first checks if it can bounce off the obstacle, and if it cannot it then checks if it can phase through it, if it cannot either then it dies.
var/reaction_type = A.projectile_check()
if(bounces && (bounce_type & reaction_type))
rebound(A)
bounces--
return 1
else if(phases && (phase_type & reaction_type))
src.forceMove(get_step(src.loc,dir))
phases--
return 1
bullet_die()
return 1

View File

@@ -15,6 +15,10 @@ var/list/beam_master = list()
/obj/item/projectile/beam/captain
name = "captain laser"
damage = 40
linear_movement = 0
/obj/item/projectile/beam/retro
linear_movement = 0
/obj/item/projectile/beam/lightning
invisibility = 101
@@ -217,7 +221,7 @@ var/list/beam_master = list()
icon_state = "laser"
invisibility = 101
animate_movement = 2
linear_movement = 0
linear_movement = 1
layer = 13
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
@@ -227,8 +231,34 @@ var/list/beam_master = list()
eyeblur = 4
var/frequency = 1
/obj/item/projectile/beam/OnFired()
return ..()
/obj/item/projectile/beam/OnFired() //if assigned, allows for code when the projectile gets fired
target = get_turf(original)
dist_x = abs(target.x - starting.x)
dist_y = abs(target.y - starting.y)
override_starting_X = starting.x
override_starting_Y = starting.y
override_target_X = target.x
override_target_Y = target.y
if (target.x > starting.x)
dx = EAST
else
dx = WEST
if (target.y > starting.y)
dy = NORTH
else
dy = SOUTH
if(dist_x > dist_y)
error = dist_x/2 - dist_y
else
error = dist_y/2 - dist_x
target_angle = round(Get_Angle(starting,target))
return 1
/obj/item/projectile/beam/process()
var/lastposition = loc
@@ -294,32 +324,56 @@ var/list/beam_master = list()
if(bump_original_check())
return reference
update_pixel()
if(linear_movement)
update_pixel()
//If the icon has not been added yet
if( !("[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]" in beam_master) )
var/image/I = image(icon,"[icon_state]_pixel",13,target_dir) //Generate it.
I.transform = turn(I.transform, target_angle+45)
I.pixel_x = PixelX
I.pixel_y = PixelY
beam_master["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"] = I //And cache it!
//If the icon has not been added yet
if( !("[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]" in beam_master) )
var/image/I = image(icon,"[icon_state]_pixel",13,target_dir) //Generate it.
I.transform = turn(I.transform, target_angle+45)
I.pixel_x = PixelX
I.pixel_y = PixelY
beam_master["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"] = I //And cache it!
//Finally add the overlay
if(src.loc && target_dir)
src.loc.overlays += beam_master["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"]
//Finally add the overlay
if(src.loc && target_dir)
src.loc.overlays += beam_master["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"]
//Add the turf to a list in the beam master so they can be cleaned up easily.
if(reference in beam_master)
var/list/turf_master = beam_master[reference]
if("[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]" in turf_master)
var/list/turfs = turf_master["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"]
turfs += loc
//Add the turf to a list in the beam master so they can be cleaned up easily.
if(reference in beam_master)
var/list/turf_master = beam_master[reference]
if("[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]" in turf_master)
var/list/turfs = turf_master["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"]
turfs += loc
else
turf_master["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"] = list(loc)
else
turf_master["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"] = list(loc)
else
var/list/turfs = list()
turfs["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"] = list(loc)
beam_master[reference] = turfs
var/list/turfs = list()
turfs["[icon_state]_angle[target_angle]_pX[PixelX]_pY[PixelY]"] = list(loc)
beam_master[reference] = turfs
else
//If the icon has not been added yet
if( !("[icon_state][target_dir]" in beam_master) )
var/image/I = image(icon,icon_state,10,target_dir) //Generate it.
beam_master["[icon_state][target_dir]"] = I //And cache it!
//Finally add the overlay
if(src.loc && target_dir)
src.loc.overlays += beam_master["[icon_state][target_dir]"]
//Add the turf to a list in the beam master so they can be cleaned up easily.
if(reference in beam_master)
var/list/turf_master = beam_master[reference]
if("[icon_state][target_dir]" in turf_master)
var/list/turfs = turf_master["[icon_state][target_dir]"]
turfs += loc
else
turf_master["[icon_state][target_dir]"] = list(loc)
else
var/list/turfs = list()
turfs["[icon_state][target_dir]"] = list(loc)
beam_master[reference] = turfs
return reference

View File

@@ -416,6 +416,7 @@
icon = 'icons/obj/lightning.dmi'
icon_state = "heatray"
animate_movement = 0
linear_movement = 0
pass_flags = PASSTABLE
var/drawn = 0
var/tang = 0