Planet Crucible


Crucible is a high-pressure planet with a crafting chain built around creating metallic hydrogen.

Content
2 days ago
2.0
6.01K
Planets Transportation Armor Environment Mining Fluids Manufacturing

b critical: new entities are indestructible (in whole Factorio, not just this mod)

2 days ago
(updated 2 days ago)

Hi there

This is bad: https://gitlab.com/jfletcher94/factorio-mods/-/blob/master/planet-crucible/control.lua?ref_type=heads#L44

  • ... or not event.entity.name == "planet-crucible-dummy-entity" evaluates to false,
  • since it's evaluated like ... or ((not event.entity.name) == "planet-crucible-dummy-entity),
  • and not event.entity.name is probably false, but in any case never == "planet-crucible-dummy-entity,
  • thus the function doesn't return, but executes the following lines which
  • set the created entity's destructible property to false for all entities causing a call to on_trigger_created_entity.

probably change this to:

... or event.entity.name ~= "planet-crucible-dummy-entity"

see
- https://www.lua.org/pil/3.5.html
- https://stackoverflow.com/questions/40476007/order-of-operations-vs-not

Thanks!

2 days ago

🤦
Thanks! I will fix this now.

2 days ago

That was pretty subtle to find out, luckily I updated just a few mods to a newer version, so I could narrow it down - Planet Crucible being one of the last mods' sources I compared with the one before, since it seemed highly unlikely to me that this mod would cause this behaviour:

I found out that something's badly wrong because one of my space platforms suddenly took a huge amount of damage, not long after loading my save game (with Planet Crucible updated to 0.4.5).
- That was because the gun turrets, which have filters set to small and medium asteroids, couldn't be bothered to attack those small asteroids any more, they just sat there, happily shot at the medium asteroids and killed them as expected and as before, but then they let the small asteroids crash into the platform - I was watching this with my mouth open
- same behaviour for rocket turrets
- so I thought it's something messing with Factorio's targeting mechanism, I have some mods fiddling with that I believe, but none were updated

The next surprise was that Fulgora was overrun by enemies (I play with some Fulgoran enemies mod), and again, when I looked, neither gun turrets nor lasers shot at the enemies, they just watched as they tore down the base. No issue with power, no issue whatsoever.

And this was all shortly after loading my save, so I couldn't have possibly have had the time to do some crazy stuff to screw this all up so badly.

Luckily, this craziness appeared with asteroids and enemy units, two things I think are pretty different so that no single mod would screw this up, so I didn't take too long searching for asteroid or enemy related updates in other mods.

And then I stumbled upon Planet Crucible's update (I haven't even been to the planet yet, so I didn't think it could mess up asteroids and enemies globally).

I fear that once the entities are created and have their destructible property set, they'll stay like this forever...? So after fixing the line of code I loaded my save and everything seemed fine. But if I hadn't noticed that so soon and played for a bit, and maybe would have been attacked an hour later by some enemies, then indestructible, I don't think my save would have been salvagable... so I hope you can fix this before a lot of people play with this version...

At least that's what I think; I just wanted to add details and background to clarify how I stumbled upon this in the first place.

2 days ago

🤦
Thanks! I will fix this now.

great, thanks a lot! that was one crazy behaviour, I have never seen this in Factorio and all the mods I have installed. :-D sh*t happens.

2 days ago

I've pushed a fix (and added a test to make sure this doesn't happen again). It should be up on the mod portal in ~15 minutes or so. I've also removed v0.4.5.

Thank you for finding this, and sleuthing it out!

2 days ago

I fear that once the entities are created and have their destructible property set, they'll stay like this forever...? So after fixing the line of code I loaded my save and everything seemed fine. But if I hadn't noticed that so soon and played for a bit, and maybe would have been attacked an hour later by some enemies, then indestructible, I don't think my save would have been salvagable... so I hope you can fix this before a lot of people play with this version...

At least that's what I think; I just wanted to add details and background to clarify how I stumbled upon this in the first place.

I'm glad the save was salvageable! I'll try to write a migration or something to fix a borked save if anyone reports a broken save.

a day ago

Thanks a lot for your very quick fix, that's terrific! It was kinda fun digging around the problem, I kinda like debugging software. :-)

New response