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!
Or is it maybe better to first blast the outmost container and work the way to the core?
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
Explodebut just burst into fragments and remove itself, right? It's not made of gunpowder or steam-tanks after all
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
Exitit'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
Damagecallback could get (or gets?) the source of the damage as a parameter like
Fx*Damageand then just check for
(Unless the object is contained, in which case stuff can just go to the parent container)
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?
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.
Of course some additional eyes on the code are appreciated.
* 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