There something wrong with explosions from objects inside containers causing double the damage to the container itself. Now this begs the questions, how should these explosions behave.
First of all containers can be contained in containers, so we can have a stack of containers. I will put some notions which should be true in general.
* If the exploding object is inside a container with ContainBlast (or any container in the stack is ContainBlast) the explosion should not affect the landscape or objects outside the stack of containers.
* If there is no ContainBlast in the stack of containers, it should affect the landscape and outside objects.
* At all times the explosion should affect the objects inside the container and the container itself.
* An explosion cause damage to parent containers and their contents until a container which contains the blast is reached.
Example 1: Flint in lorry in wagon in submarine: flint damages lorry and its contents, then damages wagon and its contents then damages submarine and its contents, no damaging of landscape and objects outside cause submarine is ContainBlast.
Example 2: Flint in Submarine in wagon: flint damage submarine and contents and nothing more since the blast is contained.
Would this be the preferred and expected behaviour? Feedback needed!
First of all containers can be contained in containers, so we can have a stack of containers. I will put some notions which should be true in general.
* If the exploding object is inside a container with ContainBlast (or any container in the stack is ContainBlast) the explosion should not affect the landscape or objects outside the stack of containers.
* If there is no ContainBlast in the stack of containers, it should affect the landscape and outside objects.
* At all times the explosion should affect the objects inside the container and the container itself.
* An explosion cause damage to parent containers and their contents until a container which contains the blast is reached.
Example 1: Flint in lorry in wagon in submarine: flint damages lorry and its contents, then damages wagon and its contents then damages submarine and its contents, no damaging of landscape and objects outside cause submarine is ContainBlast.
Example 2: Flint in Submarine in wagon: flint damage submarine and contents and nothing more since the blast is contained.
Would this be the preferred and expected behaviour? Feedback needed!
It gets more technical, what happens when a container inside a container explodes? Where do the objects go? inside the parent container? And then do they get blasted twice?
Or is it maybe better to first blast the outmost container and work the way to the core?
Or is it maybe better to first blast the outmost container and work the way to the core?
Not for all objects, I want for example to make the lorry scatter its contents when it explodes.
Cause I wanted to try that, in my opinion that should not be an indestructible vehicles somehow.
Edit but this is not really a lorry specific problem, but will also affect content developers.
Edit but this is not really a lorry specific problem, but will also affect content developers.

Damage
-Callback and care for flinging around its contents itself?Where do you need engine support?
PS: and the lorry wouldn't
Explode
but just burst into fragments and remove itself, right? It's not made of gunpowder or steam-tanks after all

A destruction callback can be triggered in many ways (blast, burned, out of landscape, script), not all of them should toss objects around, but the explosion initiated one should.

That could be solved by making the explosion deal damage to the container first. IFF the container is destroyed through that damage, it would simply
Exit
it's contents. And since the explosion had not worked through all the free objects yet, it would just treat the former contents like usual free objects and fling them around.PS: also the
Damage
callback could get (or gets?) the source of the damage as a parameter like Fx*Damage
and then just check for FX_Call_DmgBlast

(Unless the object is contained, in which case stuff can just go to the parent container)
Let me first try to fix the explode bug and fix the remove object behaviour when contents are not deleted.
And then implement this behaviour for the lorry only (is already done, that is how I found the bug), and then we can see how we like it, it makes settlement a bit more dangerous :D
And then implement this behaviour for the lorry only (is already done, that is how I found the bug), and then we can see how we like it, it makes settlement a bit more dangerous :D


> Where do the objects go? inside the parent container?
Of course inside the parent container. Everything else would make no sense.
> And then do they get blasted twice?
Why? Do objects get blasted twice when their container (not contained) explodes?
Currently, I haven't tested, but I have found a way to prevent that.
Indeed they should go into the parent container, but currently they don't do that I suppose. RemoveObject has a parameter which is off default to eject contents on object removal.
But script solutions could do something else obviously...
Let me outline a new approach which also involves changes to RemoveObject at some later point, when it is more evolved.
Indeed they should go into the parent container, but currently they don't do that I suppose. RemoveObject has a parameter which is off default to eject contents on object removal.
But script solutions could do something else obviously...
Let me outline a new approach which also involves changes to RemoveObject at some later point, when it is more evolved.
The last four commits here contain the current status, I will do some more testing to see whether all corner cases are covered and then push it.
Of course some additional eyes on the code are appreciated.
Of course some additional eyes on the code are appreciated.
Current changes pushed:
* ContainBlast is now a property, either false or true.
* RemoveObject(true) first tries to enter its contents into the parent container instead of exiting them altogether.
* Test scenario for explosions in containers.
* Changed explosion behaviour:
* explode container first and then move up the list of parent containers until a BlastContain one or the last one is found.
* BlastContain prevents damage to landscape and outside objects / parent containers.
* exploding in a container means, deal damage to container first, then to contents.
* if container is destructed, move contents outside (or they are removed), they will be blasted later.
* explosions propagated to a parent container do not damage the child container (it has already been damaged).
* The lorry now ejects its contents on destruction and also tosses around a few burning fragments.
Only remaining issue:
A BlastContain container which is destroyed, will contain the blast when inside other containers, but not when it is the last one.
What is the expected behaviour there?
* ContainBlast is now a property, either false or true.
* RemoveObject(true) first tries to enter its contents into the parent container instead of exiting them altogether.
* Test scenario for explosions in containers.
* Changed explosion behaviour:
* explode container first and then move up the list of parent containers until a BlastContain one or the last one is found.
* BlastContain prevents damage to landscape and outside objects / parent containers.
* exploding in a container means, deal damage to container first, then to contents.
* if container is destructed, move contents outside (or they are removed), they will be blasted later.
* explosions propagated to a parent container do not damage the child container (it has already been damaged).
* The lorry now ejects its contents on destruction and also tosses around a few burning fragments.
Only remaining issue:
A BlastContain container which is destroyed, will contain the blast when inside other containers, but not when it is the last one.
What is the expected behaviour there?

> * RemoveObject(true) first tries to enter its contents into the parent container instead of exiting them altogether.
I suspect you made the last changes on RemoveObject. If yes, then I wanted to bring this to your attention: http://bugs.openclonk.org/view.php?id=1950
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill