I'm creating a gun that "encapsulates" liquid into throwables, functioning as a kind of space age bucket. I've got it all planned out except for how I'm going to remove the water "blocks" (or whatever) I interact with. Here's my current game plan, which I wanted to bounce off you guys before I waste any time attempting it: I plan to the gun place an invisible clone of a Tesla spike, only it damages itself, breaking it, effectively writing over the liquid and then vanishing. Do you guys think this approach could work?
What we did before we had the lua support for adding and removing liquid, we spawned basically a nil liquid. if you use liquid id 0 it's a null liquid and will remove the liquid it hits. You can combine this with your projectile to "capture" the liquid. Not sure how you are going to check whether or not it hits water, but thats an approach to consider.
If you were to go the object route, spawning an object in the liquid and then smashing it would definitely be possible. I think you might be able to make a monster spawn in actionOnReap of the projectile. If I recall correctly, the monster will spawn where the projectile died. You could call world.liquidAt in the monster lua (most likely the main function), with it's position being the only argument. Here's the function in the documentation: I'd like to think that you could use this to tell if there's a liquid at the same position as the monster, or where the projectile died. I trust that you know very well where to go from here, combining the method that severedskullz proposed. Edit: Figured the spawnLiquid function would be pretty useful too Edit #2: Removed images.
Well if we are using that work-around (Though I try to avoid it at all costs), you are already in the lua envournment... so there is no need to spawn "anti-water". Just use the destroyLiquid function instead.
I agree with you completely, but "Hacks" like this need to be avoided if possible, which is why I dont often suggest things like this. Had a guy I recommended a hack like this to, who turned the creature invisible, passive, and never moved. He forgot to kill off the monster afterwards, and thus it lagged his game to an unplayable state since he had mistakenly kept them "persistent" from the mob he copied. tl:dr : Be careful with hacky workarounds like this, especially if you don't know what you are doing.