Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Core refinery explodes the TTV outside the refiner #797

Open
Zonespace27 opened this issue Jun 24, 2022 · 2 comments
Open

Core refinery explodes the TTV outside the refiner #797

Zonespace27 opened this issue Jun 24, 2022 · 2 comments
Assignees
Labels
Fixed But Not Merged MERGE MY PR ZAS Bugs/PRs Related to Zone Atmospherics

Comments

@SabreML
Copy link
Contributor

SabreML commented Jun 24, 2022

Looking into this now. I reproduced it during the same round on the server but it's working fine on master, so it seems like it's testmerge related.

@SabreML
Copy link
Contributor

SabreML commented Jun 24, 2022

This is caused by #469, specifically this part in the /obj/item/tank/atom_destruction() proc:

log_atmos("[type] exploded with a power of [strength * mult] and a mix of ", air_contents)
explosion(
get_turf(loc),
round(min(BOMBCAP_DVSTN_RADIUS, ((mult)*strength)*0.15)),
round(min(BOMBCAP_HEAVY_RADIUS, ((mult)*strength)*0.35)),
round(min(BOMBCAP_LIGHT_RADIUS, ((mult)*strength)*0.80)),
round(min(BOMBCAP_FLASH_RADIUS, ((mult)*strength)*1.20)),
)

Compared to the same section from master:
log_atmos("[type] exploded with a power of [power] and a mix of ", air_contents)
dyn_explosion(src, power, flash_range = 1.5, ignorecap = FALSE)

/proc/dyn_explosion(turf/epicenter, power, flame_range = 0, flash_range = null, adminlog = TRUE, ignorecap = TRUE, silent = FALSE, smoke = TRUE, atom/explosion_cause = null)
if(!power)
return
var/range = 0
range = round((2 * power)**GLOB.DYN_EX_SCALE)
explosion(epicenter, devastation_range = round(range * 0.25), heavy_impact_range = round(range * 0.5), light_impact_range = round(range), flame_range = flame_range*range, flash_range = flash_range*range, adminlog = adminlog, ignorecap = ignorecap, silent = silent, smoke = smoke, explosion_cause = explosion_cause)


The anomaly refinery blocks any internal explosions from getting out by registering the COMSIG_ATOM_INTERNAL_EXPLOSION signal and returning COMSIG_CANCEL_EXPLOSION. This means that the full explosion technically still happens, but it gets cancelled before it can actually damage anything.

var/atom/location = isturf(origin) ? origin : origin.loc
if(SEND_SIGNAL(origin, COMSIG_ATOM_EXPLODE, arguments) & COMSIG_CANCEL_EXPLOSION)
return // Signals are incompatible with `arglist(...)` so we can't actually use that for these. Additionally,
while(location)
var/next_loc = location.loc
if(SEND_SIGNAL(location, COMSIG_ATOM_INTERNAL_EXPLOSION, arguments) & COMSIG_CANCEL_EXPLOSION)
return

/obj/machinery/research/anomaly_refinery/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_ATOM_INTERNAL_EXPLOSION, .proc/check_test)


The actual explanation:
The bug is being caused by explosion() getting sent the turf rather than the gas tank as its origin argument. Because of this, COMSIG_ATOM_INTERNAL_EXPLOSION isn't sent to the anomaly refinery, and the explosion never gets blocked.
The bug can be fixed by changing the argument from get_turf(loc) back to src, but that might not be the correct solution:

		log_atmos("[type] exploded with a power of [strength * mult] and a mix of ", air_contents)
		explosion(
-			get_turf(loc),
+			src,
			round(min(BOMBCAP_DVSTN_RADIUS, ((mult)*strength)*0.15)),
			round(min(BOMBCAP_HEAVY_RADIUS, ((mult)*strength)*0.35)),
			round(min(BOMBCAP_LIGHT_RADIUS, ((mult)*strength)*0.80)),
			round(min(BOMBCAP_FLASH_RADIUS, ((mult)*strength)*1.20)),
		)

@SabreML SabreML added the ZAS Bugs/PRs Related to Zone Atmospherics label Jun 24, 2022
@Kapu1178 Kapu1178 added the Fixed But Not Merged MERGE MY PR label Jun 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed But Not Merged MERGE MY PR ZAS Bugs/PRs Related to Zone Atmospherics
Projects
None yet
Development

No branches or pull requests

3 participants