midspace / Space-Engineers-Admin-script-mod

Modding script for Space Engineers with dozens of Admin commands for creating game scenarios or supporting servers.
44 stars 13 forks source link

Protection areas are not working #136

Closed midspace closed 8 years ago

midspace commented 8 years ago
demolish50 14 Dec @ 8:26am  Delete
Created a small PA just a minute ago. It made the entire server non grindable. The PA was supposed to be 2500m near a station on a planet. Verified range with /pa list. Just a heads up.

I haven't had a close look at the code yet. I have tested on current public version 1.112.013, and it is most definitely not working on dedicated servers. If I run it as single player, it works.

midspace commented 8 years ago

At the moment, I think there is a startup state issue. If you have just set the protection area, it doesn't work. Restarting the Server, it will work. I'm still investigating to verify.

midspace commented 8 years ago

I've retested with the published mod on a clean server, and it works as expected. I'm really confused now. Whatever is failing is intermittent, and hard to narrow down.

Spcemarine commented 8 years ago

Ok, that indeed is weird... I'll look into it later, probably around weekend.

Spcemarine commented 8 years ago

I could not reproduce it at all. I'll look into the code again but I don't have a clue what could've gone wrong. Same thing with the indestructible blocks on servers. I should not be an issue that the protection is enabled by default as there isn't any PA. Only if they invert the protection everything becomes indestructible. But how do you do that by mistake? Oo

midspace commented 8 years ago

That first piece of logic in the DamageHandler may be at fault. Do missiles identify the attacker? If they don't then it will fall through and prevent damage.

But, the defaulting on was bad. In testing I switched it off. Saved the server. Shut down the server. Confirmed the setting in the file. Restarted the server. The setting was back on.

        private static void DamageHandler(object target, ref MyDamageInformation info)
        {
            if (!Config.ProtectionEnabled)
                return;

            IMySlimBlock block = target as IMySlimBlock;

            if (block != null)
            {
                IMyEntity attacker;
                if (MyAPIGateway.Entities.TryGetEntityById(info.AttackerId, out attacker))
                {
                    if (CanDamageBlock(info.AttackerId, block, info.Type))
                        return;
                }

                info.Amount = 0;
                return;
            }
midspace commented 8 years ago

I'll have a look again tomorrow at my protection area config files in case I missed something with the Invert. i don't remember turning it on. It was in my published development mod where the grinding didn't work for anything. The codebase is the same, but the config file may be different from what I tested today. It could be on. Very easy to miss. If that's the case, then we need to make the current state more visible in the List and Cfg sub commands.

midspace commented 8 years ago

Though it does not explain why it suddenly started working for demolish50, when I had not published any updates.

.... Unless it was that Steam Publish bug. :confounded:

midspace commented 8 years ago

In all my testing, the files all show <ProtectionInverted>false</ProtectionInverted>

Spcemarine commented 8 years ago

Ok, I just fixed the issue with missiles/explosions in general. I hope we're done with it now but I leave this open for now in case there are still issues.

midspace commented 8 years ago

Eight months have passed, as there have not been any new concerns raised about this issue, I'm closing it.