mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-10 09:22:05 +00:00
Cover system.
Tables now give some cover from bullets and beams. Standing behind the table gives you 20% chance of table taking the hit instead. Flipped table gives +20%, but only if bullet comes from the side it faces. Otherwise no cover is provided at all. Lying on the floor gives +20%. Table takes half of damage human would, and breaks down after its health goes to zero. Reinforced talbes have double the health, wooden ones - half.
This commit is contained in:
@@ -289,16 +289,7 @@
|
||||
/obj/structure/table/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
if(air_group || (height==0)) return 1
|
||||
if(istype(mover,/obj/item/projectile))
|
||||
var/obj/item/projectile/P = mover
|
||||
if(flipped & prob(20))
|
||||
health -= P.damage
|
||||
if (health > 0)
|
||||
visible_message("<span class='warning'>[P] hits \the [src]!</span>")
|
||||
return 0
|
||||
else
|
||||
visible_message("<span class='warning'>[src] breaks down!</span>")
|
||||
destroy()
|
||||
return 1
|
||||
return (check_cover(mover,target))
|
||||
if(istype(mover) && mover.checkpass(PASSTABLE))
|
||||
return 1
|
||||
if (flipped)
|
||||
@@ -308,6 +299,33 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//checks if projectile 'P' from turf 'from' can hit whatever is behind the table. Returns 1 if it can, 0 if bullet stops.
|
||||
/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))
|
||||
health -= P.damage/2
|
||||
if (health > 0)
|
||||
visible_message("<span class='warning'>[P] hits \the [src]!</span>")
|
||||
return 0
|
||||
else
|
||||
visible_message("<span class='warning'>[src] breaks down!</span>")
|
||||
destroy()
|
||||
return 1
|
||||
return 1
|
||||
|
||||
/obj/structure/table/CheckExit(atom/movable/O as mob|obj, target as turf)
|
||||
if(istype(O) && O.checkpass(PASSTABLE))
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user