HDest-Community / HDest-Critters

The HDest Critters Mod, originally made by CoolKing1234, now maintained by the community.
GNU General Public License v3.0
1 stars 0 forks source link

Weird spawning behaviour #4

Open paradaimon opened 7 months ago

paradaimon commented 7 months ago

For some reason sometimes when you kill a withered it spawn a lot of casings. It gets even weirder if you set the "persistent spawning" on, as such casings can spawn another set of critters.

Screenshot_Doom_20240310_182540 Screenshot_Doom_20240310_182712

Also, it still sometimes spawn some of them inside the geometry. It's very random, so it's quite hard to explain a step by step way of replicating these bugs (and also recording a video which could showcase better what is happening). The Evil Sprite usually is the most likely to spawn halfway inside a wall, but that must be because I set it to spawn on casings, but basically all of them (with the exception of the impaled) also sometimes get locked inside geometry.

UndeadZeratul commented 7 months ago

Ah, I didn't think about persistent spawning and replacing casing bits, the original Withereds simply used to drop 7mm casings specifically, but I made it more generic by making them simply drop the HDCasingBits which is what's being replaced... I can remove that altogether or something.

I swear I thought I fixed the "spawning within geometry" by checking if the point to spawn them is within the level as well as testing the location, if there's more complicated logic I'd need to implement I'm unsure how to go about it at the moment but I will definitely keep an eye out for potential solutions to it.

For reference, here's the logic when trying to spawn Withereds/Doggies within a cluster:

// Try to spawn the mob.  If it failed to spawn, or spawned outside of the level, or spawned stuck, remove it and try again.
let spawned = Spawn('WitheredRandom', spawnPos);
if (!spawned || !Level.IsPointInLevel(spawned.pos) || !spawned.TestMobjLocation()) {
    if (spawned) spawned.Destroy();

    failedAttempts++;

    if (hd_debug) Console.PrintF("Failed to spawn Withered #"..invoker.numSpawned..", retrying");
} else {
    invoker.numSpawned++;
    failedAttempts = 0;
}