midspace / Space-Engineers-Admin-script-mod

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

Protected Area is not protecting from Warhead's #192

Open midspace opened 6 years ago

midspace commented 6 years ago

From SteamCommunity

Gulak:
[Bug] Warhead in Protected area
I cought some players destroying ships inside protected área using warheads. Then I was replied the problem. I created a new ship outside the secure área, changed the ownership and /builtby to another player and I fly to the secure zone.

After that I removed my admin status and built some warheads close to the ship. well... RIP test ship.

http://steamcommunity.com/workshop/filedetails/discussion/316190120/1700542332339645945/

midspace commented 6 years ago

I've done some testing, and it appears the game arbitrarily destroys all cubes within the center sphere of the warhead explosion. It ignores the "damage" setting of 0 entirely, as those cubes are simply destroyed.

midspace commented 6 years ago

I've logged an issue with Keen, however it might take a while to get a fix or a work-around that allows us to prevent those cubes from been destroyed.

midspace commented 6 years ago

I'm going to look for a method of blocking the trigger on the Warhead instead, and prevent it from exploding in the first place. I'm not sure if one exists currently.

midspace commented 6 years ago

I had a good look, and I can't find any way of overriding the Detonate action of the Warhead.

Spcemarine commented 6 years ago

Hmm, a shame that we can't override it... For workarounds we have a few (bad and even worse) options:

EDIT: If the performance impact of the last option is not too heavy it's the best choice in my opinion. But I think it's not a modder's job to implement workarounds for API bugs at the cost of performance.

midspace commented 6 years ago

The biggest risk is, a cube is built outside of the PA, the warheads enabled, and then sent in either remotely, or dumb launch. With either a Timer block, PB, or the warhead timer itself to detonate it.

That said, I did find a gap in the PA code, where the RegisterBeforeDamageHandler(object, MyDamageInformation) was passing a IMyCubeBlock instead of IMySlimBlock in some cases. I am patching that now.