Moving blocks
#1
Al right, I admit, this is a bit crazy idea, but bare with me:

What if we sent a client a packet, that tells it that some particular block is moved by a piston? And (magic) there isn't, and never was any piston. At all.
I assume (after short digging through MCS source), that this is possible. My serach led me to "cProtocol125::SendBlockAction" all the way from "cPiston::ExtendPiston". cPiston class uses "cWorld::BroadcastBlockAction" to perform such an action.
But it's now Lua-exported, and I assume there is quite good reason for it Smile

Question is: could we have some function in lua to move blocks without pistons? ^_^ That would be... awesome.
Reply
Thanks given by:
#2
Though I'm not sure what it would do client-side, I don't quite follow what you're trying to achieve. All that the SendBlockAction should be doing is the animation; the actual block placement is handled via normal BlockChange packets. So why not simply use cWorld:SetBlock() ?
Reply
Thanks given by:
#3
i think he wants to have the animation when the blocks are moving Smile
Reply
Thanks given by:
#4
Quote:i think he wants to have the animation when the blocks are moving
Exactly. Think about moving elevators. FAST moving elevators (since there won't be piston retract delay and other inch-worm issues). Fast and silent. Any type of cabin. That's goddamn awesome! We could even make trains out of blocks Smile
Reply
Thanks given by:
#5
Doesn't that action only apply to pistons? I mean you tell a piston to push, and then the block next to the piston will be pushed instead of move out of its own
Reply
Thanks given by:
#6
Quote:Doesn't that action only apply to pistons?
Yeah, looks so. Still, we could fake piston existance, could we?
Reply
Thanks given by:
#7
Dunno, the "Block Action" packet has the BlockID - if we send a piston block ID, would it fake a piston?

If not, how about faking it through tile entities, like falling sand and gravel do? Convert the block into a tile entity, move that entity smoothly across, then convert it back into a block.
Reply
Thanks given by:
#8
Quote:Convert the block into a tile entity, move that entity smoothly across, then convert it back into a block.
I'm not sure if any block could be recognized as tile entity. Inside server - yes, inside client - ????

Would anyone mind writing a generic "FakePiston()" lua function that will do exactly the same, what real piston does? (I'm talking about duplicated code right now so we could easily remove in then... Only for test purpose)
Reply
Thanks given by:
#9
I'm bringing this matter up once again.
(after touching some low-level-ish concepts (by my standarts) in lua I feel a bit too restricted by careful and cautious MCS APIBig Grin)

Is there a reason why cWorld::BroadcastBlockAction isn't exported? Like real one, "it will all break down" kind of reason?
I can see BroadcastSoundEffect and BroadcastSoundParticleEffect here, so why won't we make BlockAction broadcastable as well?

Tried to look up TileEntities in the API, had no luck. Are they even exported or something?
Reply
Thanks given by:
#10
I think the only reason is that no-one had the need to export it.

TileEntities are called BlockEntities in MCS, you'd find them if you looked up cChestEntity, for example - it inherits from cBlockEntityWithItems which in turn inherits from cBlockEntity.
Reply
Thanks given by: Taugeshtu




Users browsing this thread: 1 Guest(s)