Author Topic: Stop floating brick kill chaining  (Read 2627 times)

I spawn builds floating in the air and players get to build on them. If they hammer a brick, control+z, or wand , it destroys the entire build they spawned on (it's a floating island).
I want to make it so that they can hammer bricks, control+z, or wand like normally and it treats the island like the ground. So they can hammer top bricks still (if they don't cause anything to fall).

My original idea was to rewrite willCauseChainKill() (which is guess isn't too big of a deal). I also would have to package fxDTSBrick::KillBrick and check to make sure it's an island brick (and if it is, don't kill it). I still see a few problems here, like it'd delete all the bricks that are floating but not part of the island (still attached to the island itself however).

I need a bit of a push in the right direction on how to solve this problem. I was also thinking about deleting the ground plane, so I'm not sure if building a tower to the island itself is all that great of an idea, but if there's absolutely no other way, i'll just go with with I guess (still pretty hard considering the lowest brick of an island can be anywhere on the bottom relative to the x and y axis and i'd have to position things just right to get this to work).

There's really no good way to do this. The only way you can really do it is to package fxDTSBrick::killBrick(%this) and reroute it to delete the brick instead of killing it. Though, this makes everything a bitch because to delete a build you literally have to wand every single brick instead of just a baseplate. There's really no way to detect what's causing the brick to kill either-- you'd have to package each and every onFire of every brick-killing weapon and rewrite it completely.

support the floating island with an invisible staticshape and make sure it has no other floating bricks.

I don't know if this still works in the current version, but it used to work fine:

package
Code: [Select]
function fxDTSBrick::hasPathToGround(%this) so that it calls a recursive method that will scan all upbricks and downbricks for what you want to act as a "solid" brick. This means having a special datablock or boolean field on your island bricks. You also have to be careful to mark bricks as "visited" in your recursion somehow or you'll lock up the game, and unmark them after you're done searching.

So in hasPathToGround(), first you see if the brick itself is an island brick, then you try to find a connection directly or indirectly to an island brick, and if you don't return true on either of those, call the parent.

Load the builds as public, see how that goes

Load the builds as public, see how that goes

Public builds works just like any normal brick group, except anyone can build on it.


Put the islands on the ground, look at the ground type /getid and type in console IDhere.delete();.
Assuming there's nothing else on the ground,

Didn't read last paragraph
« Last Edit: August 11, 2013, 08:10:25 AM by Starzy »

support the floating island with an invisible staticshape and make sure it has no other floating bricks.
OP, just do this, because it's the simplest/most elegant solution.

And static shapes just don't give a crap.

I don't know if this still works in the current version, but it used to work fine:

package
Code: [Select]
function fxDTSBrick::hasPathToGround(%this) so that it calls a recursive method that will scan all upbricks and downbricks for what you want to act as a "solid" brick. This means having a special datablock or boolean field on your island bricks. You also have to be careful to mark bricks as "visited" in your recursion somehow or you'll lock up the game, and unmark them after you're done searching.

So in hasPathToGround(), first you see if the brick itself is an island brick, then you try to find a connection directly or indirectly to an island brick, and if you don't return true on either of those, call the parent.

:(

I'll try the static shape method now

EDIT: Is there any specific shape I should use? Will empty.dts work? I tried dummyplayer (ID 3 in the game and the only premade staticshape datablock I could find while testing) and it still wouldn't let me kill the brick without breaking the others

EDIT 2:
Empty.dts didn't work
« Last Edit: August 13, 2013, 09:18:21 PM by DYLANzzz »


:(

I'll try the static shape method now

EDIT: Is there any specific shape I should use? Will empty.dts work? I tried dummyplayer (ID 3 in the game and the only premade staticshape datablock I could find while testing) and it still wouldn't let me kill the brick without breaking the others

EDIT 2:
Empty.dts didn't work
[i mg width=1000 height=844]http://i41.tinypic.com/20h8pwz.png[/img]
You need a custom dts shape with collision that does exactly fit in the brick grid, then you can load / plant the island on top as the shape can then support bricks by magic.