SSprojectiles - smoother and saner projectiles (#17127)

* SSprojectiles - smoother and saner projectiles

* trailing newline

* toki wo tomare

* Lower projectile speed back to 2x, reflector fix

* Tables stop projectiles properly
This commit is contained in:
dearmochi
2022-02-25 18:30:05 +00:00
committed by GitHub
parent bb2eceedaf
commit 5693eb827e
9 changed files with 395 additions and 106 deletions
+3 -5
View File
@@ -22,16 +22,14 @@
new_dir = 0
return ..() //Hits as normal, explodes or emps or whatever
reflect_turf = get_step(loc,new_dir)
reflect_turf = get_step(loc, new_dir)
P.original = reflect_turf
P.starting = reflector_turf
P.current = reflector_turf
P.yo = reflect_turf.y - reflector_turf.y
P.xo = reflect_turf.x - reflector_turf.x
P.ignore_source_check = TRUE //If shot by a laser, will now hit the mob that fired it
var/reflect_angle = dir2angle(new_dir)
P.setAngle(reflect_angle)
P.set_angle_centered(reflect_angle)
P.trajectory.set_location(reflect_turf.x, reflect_turf.y, reflect_turf.z)
new_dir = 0
return -1
+19 -25
View File
@@ -138,32 +138,26 @@
var/atom/movable/mover = caller
. = . || mover.checkpass(PASSTABLE)
//checks if projectile 'P' from turf 'from' can hit whatever is behind the table. Returns 1 if it can, 0 if bullet stops.
/**
* Determines whether a projectile crossing our turf should be stopped.
* Return FALSE to stop the projectile.
*
* Arguments:
* * P - The projectile trying to cross.
* * from - Where the projectile is located.
*/
/obj/structure/table/proc/check_cover(obj/item/projectile/P, turf/from)
var/turf/cover = flipped ? get_turf(src) : get_step(loc, get_dir(from, loc))
if(get_dist(P.starting, loc) <= 1) //Tables won't help you if people are THIS close
return 1
if(get_turf(P.original) == cover)
var/chance = 20
if(ismob(P.original))
var/mob/M = P.original
if(M.lying)
chance += 20 //Lying down lets you catch less bullets
if(flipped)
if(get_dir(loc, from) == dir) //Flipped tables catch mroe bullets
chance += 20
else
return 1 //But only from one side
if(prob(chance))
obj_integrity -= P.damage/2
if(obj_integrity > 0)
visible_message("<span class='warning'>[P] hits \the [src]!</span>")
return 0
else
visible_message("<span class='warning'>[src] breaks down!</span>")
deconstruct(FALSE)
return 1
return 1
. = TRUE
if(!flipped)
return
if(get_dist(P.starting, loc) <= 1) // Tables won't help you if people are THIS close
return
var/proj_dir = get_dir(from, loc)
var/block_dir = get_dir(get_step(loc, dir), loc)
if(proj_dir != block_dir) // Back/side shots may pass
return
if(prob(40))
return FALSE // Blocked
/obj/structure/table/CheckExit(atom/movable/O, turf/target)
if(istype(O) && O.checkpass(PASSTABLE))