[MIRROR] Dephasing vars (#11800)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-10-09 06:23:08 -07:00
committed by GitHub
parent 2c07a1208b
commit 904a9b824a
2 changed files with 25 additions and 3 deletions

View File

@@ -102,6 +102,15 @@
phase_out(T, SK) phase_out(T, SK)
/mob/living/proc/phase_in(var/turf/T, var/datum/component/shadekin/SK) /mob/living/proc/phase_in(var/turf/T, var/datum/component/shadekin/SK)
//In case we're not passed args, do it ourself.
if(!T)
T = get_turf(src)
if(!T)
return
if(!SK)
SK = get_shadekin_component()
if(!SK)
return
if(SK.in_phase) if(SK.in_phase)
// pre-change // pre-change

View File

@@ -144,6 +144,11 @@
var/hud_state = "unknown" // What HUD state we use when we have ammunition. var/hud_state = "unknown" // What HUD state we use when we have ammunition.
var/hud_state_empty = "unknown" // The empty state. DON'T USE _FLASH IN THE NAME OF THE EMPTY STATE STRING, THAT IS ADDED BY THE CODE. var/hud_state_empty = "unknown" // The empty state. DON'T USE _FLASH IN THE NAME OF THE EMPTY STATE STRING, THAT IS ADDED BY THE CODE.
///If the rounds dephase or not
var/dephasing = FALSE
///If the rounds hit phased entities or not.
var/hits_phased = FALSE
var/obj/item/ammo_casing/my_case = null var/obj/item/ammo_casing/my_case = null
var/crawl_destroy = FALSE //chompADD: Making bullet hell lite mobs, need something to add to their projectiles to destroy laying folks var/crawl_destroy = FALSE //chompADD: Making bullet hell lite mobs, need something to add to their projectiles to destroy laying folks
@@ -244,13 +249,15 @@
Range() Range()
/obj/item/projectile/Crossed(atom/movable/AM) //A mob moving on a tile with a projectile is hit by it. /obj/item/projectile/Crossed(atom/movable/AM) //A mob moving on a tile with a projectile is hit by it.
if(AM.is_incorporeal()) if(AM.is_incorporeal() && !hits_phased)
return return
..() ..()
if(isliving(AM) && !(pass_flags & PASSMOB)) if(isliving(AM) && !(pass_flags & PASSMOB))
var/mob/living/L = AM var/mob/living/L = AM
if(can_hit_target(L, permutated, (AM == original))) if(can_hit_target(L, permutated, (AM == original)))
Bump(AM) Bump(AM)
if(dephasing)
L.phase_in() //If the mob is phased, dephase them. If they're not phased, this does nothing.
/obj/item/projectile/proc/process_homing() //may need speeding up in the future performance wise. /obj/item/projectile/proc/process_homing() //may need speeding up in the future performance wise.
if(!homing_target) if(!homing_target)
@@ -558,6 +565,8 @@
if(crawl_destroy == TRUE) //chompADD if(crawl_destroy == TRUE) //chompADD
return TRUE return TRUE
if(!L.density) if(!L.density)
var/datum/component/shadekin/SK = L.GetComponent(/datum/component/shadekin)
if(!SK || (SK.in_phase && !hits_phased)) //We don't have the phasing component, or we do but we're currently phased and the bullet can't hit phased things...This is needed for simple mobs.
return FALSE return FALSE
return TRUE return TRUE
@@ -690,7 +699,7 @@
if(!istype(target_mob)) if(!istype(target_mob))
return return
if(target_mob.is_incorporeal()) if(target_mob.is_incorporeal() && !hits_phased)
return return
if(target_mob in impacted_mobs) if(target_mob in impacted_mobs)
@@ -747,6 +756,10 @@
if(istype(firer, /mob) && istype(target_mob)) if(istype(firer, /mob) && istype(target_mob))
add_attack_logs(firer,target_mob,"Shot with \a [src.type] projectile") //CHOMPEdit add_attack_logs(firer,target_mob,"Shot with \a [src.type] projectile") //CHOMPEdit
if(dephasing)
target_mob.phase_in() //If the mob is phased, dephase them. If they're not phased, this does nothing.
//sometimes bullet_act() will want the projectile to continue flying //sometimes bullet_act() will want the projectile to continue flying
if (result == PROJECTILE_CONTINUE) if (result == PROJECTILE_CONTINUE)
return FALSE return FALSE