mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 22:59:02 +00:00
Cubot implements Attackable (untested)
This commit is contained in:
@@ -257,6 +257,9 @@ public abstract class GameObject implements JSONSerialisable, MongoSerialisable
|
||||
|
||||
/**
|
||||
* Called before this GameObject is removed from the world - defaults to doing nothing
|
||||
* @return true if cancelled
|
||||
*/
|
||||
public void onDeadCallback() { }
|
||||
public boolean onDeadCallback() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -147,9 +147,12 @@ public class World implements MongoSerialisable {
|
||||
for (GameObject object : gameObjects.values()) {
|
||||
//Clean up dead objects
|
||||
if (object.isDead()) {
|
||||
object.onDeadCallback();
|
||||
removeObject(object);
|
||||
//LogManager.LOGGER.fine("Removed object " + object + " id: " + object.getObjectId());
|
||||
|
||||
if (!object.onDeadCallback()) {
|
||||
removeObject(object);
|
||||
//LogManager.LOGGER.fine("Removed object " + object + " id: " + object.getObjectId());
|
||||
}
|
||||
|
||||
} else if (object instanceof Updatable) {
|
||||
((Updatable) object).update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user