Merge branch 'master' into upstream-merge-32311

This commit is contained in:
LetterJay
2017-12-29 18:38:50 -06:00
committed by GitHub
302 changed files with 4918 additions and 20468 deletions
@@ -2,7 +2,6 @@
/obj/item/ammo_box/magazine/internal
desc = "Oh god, this shouldn't be here"
flags_1 = CONDUCT_1|ABSTRACT_1
//internals magazines are accessible, so replace spent ammo if full when trying to put a live one in
/obj/item/ammo_box/magazine/internal/give_round(obj/item/ammo_casing/R)
+3 -4
View File
@@ -155,10 +155,10 @@
return
//Exclude lasertag guns from the CLUMSY check.
//Exclude lasertag guns from the DISABILITY_CLUMSY check.
if(clumsy_check)
if(istype(user))
if (user.has_disability(CLUMSY) && prob(40))
if (user.has_disability(DISABILITY_CLUMSY) && prob(40))
to_chat(user, "<span class='userdanger'>You shoot yourself in the foot with [src]!</span>")
var/shot_leg = pick("l_leg", "r_leg")
process_fire(user,user,0,params, zone_override = shot_leg)
@@ -400,8 +400,7 @@
/obj/item/gun/dropped(mob/user)
..()
if(zoomed)
zoom(user,FALSE)
zoom(user,FALSE)
if(azoom)
azoom.Remove(user)
if(alight)
@@ -349,7 +349,7 @@
clumsy_check = 0
/obj/item/gun/ballistic/revolver/reverse/can_trigger_gun(mob/living/user)
if((user.has_disability(CLUMSY)) || (user.mind && user.mind.assigned_role == "Clown"))
if((user.has_disability(DISABILITY_CLUMSY)) || (user.mind && user.mind.assigned_role == "Clown"))
return ..()
if(process_fire(user, user, 0, zone_override = "head"))
user.visible_message("<span class='warning'>[user] somehow manages to shoot [user.p_them()]self in the face!</span>", "<span class='userdanger'>You somehow shoot yourself in the face! How the hell?!</span>")
+161 -71
View File
@@ -4,6 +4,9 @@
#define ZOOM_LOCK_CENTER_VIEW 2
#define ZOOM_LOCK_OFF 3
#define ZOOM_SPEED_STEP 0
#define ZOOM_SPEED_INSTANT 1
#define AUTOZOOM_PIXEL_STEP_FACTOR 48
#define AIMING_BEAM_ANGLE_CHANGE_THRESHOLD 0.1
@@ -42,7 +45,7 @@
var/lastangle = 0
var/aiming_lastangle = 0
var/mob/current_user = null
var/list/obj/effect/projectile_beam/current_tracers
var/obj/effect/projectile_beam/current_tracer
var/structure_piercing = 2 //Amount * 2. For some reason structures aren't respecting this unless you have it doubled. Probably with the objects in question's Bump() code instead of this but I'll deal with this later.
var/structure_bleed_coeff = 0.7
@@ -60,14 +63,15 @@
var/projectile_setting_pierce = TRUE
var/delay = 65
var/lastfire = 0
var/lastprocess = 0
//ZOOMING
var/zoom_current_view_increase = 0
var/zoom_target_view_increase = 10
var/zoom_speed = ZOOM_SPEED_STEP
var/zooming = FALSE
var/zoom_lock = ZOOM_LOCK_OFF
var/zoom_lock = ZOOM_LOCK_AUTOZOOM_FREEMOVE
var/zooming_angle
var/current_zoom_x = 0
var/current_zoom_y = 0
@@ -76,6 +80,7 @@
var/static/image/charged_overlay = image(icon = 'icons/obj/guns/energy.dmi', icon_state = "esniper_charged")
var/static/image/drained_overlay = image(icon = 'icons/obj/guns/energy.dmi', icon_state = "esniper_empty")
var/datum/action/item_action/zoom_speed_action/zoom_speed_action
var/datum/action/item_action/zoom_lock_action/zoom_lock_action
/obj/item/gun/energy/beam_rifle/debug
@@ -98,6 +103,15 @@
. = ..()
/obj/item/gun/energy/beam_rifle/ui_action_click(owner, action)
if(istype(action, /datum/action/item_action/zoom_speed_action))
zoom_speed++
if(zoom_speed > 1)
zoom_speed = ZOOM_SPEED_STEP
switch(zoom_speed)
if(ZOOM_SPEED_STEP)
to_chat(owner, "<span class='boldnotice'>You switch [src]'s digital zoom to stepper mode.</span>")
if(ZOOM_SPEED_INSTANT)
to_chat(owner, "<span class='boldnotice'>You switch [src]'s digital zoom to instant mode.</span>")
if(istype(action, /datum/action/item_action/zoom_lock_action))
zoom_lock++
if(zoom_lock > 3)
@@ -121,6 +135,8 @@
var/total_time = SSfastprocess.wait
if(delay_override)
total_time = delay_override
if(zoom_speed == ZOOM_SPEED_INSTANT)
total_time = 0
zoom_animating = total_time
animate(current_user.client, pixel_x = current_zoom_x, pixel_y = current_zoom_y , total_time, SINE_EASING, ANIMATION_PARALLEL)
zoom_animating = 0
@@ -134,10 +150,18 @@
/obj/item/gun/energy/beam_rifle/proc/handle_zooming()
if(!zooming || !check_user())
return
current_user.client.change_view(world.view + zoom_target_view_increase)
zoom_current_view_increase = zoom_target_view_increase
if(zoom_speed == ZOOM_SPEED_INSTANT)
current_user.client.change_view(world.view + zoom_target_view_increase)
zoom_current_view_increase = zoom_target_view_increase
set_autozoom_pixel_offsets_immediate(zooming_angle)
smooth_zooming()
return
if(zoom_current_view_increase > zoom_target_view_increase)
return
zoom_current_view_increase++
current_user.client.change_view(zoom_current_view_increase + world.view)
set_autozoom_pixel_offsets_immediate(zooming_angle)
smooth_zooming()
smooth_zooming(SSfastprocess.wait * zoom_target_view_increase * zoom_speed)
/obj/item/gun/energy/beam_rifle/proc/start_zooming()
if(zoom_lock == ZOOM_LOCK_OFF)
@@ -145,9 +169,8 @@
zooming = TRUE
/obj/item/gun/energy/beam_rifle/proc/stop_zooming()
if(zooming)
zooming = FALSE
reset_zooming()
zooming = FALSE
reset_zooming()
/obj/item/gun/energy/beam_rifle/proc/reset_zooming()
if(!check_user(FALSE))
@@ -181,14 +204,14 @@
/obj/item/gun/energy/beam_rifle/Initialize()
. = ..()
current_tracers = list()
START_PROCESSING(SSprojectiles, src)
zoom_speed_action = new(src)
zoom_lock_action = new(src)
/obj/item/gun/energy/beam_rifle/Destroy()
STOP_PROCESSING(SSfastprocess, src)
set_user(null)
QDEL_LIST(current_tracers)
QDEL_NULL(current_tracer)
return ..()
/obj/item/gun/energy/beam_rifle/emp_act(severity)
@@ -222,7 +245,6 @@
/obj/item/gun/energy/beam_rifle/process()
if(!aiming)
last_process = world.time
return
check_user()
handle_zooming()
@@ -277,7 +299,7 @@
set waitfor = FALSE
aiming_time_left = aiming_time
aiming = FALSE
QDEL_LIST(current_tracers)
QDEL_NULL(current_tracer)
stop_zooming()
/obj/item/gun/energy/beam_rifle/proc/set_user(mob/user)
@@ -319,7 +341,7 @@
sync_ammo()
afterattack(M.client.mouseObject, M, FALSE, M.client.mouseParams, passthrough = TRUE)
stop_aiming()
QDEL_LIST(current_tracers)
QDEL_NULL(current_tracer)
return ..()
/obj/item/gun/energy/beam_rifle/afterattack(atom/target, mob/living/user, flag, params, passthrough = FALSE)
@@ -533,103 +555,136 @@
handle_impact(target)
/obj/item/projectile/beam/beam_rifle/Collide(atom/target)
paused = TRUE
if(check_pierce(target))
permutated += target
return FALSE
if(!QDELETED(target))
cached = get_turf(target)
paused = FALSE
. = ..()
/obj/item/projectile/beam/beam_rifle/on_hit(atom/target, blocked = FALSE)
paused = TRUE
if(!QDELETED(target))
cached = get_turf(target)
handle_hit(target)
paused = FALSE
. = ..()
/obj/item/projectile/beam/beam_rifle/hitscan
icon_state = ""
var/tracer_type = /obj/effect/projectile_beam/tracer
var/list/beam_segments //assoc list of datum/point or datum/point/vector, start = end.
var/starting_z
var/starting_p_x
var/starting_p_y
var/constant_tracer = FALSE
var/beam_index
var/travelled_p_x = 0
var/travelled_p_y = 0
var/tracer_spawned = FALSE
/obj/item/projectile/beam/beam_rifle/hitscan/Destroy()
if(loc)
var/datum/point/pcache = trajectory.copy_to()
beam_segments[beam_index] = pcache
generate_tracers(constant_tracer)
paused = TRUE //STOP HITTING WHEN YOU'RE ALREADY BEING DELETED!
spawn_tracer(constant_tracer)
return ..()
/obj/item/projectile/beam/beam_rifle/hitscan/Collide(atom/target)
var/datum/point/pcache = trajectory.copy_to()
. = ..()
if(. && !QDELETED(src)) //successful touch and not destroyed.
beam_segments[beam_index] = pcache
beam_index = pcache
beam_segments[beam_index] = null
/obj/item/projectile/beam/beam_rifle/hitscan/before_z_change(turf/oldloc, turf/newloc)
var/datum/point/pcache = trajectory.copy_to()
beam_segments[beam_index] = pcache
beam_index = RETURN_PRECISE_POINT(newloc)
beam_segments[beam_index] = null
return ..()
/obj/item/projectile/beam/beam_rifle/hitscan/proc/generate_tracers(highlander = FALSE, cleanup = TRUE)
set waitfor = FALSE
if(highlander && istype(gun))
QDEL_LIST(gun.current_tracers)
for(var/datum/point/p in beam_segments)
gun.current_tracers += generate_projectile_beam_between_points(p, beam_segments[p], tracer_type, color, 0)
/obj/item/projectile/beam/beam_rifle/hitscan/proc/spawn_tracer(put_in_rifle = FALSE)
if(tracer_spawned)
return
tracer_spawned = TRUE
//Remind me to port baystation trajectories so this shit isn't needed...
var/pixels_travelled = round(sqrt(travelled_p_x**2 + travelled_p_y**2),1)
var/scaling = pixels_travelled/world.icon_size
var/midpoint_p_x = round(starting_p_x + (travelled_p_x / 2))
var/midpoint_p_y = round(starting_p_y + (travelled_p_y / 2))
var/tracer_px = midpoint_p_x % world.icon_size
var/tracer_py = midpoint_p_y % world.icon_size
var/tracer_lx = (midpoint_p_x - tracer_px) / world.icon_size
var/tracer_ly = (midpoint_p_y - tracer_py) / world.icon_size
var/obj/effect/projectile_beam/PB = new tracer_type(src)
PB.apply_vars(Angle, tracer_px, tracer_py, color, scaling, locate(tracer_lx,tracer_ly,starting_z))
if(put_in_rifle && istype(gun))
if(gun.current_tracer)
QDEL_NULL(gun.current_tracer)
gun.current_tracer = PB
else
for(var/datum/point/p in beam_segments)
generate_projectile_beam_between_points(p, beam_segments[p], tracer_type, color, 5)
if(cleanup)
QDEL_LIST(beam_segments)
beam_segments = null
QDEL_NULL(beam_index)
QDEL_IN(PB, 5)
/obj/item/projectile/beam/beam_rifle/hitscan/proc/check_for_turf_edge(turf/T)
if(!istype(T))
return TRUE
var/tx = T.x
var/ty = T.y
if(tx < 10 || tx > (world.maxx - 10) || ty < 10 || ty > (world.maxy-10))
return TRUE
return FALSE
/obj/item/projectile/beam/beam_rifle/hitscan/fire(setAngle, atom/direct_target) //oranges didn't let me make this a var the first time around so copypasta time
set waitfor = FALSE
var/turf/starting = get_turf(src)
trajectory = new(starting.x, starting.y, starting.z, 0, 0, setAngle? setAngle : Angle, 33)
set waitfor = 0
if(!log_override && firer && original)
add_logs(firer, original, "fired at", src, " [get_area(src)]")
fired = TRUE
if(setAngle)
Angle = setAngle
var/next_run = world.time
var/old_pixel_x = pixel_x
var/old_pixel_y = pixel_y
var/safety = 0 //The code works fine, but... just in case...
var/turf/c2
beam_segments = list() //initialize segment list with the list for the first segment
beam_index = RETURN_PRECISE_POINT(src)
beam_segments[beam_index] = null //record start.
if(spread)
Angle += (rand() - 0.5) * spread
var/starting_x = loc.x
var/starting_y = loc.y
starting_z = loc.z
starting_p_x = starting_x * world.icon_size + pixel_x
starting_p_y = starting_y * world.icon_size + pixel_y
while(loc)
if(paused || QDELETED(src))
return
if(++safety > (range * 3)) //If it's looping for way, way too long...
qdel(src)
stack_trace("WARNING: [type] projectile encountered infinite recursion in [__FILE__]/[__LINE__]!")
return //Kill!
if(spread)
Angle += (rand() - 0.5) * spread
var/matrix/M = new
M.Turn(Angle)
transform = M
trajectory.increment()
var/turf/T = trajectory.return_turf()
if(T.z != loc.z)
before_z_change(loc, T)
trajectory_ignore_forcemove = TRUE
forceMove(T)
trajectory_ignore_forcemove = FALSE
var/Pixel_x=sin(Angle)+16*sin(Angle)*2
var/Pixel_y=cos(Angle)+16*cos(Angle)*2
travelled_p_x += Pixel_x
travelled_p_y += Pixel_y
var/pixel_x_offset = old_pixel_x + Pixel_x
var/pixel_y_offset = old_pixel_y + Pixel_y
var/new_x = x
var/new_y = y
while(pixel_x_offset > 16)
pixel_x_offset -= 32
old_pixel_x -= 32
new_x++// x++
while(pixel_x_offset < -16)
pixel_x_offset += 32
old_pixel_x += 32
new_x--
while(pixel_y_offset > 16)
pixel_y_offset -= 32
old_pixel_y -= 32
new_y++
while(pixel_y_offset < -16)
pixel_y_offset += 32
old_pixel_y += 32
new_y--
pixel_x = old_pixel_x
pixel_y = old_pixel_y
step_towards(src, locate(new_x, new_y, z))
next_run += max(world.tick_lag, speed)
var/delay = next_run - world.time
if(delay <= world.tick_lag*2)
pixel_x = pixel_x_offset
pixel_y = pixel_y_offset
else
step_towards(src, T)
animate(src, pixel_x = trajectory.return_px(), pixel_y = trajectory.return_py(), time = 1, flags = ANIMATION_END_NOW)
animate(src, pixel_x = pixel_x_offset, pixel_y = pixel_y_offset, time = max(1, (delay <= 3 ? delay - 1 : delay)), flags = ANIMATION_END_NOW)
old_pixel_x = pixel_x_offset
old_pixel_y = pixel_y_offset
if(can_hit_target(original, permutated))
Collide(original)
c2 = loc
Range()
c2 = get_turf(src)
if(check_for_turf_edge(loc))
spawn_tracer(constant_tracer)
if(istype(c2))
cached = c2
@@ -649,3 +704,38 @@
/obj/item/projectile/beam/beam_rifle/hitscan/aiming_beam/on_hit()
qdel(src)
return FALSE
/obj/effect/projectile_beam
icon = 'icons/obj/projectiles.dmi'
layer = ABOVE_MOB_LAYER
anchored = TRUE
light_power = 1
light_range = 2
light_color = "#00ffff"
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
flags_1 = ABSTRACT_1
appearance_flags = 0
/obj/effect/projectile_beam/tracer
icon_state = "tracer_beam"
/obj/effect/projectile_beam/tracer/aiming
icon_state = "gbeam"
/datum/action/item_action/zoom_speed_action
name = "Toggle Zooming Speed"
icon_icon = 'icons/mob/actions/actions_spells.dmi'
button_icon_state = "projectile"
background_icon_state = "bg_tech"
/datum/action/item_action/zoom_lock_action
name = "Switch Zoom Mode"
icon_icon = 'icons/mob/actions/actions_items.dmi'
button_icon_state = "zoom_mode"
background_icon_state = "bg_tech"
/obj/effect/projectile_beam/singularity_pull()
return
/obj/effect/projectile_beam/singularity_act()
return
+1 -1
View File
@@ -129,7 +129,7 @@
// A gun with ultra-honk pin is useful for clown and useless for everyone else.
/obj/item/device/firing_pin/clown/ultra/pin_auth(mob/living/user)
playsound(src.loc, 'sound/items/bikehorn.ogg', 50, 1)
if(!(user.has_disability(CLUMSY)) && !(user.mind && user.mind.assigned_role == "Clown"))
if(!(user.has_disability(DISABILITY_CLUMSY)) && !(user.mind && user.mind.assigned_role == "Clown"))
return 0
return 1
+57 -91
View File
@@ -31,11 +31,16 @@
var/last_projectile_move = 0
var/last_process = 0
var/time_offset = 0
var/datum/point/vector/trajectory
var/trajectory_ignore_forcemove = FALSE //instructs forceMove to NOT reset our trajectory to the new location!
var/old_pixel_x = 0
var/old_pixel_y = 0
var/pixel_x_increment = 0
var/pixel_y_increment = 0
var/pixel_x_offset = 0
var/pixel_y_offset = 0
var/new_x = 0
var/new_y = 0
var/speed = 0.8 //Amount of deciseconds it takes for projectile to travel
var/pixel_speed = 33 //pixels per move - DO NOT FUCK WITH THIS UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING OR UNEXPECTED THINGS /WILL/ HAPPEN!
var/Angle = 0
var/nondirectional_sprite = FALSE //Set TRUE to prevent projectiles from having their sprites rotated based on firing angle
var/spread = 0 //amount (in degrees) of projectile spread
@@ -43,9 +48,6 @@
var/ricochets = 0
var/ricochets_max = 2
var/ricochet_chance = 30
var/colliding = FALSE //pause processing..
var/ignore_source_check = FALSE
var/damage = 10
@@ -166,28 +168,20 @@
/obj/item/projectile/proc/vol_by_damage()
if(src.damage)
return CLAMP((src.damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then CLAMP the value between 30 and 100
return CLAMP((src.damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then clamp the value between 30 and 100
else
return 50 //if the projectile doesn't do damage, play its hitsound at 50% volume
/obj/item/projectile/proc/on_ricochet(atom/A)
return
/obj/item/projectile/Collide(atom/A)
colliding = TRUE
if(check_ricochet(A) && check_ricochet_flag(A) && ricochets < ricochets_max)
ricochets++
if(A.handle_ricochet(src))
on_ricochet(A)
ignore_source_check = TRUE
range = initial(range)
return TRUE
return FALSE
if(firer && !ignore_source_check)
if(A == firer || (A == firer.loc && ismecha(A))) //cannot shoot yourself or your mech
trajectory_ignore_forcemove = TRUE
forceMove(get_turf(A))
trajectory_ignore_forcemove = FALSE
colliding = FALSE
loc = A.loc
return FALSE
var/distance = get_dist(get_turf(A), starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations.
@@ -203,32 +197,25 @@
if(!prehit(A))
if(forcedodge)
trajectory_ignore_forcemove = TRUE
forceMove(target_turf)
trajectory_ignore_forcemove = FALSE
colliding = FALSE
loc = target_turf
return FALSE
var/permutation = A.bullet_act(src, def_zone) // searches for return value, could be deleted after run so check A isn't null
if(permutation == -1 || forcedodge)// the bullet passes through a dense object!
trajectory_ignore_forcemove = TRUE
forceMove(target_turf)
trajectory_ignore_forcemove = FALSE
loc = target_turf
if(A)
permutated.Add(A)
colliding = FALSE
return FALSE
else
var/atom/alt = select_target(A)
if(alt)
if(!prehit(alt))
colliding = FALSE
return FALSE
alt.bullet_act(src, def_zone)
qdel(src)
colliding = FALSE
return TRUE
/obj/item/projectile/proc/select_target(atom/A) //Selects another target from a wall if we hit a wall.
if(!A || !A.density || (A.flags_1 & ON_BORDER_1) || ismob(A) || A == original) //if we hit a dense non-border obj or dense turf then we also hit one of the mobs or machines/structures on that tile.
return
@@ -259,30 +246,12 @@
return TRUE
return FALSE
/obj/item/projectile/proc/return_predicted_turf_after_moves(moves, forced_angle) //I say predicted because there's no telling that the projectile won't change direction/location in flight.
if(!trajectory && isnull(forced_angle) && isnull(Angle))
return FALSE
var/datum/point/vector/current = trajectory
if(!current)
var/turf/T = get_turf(src)
current = new(T.x, T.y, T.z, pixel_x, pixel_y, isnull(forced_angle)? Angle : forced_angle, pixel_speed)
var/datum/point/vector/v = current.return_vector_after_increments(moves)
return v.return_turf()
/obj/item/projectile/proc/return_pathing_turfs_in_moves(moves, forced_angle)
var/turf/current = get_turf(src)
var/turf/ending = return_predicted_turf_after_moves(moves, forced_angle)
return getline(current, ending)
/obj/item/projectile/proc/before_z_change(turf/oldloc, turf/newloc)
return
/obj/item/projectile/Process_Spacemove(var/movement_dir = 0)
return TRUE //Bullets don't drift in space
/obj/item/projectile/process()
last_process = world.time
if(!loc || !fired || !trajectory)
if(!loc || !fired)
fired = FALSE
return PROCESS_KILL
if(paused || !isturf(loc))
@@ -316,70 +285,73 @@
setAngle(angle)
if(spread)
setAngle(Angle + ((rand() - 0.5) * spread))
var/turf/starting = get_turf(src)
if(isnull(Angle)) //Try to resolve through offsets if there's no angle set.
if(isnull(xo) || isnull(yo))
stack_trace("WARNING: Projectile [type] deleted due to being unable to resolve a target after angle was null!")
qdel(src)
return
var/turf/starting = get_turf(src)
var/turf/target = locate(CLAMP(starting + xo, 1, world.maxx), CLAMP(starting + yo, 1, world.maxy), starting.z)
setAngle(Get_Angle(src, target))
if(!nondirectional_sprite)
var/matrix/M = new
M.Turn(Angle)
transform = M
trajectory = new(starting.x, starting.y, starting.z, 0, 0, Angle, pixel_speed)
old_pixel_x = pixel_x
old_pixel_y = pixel_y
last_projectile_move = world.time
fired = TRUE
if(!isprocessing)
START_PROCESSING(SSprojectiles, src)
pixel_move(1) //move it now!
/obj/item/projectile/proc/setAngle(new_angle) //wrapper for overrides.
Angle = new_angle
if(!nondirectional_sprite)
var/matrix/M = new
M.Turn(Angle)
transform = M
if(trajectory)
trajectory.set_angle(new_angle)
return TRUE
/obj/item/projectile/forceMove(atom/target)
. = ..()
if(trajectory && !trajectory_ignore_forcemove && isturf(target))
trajectory.initialize_location(target.x, target.y, target.z, 0, 0)
/obj/item/projectile/proc/pixel_move(moves, trajectory_multiplier = 1)
if(!loc || !trajectory)
return
last_projectile_move = world.time
/obj/item/projectile/proc/pixel_move(moves)
if(!nondirectional_sprite)
var/matrix/M = new
M.Turn(Angle)
transform = M
trajectory.increment(trajectory_multiplier)
var/turf/T = trajectory.return_turf()
if(T.z != loc.z)
before_z_change(loc, T)
trajectory_ignore_forcemove = TRUE
forceMove(T)
trajectory_ignore_forcemove = FALSE
pixel_x = trajectory.return_px()
pixel_y = trajectory.return_py()
else
step_towards(src, T)
pixel_x = trajectory.return_px() - trajectory.mpx * trajectory_multiplier
pixel_y = trajectory.return_py() - trajectory.mpy * trajectory_multiplier
animate(src, pixel_x = trajectory.return_px(), pixel_y = trajectory.return_py(), time = 1, flags = ANIMATION_END_NOW)
pixel_x_increment=round((sin(Angle)+16*sin(Angle)*2), 1) //round() is a floor operation when only one argument is supplied, we don't want that here
pixel_y_increment=round((cos(Angle)+16*cos(Angle)*2), 1)
pixel_x_offset = old_pixel_x + pixel_x_increment
pixel_y_offset = old_pixel_y + pixel_y_increment
new_x = x
new_y = y
while(pixel_x_offset > 16)
pixel_x_offset -= 32
old_pixel_x -= 32
new_x++// x++
while(pixel_x_offset < -16)
pixel_x_offset += 32
old_pixel_x += 32
new_x--
while(pixel_y_offset > 16)
pixel_y_offset -= 32
old_pixel_y -= 32
new_y++
while(pixel_y_offset < -16)
pixel_y_offset += 32
old_pixel_y += 32
new_y--
step_towards(src, locate(new_x, new_y, z))
pixel_x = old_pixel_x
pixel_y = old_pixel_y
animate(src, pixel_x = pixel_x_offset, pixel_y = pixel_y_offset, time = 1, flags = ANIMATION_END_NOW)
old_pixel_x = pixel_x_offset
old_pixel_y = pixel_y_offset
if(can_hit_target(original, permutated))
Collide(original)
Range()
last_projectile_move = world.time
//Returns true if the target atom is on our current turf and above the right layer
/obj/item/projectile/proc/can_hit_target(atom/target, var/list/passthrough)
return (target && ((target.layer >= PROJECTILE_HIT_THRESHHOLD_LAYER) || ismob(target)) && (loc == get_turf(target)) && (!(target in passthrough)))
if(target && (target.layer >= PROJECTILE_HIT_THRESHHOLD_LAYER) || ismob(target))
if(loc == get_turf(target))
if(!(target in passthrough))
return TRUE
return FALSE
/obj/item/projectile/proc/preparePixelProjectile(atom/target, atom/source, params, spread = 0)
var/turf/curloc = get_turf(source)
@@ -390,8 +362,7 @@
if(targloc || !params)
yo = targloc.y - curloc.y
xo = targloc.x - curloc.x
setAngle(Get_Angle(src, targloc))
if(isliving(source) && params)
var/list/calculated = calculate_projectile_angle_and_pixel_offsets(source, params)
p_x = calculated[2]
@@ -401,13 +372,8 @@
setAngle(calculated[1] + spread)
else
setAngle(calculated[1])
else if(targloc)
yo = targloc.y - curloc.y
xo = targloc.x - curloc.x
setAngle(Get_Angle(src, targloc))
else
stack_trace("WARNING: Projectile [type] fired without either mouse parameters, or a target atom to aim at!")
qdel(src)
setAngle(Get_Angle(src, targloc))
/proc/calculate_projectile_angle_and_pixel_offsets(mob/user, params)
var/list/mouse_control = params2list(params)