mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-16 21:22:40 +00:00
Evreything works but timers
This commit is contained in:
@@ -435,7 +435,8 @@
|
||||
P.shot_from = src.name
|
||||
P.silenced = silenced
|
||||
|
||||
P.launch(target)
|
||||
P.old_style_target(target)
|
||||
P.fire()
|
||||
|
||||
last_shot = world.time
|
||||
|
||||
@@ -610,24 +611,17 @@
|
||||
/obj/item/weapon/gun/proc/process_projectile(obj/projectile, mob/user, atom/target, var/target_zone, var/params=null)
|
||||
var/obj/item/projectile/P = projectile
|
||||
if(!istype(P))
|
||||
return 0 //default behaviour only applies to true projectiles
|
||||
|
||||
if(params)
|
||||
P.set_clickpoint(params)
|
||||
return FALSE //default behaviour only applies to true projectiles
|
||||
|
||||
//shooting while in shock
|
||||
var/x_offset = 0
|
||||
var/y_offset = 0
|
||||
var/forcespread
|
||||
if(istype(user, /mob/living/carbon))
|
||||
var/mob/living/carbon/mob = user
|
||||
if(mob.shock_stage > 120)
|
||||
y_offset = rand(-2,2)
|
||||
x_offset = rand(-2,2)
|
||||
forcespread = rand(50, 50)
|
||||
else if(mob.shock_stage > 70)
|
||||
y_offset = rand(-1,1)
|
||||
x_offset = rand(-1,1)
|
||||
|
||||
var/launched = !P.launch_from_gun(target, user, src, target_zone, x_offset, y_offset)
|
||||
forcespread = rand(-25, 25)
|
||||
var/launched = !P.launch_from_gun(target, target_zone, user, params, null, forcespread, src)
|
||||
|
||||
if(launched)
|
||||
play_fire_sound(user, P)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
icon_state = "dart"
|
||||
damage = 5
|
||||
var/reagent_amount = 15
|
||||
kill_count = 15 //shorter range
|
||||
range = 15 //shorter range
|
||||
|
||||
muzzle_type = null
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
icon_state = "bullet"
|
||||
density = FALSE
|
||||
anchored = TRUE
|
||||
unacidable = TRUEs
|
||||
unacidable = TRUE
|
||||
pass_flags = PASSTABLE
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
mouse_opacity = 0
|
||||
|
||||
////TG PROJECTILE SYTSEM
|
||||
//Projectile stuff
|
||||
@@ -205,7 +205,7 @@
|
||||
|
||||
/obj/item/projectile/Crossed(atom/movable/AM) //A mob moving on a tile with a projectile is hit by it.
|
||||
..()
|
||||
if(isliving(AM) && (AM.density || AM == original) && !(src.pass_flags & PASSMOB))
|
||||
if(isliving(AM) && (AM.density || AM == original))
|
||||
Bump(AM)
|
||||
|
||||
/obj/item/projectile/proc/process_homing() //may need speeding up in the future performance wise.
|
||||
@@ -281,13 +281,10 @@
|
||||
|
||||
/obj/item/projectile/proc/fire(angle, atom/direct_target)
|
||||
//If no angle needs to resolve it from xo/yo!
|
||||
if(!log_override && firer && original)
|
||||
log_combat(firer, original, "fired at", src, "from [get_area_name(src, TRUE)]")
|
||||
if(direct_target)
|
||||
if(prehit(direct_target))
|
||||
direct_target.bullet_act(src, def_zone)
|
||||
qdel(src)
|
||||
return
|
||||
direct_target.bullet_act(src, def_zone)
|
||||
qdel(src)
|
||||
return
|
||||
if(isnum(angle))
|
||||
setAngle(angle)
|
||||
var/turf/starting = get_turf(src)
|
||||
@@ -323,7 +320,6 @@
|
||||
|
||||
/obj/item/projectile/proc/before_z_change(atom/oldloc, atom/newloc)
|
||||
|
||||
|
||||
/obj/item/projectile/proc/before_move()
|
||||
return
|
||||
|
||||
@@ -385,7 +381,7 @@
|
||||
var/y = text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32
|
||||
|
||||
//Calculate the "resolution" of screen based on client's view and world's icon size. This will work if the user can view more tiles than average.
|
||||
var/list/screenview = getviewsize(user.client.view)
|
||||
var/list/screenview = user.client? getviewsize(user.client.view) : world.view
|
||||
var/screenviewX = screenview[1] * world.icon_size
|
||||
var/screenviewY = screenview[2] * world.icon_size
|
||||
|
||||
@@ -394,9 +390,14 @@
|
||||
angle = ATAN2(y - oy, x - ox)
|
||||
return list(angle, p_x, p_y)
|
||||
|
||||
/obj/item/projectile/proc/redirect(x, y, starting, source)
|
||||
old_style_target(locate(x, y, z), starting? get_turf(starting) : get_turf(source))
|
||||
|
||||
/obj/item/projectile/proc/old_style_target(atom/target, atom/source)
|
||||
if(!source)
|
||||
source = get_turf(src)
|
||||
starting = source
|
||||
original = target
|
||||
setAngle(Get_Angle(source, target))
|
||||
|
||||
/obj/item/projectile/Destroy()
|
||||
@@ -456,37 +457,19 @@
|
||||
|
||||
//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)))
|
||||
return (target && ((target.layer >= TABLE_LAYER) || ismob(target)) && (loc == get_turf(target)) && (!(target in passthrough)))
|
||||
|
||||
/obj/item/projectile/Bump(atom/A)
|
||||
var/datum/point/pcache = trajectory.copy_to()
|
||||
if(A in permutated)
|
||||
return FALSE
|
||||
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)
|
||||
if(hitscan)
|
||||
store_hitscan_collision(pcache)
|
||||
return TRUE
|
||||
if(firer && !ignore_source_check)
|
||||
if(A == firer || (A == firer.loc && ismecha(A))) //cannot shoot yourself or your mech
|
||||
if(firer && !reflected)
|
||||
if(A == firer || (A == firer.loc && istype(A, /obj/mecha))) //cannot shoot yourself or your mech
|
||||
trajectory_ignore_forcemove = TRUE
|
||||
forceMove(get_turf(A))
|
||||
trajectory_ignore_forcemove = FALSE
|
||||
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.
|
||||
def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use.
|
||||
|
||||
if(isturf(A) && hitsound_wall)
|
||||
var/volume = CLAMP(vol_by_damage() + 20, 0, 100)
|
||||
if(suppressed)
|
||||
volume = 5
|
||||
playsound(loc, hitsound_wall, volume, 1, -1)
|
||||
|
||||
var/distance = get_dist(starting, get_turf(src))
|
||||
var/turf/target_turf = get_turf(A)
|
||||
var/passthrough = FALSE
|
||||
|
||||
@@ -520,7 +503,6 @@
|
||||
for(var/mob/living/M in A)
|
||||
attack_mob(M, distance)
|
||||
|
||||
|
||||
//penetrating projectiles can pass through things that otherwise would not let them
|
||||
if(!passthrough && penetrating > 0)
|
||||
if(check_penetrate(A))
|
||||
@@ -550,7 +532,6 @@
|
||||
|
||||
//called when the projectile stops flying because it Bump'd with something
|
||||
/obj/item/projectile/proc/on_impact(atom/A)
|
||||
impact_effect(effect_transform) // generate impact effect
|
||||
if(damage && damage_type == BURN)
|
||||
var/turf/T = get_turf(A)
|
||||
if(T)
|
||||
@@ -627,7 +608,7 @@
|
||||
return fire(angle_override, direct_target)
|
||||
|
||||
//called to launch a projectile from a gun
|
||||
/obj/item/projectile/proc/_launch_from_gun(atom/target, target_zone, mob/user, params, angle_override, forced_spread, obj/item/weapon/gun/launcher)
|
||||
/obj/item/projectile/proc/launch_from_gun(atom/target, target_zone, mob/user, params, angle_override, forced_spread, obj/item/weapon/gun/launcher)
|
||||
|
||||
shot_from = launcher.name
|
||||
silenced = launcher.silenced
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/obj/item/projectile/arc
|
||||
name = "arcing shot"
|
||||
icon_state = "fireball" // WIP
|
||||
step_delay = 2 // Travel a bit slower, to really sell the arc visuals.
|
||||
speed = 2 // Travel a bit slower, to really sell the arc visuals.
|
||||
plane = ABOVE_PLANE // Since projectiles are 'in the air', they might visually overlap mobs while in flight, so the projectile needs to be above their plane.
|
||||
var/target_distance = null // How many tiles the impact site is.
|
||||
var/fired_dir = null // Which direction was the projectile fired towards. Needed to invert the projectile turning based on if facing left or right.
|
||||
@@ -36,18 +36,17 @@
|
||||
new /obj/effect/explosion(T)
|
||||
return ..()
|
||||
|
||||
/obj/item/projectile/arc/launch(atom/target, target_zone, x_offset=0, y_offset=0, angle_offset=0)
|
||||
/obj/item/projectile/arc/old_style_target(target, source)
|
||||
var/expected_distance = get_dist(target, loc)
|
||||
kill_count = expected_distance // So the projectile "hits the ground."
|
||||
range = expected_distance // So the projectile "hits the ground."
|
||||
target_distance = expected_distance
|
||||
fired_dir = get_dir(loc, target)
|
||||
..() // Does the regular launching stuff.
|
||||
..()
|
||||
if(fired_dir & EAST)
|
||||
transform = turn(transform, -45)
|
||||
else if(fired_dir & WEST)
|
||||
transform = turn(transform, 45)
|
||||
|
||||
|
||||
// Visuals.
|
||||
/obj/item/projectile/arc/after_move()
|
||||
// Handle projectile turning in flight.
|
||||
@@ -73,7 +72,7 @@
|
||||
var/projectile_position = arc_progress / target_distance
|
||||
var/sine_position = projectile_position * 180
|
||||
var/pixel_z_position = arc_max_height * sin(sine_position)
|
||||
animate(src, pixel_z = pixel_z_position, time = step_delay)
|
||||
animate(src, pixel_z = pixel_z_position, time = speed)
|
||||
|
||||
// Update our shadow.
|
||||
shadow.forceMove(loc)
|
||||
|
||||
@@ -246,12 +246,12 @@
|
||||
incendiary = 2
|
||||
flammability = 4
|
||||
agony = 30
|
||||
kill_count = 4
|
||||
range = 4
|
||||
vacuum_traversal = 0
|
||||
|
||||
/obj/item/projectile/bullet/incendiary/flamethrower/large
|
||||
damage = 15
|
||||
kill_count = 6
|
||||
range = 6
|
||||
|
||||
/obj/item/projectile/bullet/blank
|
||||
invisibility = 101
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
icon_state = "bullet"
|
||||
fire_sound = 'sound/weapons/gunshot/gunshot_pistol.ogg'
|
||||
damage = 5
|
||||
kill_count = 15 //if the shell hasn't hit anything after travelling this far it just explodes.
|
||||
range = 15 //if the shell hasn't hit anything after travelling this far it just explodes.
|
||||
var/flash_range = 0
|
||||
var/brightness = 7
|
||||
var/light_colour = "#ffffff"
|
||||
@@ -162,7 +162,7 @@
|
||||
icon_state = "plasma_stun"
|
||||
fire_sound = 'sound/weapons/blaster.ogg'
|
||||
armor_penetration = 10
|
||||
kill_count = 4
|
||||
range = 4
|
||||
damage = 5
|
||||
agony = 55
|
||||
damage_type = BURN
|
||||
@@ -214,20 +214,20 @@
|
||||
/obj/item/projectile/energy/phase
|
||||
name = "phase wave"
|
||||
icon_state = "phase"
|
||||
kill_count = 6
|
||||
range = 6
|
||||
damage = 5
|
||||
SA_bonus_damage = 45 // 50 total on animals
|
||||
SA_vulnerability = SA_ANIMAL
|
||||
|
||||
/obj/item/projectile/energy/phase/light
|
||||
kill_count = 4
|
||||
range = 4
|
||||
SA_bonus_damage = 35 // 40 total on animals
|
||||
|
||||
/obj/item/projectile/energy/phase/heavy
|
||||
kill_count = 8
|
||||
range = 8
|
||||
SA_bonus_damage = 55 // 60 total on animals
|
||||
|
||||
/obj/item/projectile/energy/phase/heavy/cannon
|
||||
kill_count = 10
|
||||
range = 10
|
||||
damage = 15
|
||||
SA_bonus_damage = 60 // 75 total on animals
|
||||
@@ -34,7 +34,7 @@
|
||||
penetrating = 2
|
||||
embed_chance = 0
|
||||
armor_penetration = 40
|
||||
kill_count = 20
|
||||
range = 20
|
||||
|
||||
var/searing = 0 //Does this fuelrod ignore shields?
|
||||
var/detonate_travel = 0 //Will this fuelrod explode when it reaches maximum distance?
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
if(energetic_impact)
|
||||
var/eye_coverage = 0
|
||||
for(var/mob/living/carbon/M in viewers(world.view, location))
|
||||
for(var/mob/living/carbon/M in viewers(world.view, get_turf(src)))
|
||||
eye_coverage = 0
|
||||
if(iscarbon(M))
|
||||
eye_coverage = M.eyecheck()
|
||||
@@ -103,7 +103,7 @@
|
||||
armor_penetration = 100
|
||||
penetrating = 100 //Theoretically, this shouldn't stop flying for a while, unless someone lines it up with a wall or fires it into a mountain.
|
||||
irradiate = 120
|
||||
kill_count = 75
|
||||
range = 75
|
||||
searing = 1
|
||||
detonate_travel = 1
|
||||
detonate_mob = 1
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
var/base_spread = 90 //lower means the pellets spread more across body parts. If zero then this is considered a shrapnel explosion instead of a shrapnel cone
|
||||
var/spread_step = 10 //higher means the pellets spread more across body parts with distance
|
||||
|
||||
/obj/item/projectile/bullet/pellet/Bumped()
|
||||
. = ..()
|
||||
bumped = 0 //can hit all mobs in a tile. pellets is decremented inside attack_mob so this should be fine.
|
||||
|
||||
/obj/item/projectile/bullet/pellet/proc/get_pellets(var/distance)
|
||||
var/pellet_loss = round((distance - 1)/range_step) //pellets lost due to distance
|
||||
return max(pellets - pellet_loss, 1)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
qdel(src)
|
||||
return hit
|
||||
|
||||
/obj/item/projectile/test/Collide(atom/A)
|
||||
/obj/item/projectile/test/Bump(atom/A)
|
||||
if(A != src)
|
||||
hit |= A
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user