chraft/c-raft — Issue #126: Event-driven interaction with the nearby blocks
Author: Gremlin13
Created: 2011-10-29 10:17:50+00:00
State: open
Labels: High Priority, Task

I'm going to stick to an event-driven system, not the endless loop through all the entities every tick.
Each entity - starting from the EntityBase and all the derived classes - will have a check called on each MoveTo, MoveRotateTo and TeleportTo methods call. This check will loop through the nearby blocks (the blocks with which the entity collides) and call the block.Touch() method. The block itself will call the rest necessary methods - damage entity when necessary etc.
Another block method that will be implemented is something like InsideBlock(EntityBase, StructBlock). This is another type of event and is suitable only for drowning/suffocation/breath gauge replenishment.
So - one more time - two types of block interaction will exist - when the entity touches something and when the entity got inside of something.