Files
Bubberstation/code/modules/projectiles/projectile/special/gravity.dm
T
MrMelbert d755b70d76 Removes bad nodamage var from projectiles, fixes Juggernaut / Rust Walker projectiles doing zero damage (#73806)
## About The Pull Request

- Juggernaut and Rust Walker projectiles were subtyped off of magic,
which is `nodamage`.

- The juggernaut actually had a copy+paste error with their type
`on_hit` which caused none of their special effects on hit ("relative
patching catches this")

- Then I realized projectiles have this var `nodamage` which is, for all
intents and purposes, just `damage > 0`. it's not checked for pacifism,
it's just that. This is dumb. So very dumb, so I removed it.
- There are, however, a few situations which used it in a unique way,
such as the blast wave cannon. This is why I replaced it with a proc,
`is_hostile_projectile`, for certain situations to actually find out if
the projectile is damaging. Projectiles can override this on a per type
basis by default, damaging projectiles = hostile.
- This has a chance to break some things, but I ... kinda doubt it will.

Fixes #73756

## Why It's Good For The Game

Projectiles that act as they should, less dumb vars

## Changelog

🆑 Melbert
fix: Fixes Juggernaut / Rust Walker projectiles doing zero damage
fix: Fixes Juggernaut projectiles not doing bonus damage to nearby
structures
code: Removed projectile nodamage var, replaces it with just checking
for damage
/🆑
2023-03-10 17:51:31 -07:00

100 lines
3.1 KiB
Plaintext

/obj/projectile/gravityrepulse
name = "repulsion bolt"
icon = 'icons/effects/effects.dmi'
icon_state = "chronofield"
hitsound = 'sound/weapons/wave.ogg'
damage = 0
damage_type = BRUTE
color = "#33CCFF"
var/turf/T
var/power = 4
var/list/thrown_items = list()
/obj/projectile/gravityrepulse/Initialize(mapload)
. = ..()
var/obj/item/ammo_casing/energy/gravity/repulse/C = loc
if(istype(C)) //Hard-coded maximum power so servers can't be crashed by trying to throw the entire Z level's items
power = min(C.gun?.power, 15)
/obj/projectile/gravityrepulse/on_hit()
. = ..()
T = get_turf(src)
for(var/atom/movable/A in range(T, power))
if(A == src || (firer && A == src.firer) || A.anchored || thrown_items[A])
continue
if(ismob(A)) //because (ismob(A) && A:mob_negates_gravity()) is a recipe for bugs.
var/mob/M = A
if(M.mob_negates_gravity())
continue
var/throwtarget = get_edge_target_turf(src, get_dir(src, get_step_away(A, src)))
A.safe_throw_at(throwtarget,power+1,1, force = MOVE_FORCE_EXTREMELY_STRONG)
thrown_items[A] = A
for(var/turf/F in RANGE_TURFS(power, T))
new /obj/effect/temp_visual/gravpush(F)
/obj/projectile/gravityattract
name = "attraction bolt"
icon = 'icons/effects/effects.dmi'
icon_state = "chronofield"
hitsound = 'sound/weapons/wave.ogg'
damage = 0
damage_type = BRUTE
color = "#FF6600"
var/turf/T
var/power = 4
var/list/thrown_items = list()
/obj/projectile/gravityattract/Initialize(mapload)
. = ..()
var/obj/item/ammo_casing/energy/gravity/attract/C = loc
if(istype(C)) //Hard-coded maximum power so servers can't be crashed by trying to throw the entire Z level's items
power = min(C.gun?.power, 15)
/obj/projectile/gravityattract/on_hit()
. = ..()
T = get_turf(src)
for(var/atom/movable/A in range(T, power))
if(A == src || (firer && A == src.firer) || A.anchored || thrown_items[A])
continue
if(ismob(A))
var/mob/M = A
if(M.mob_negates_gravity())
continue
A.safe_throw_at(T, power+1, 1, force = MOVE_FORCE_EXTREMELY_STRONG)
thrown_items[A] = A
for(var/turf/F in RANGE_TURFS(power, T))
new /obj/effect/temp_visual/gravpush(F)
/obj/projectile/gravitychaos
name = "gravitational blast"
icon = 'icons/effects/effects.dmi'
icon_state = "chronofield"
hitsound = 'sound/weapons/wave.ogg'
damage = 0
damage_type = BRUTE
color = "#101010"
var/turf/T
var/power = 4
var/list/thrown_items = list()
/obj/projectile/gravitychaos/Initialize(mapload)
. = ..()
var/obj/item/ammo_casing/energy/gravity/chaos/C = loc
if(istype(C)) //Hard-coded maximum power so servers can't be crashed by trying to throw the entire Z level's items
power = min(C.gun?.power, 15)
/obj/projectile/gravitychaos/on_hit()
. = ..()
T = get_turf(src)
for(var/atom/movable/A in range(T, power))
if(A == src || (firer && A == src.firer) || A.anchored || thrown_items[A])
continue
if(ismob(A))
var/mob/M = A
if(M.mob_negates_gravity())
continue
A.safe_throw_at(get_edge_target_turf(A, pick(GLOB.cardinals)), power+1, 1, force = MOVE_FORCE_EXTREMELY_STRONG)
thrown_items[A] = A
for(var/turf/Z as anything in RANGE_TURFS(power,T))
new /obj/effect/temp_visual/gravpush(Z)