02-22-2013, 06:04 PM
Hi All,
I'm finally back! sorry I've been away from the forums. It's just that there were big changes in my life this last couple of months. But anyway, I'm back!
So going back to business, redstone simulator. I've been working on the simulator to make it event based, and I noticed something that I wish to ask you guys opinions. Currently simulators only get notified of a change via the check function in the block handler. This function calls the Wake Up functions on all simulators in order to signal them. The only issue that I see is that simulators doesn't really know if a block was being placed or destroyed or modified, they only know that they are being wake up due to a change. So I wanted to propose that we add some functions to the base class of the simulators in order to handle these events and also to add the calls to the block handler. I was thinking of something like this on the base class of simulator:
BlockPlaced(int a_BlockX, int a_BlockY, int a_BlockZ);
BlockDestroyed(int a_BlockX, int a_BlockY, int a_BlockZ);
and also we would leave WakeUp function to be called during checks. So the idea is that when a block is placed, BlockPlaced is called on all simulators for the placed block, and the WakeUp function is called for all the neighbors. The same would be true when the block is destroyed except that BlockDestroyed would be called instead of BlockPlaced.
What do you guys think?
I'm finally back! sorry I've been away from the forums. It's just that there were big changes in my life this last couple of months. But anyway, I'm back!
So going back to business, redstone simulator. I've been working on the simulator to make it event based, and I noticed something that I wish to ask you guys opinions. Currently simulators only get notified of a change via the check function in the block handler. This function calls the Wake Up functions on all simulators in order to signal them. The only issue that I see is that simulators doesn't really know if a block was being placed or destroyed or modified, they only know that they are being wake up due to a change. So I wanted to propose that we add some functions to the base class of the simulators in order to handle these events and also to add the calls to the block handler. I was thinking of something like this on the base class of simulator:
BlockPlaced(int a_BlockX, int a_BlockY, int a_BlockZ);
BlockDestroyed(int a_BlockX, int a_BlockY, int a_BlockZ);
and also we would leave WakeUp function to be called during checks. So the idea is that when a block is placed, BlockPlaced is called on all simulators for the placed block, and the WakeUp function is called for all the neighbors. The same would be true when the block is destroyed except that BlockDestroyed would be called instead of BlockPlaced.
What do you guys think?