zone that disables structure decay

Started by MightyMonte88, December 16, 2020, 10:17:14 AM

MightyMonte88

Is it possible to define a zone that has the ability to disable structure decay for structures built within it? If not it's not a big deal. I want to use certain structures and so on as map props for raider bases and uranium mines, however if i can't do that then i'll just add map prop versions of the structures i wanted to use.

ai_enabled

This is an interesting idea. I guess besides the decay you also want to make the structures indestructible.
I think you can define a zone yourself (just create a class for it) or reuse the existing zone ZoneSpecialConstructionRestricted.

Then edit the class ProtoObjectStructure, method ServerApplyDecay ΓÇö you can add a check like this in the first line of the method:

if (Api.GetProtoEntity<ZoneSpecialConstructionRestricted>()
       .ServerZoneInstance
       .IsContainsPosition(worldObject.TilePosition)
{
    return;
}

For the damage restriction, you will need to override the method ServerApplyDamage in a very similar way.

We will consider implementing this idea in A29 vanilla version. I'm not sure if the CPU overhead is worth it and also not sure whether it may cause some unexpected side effects.

Regards!

MightyMonte88

One unexpected side effect was that having structures near/in zones set to spawn NPCs, causes them not to spawn lol, i know i could make changes to prevent this but your right it's probably not worth it when i could simply just add map props.