add 'entity.despawn' command
This commit is contained in:
@@ -135,6 +135,10 @@ void Player::updateInput(PlayerInput& input, float delta) {
|
||||
input.flight = false;
|
||||
}
|
||||
|
||||
void Player::updateSelectedEntity() {
|
||||
selectedEid = selection.entity;
|
||||
}
|
||||
|
||||
void Player::postUpdate() {
|
||||
auto entity = level->entities->get(eid);
|
||||
if (!entity.has_value()) {
|
||||
@@ -225,6 +229,10 @@ void Player::setEntity(entityid_t eid) {
|
||||
this->eid = eid;
|
||||
}
|
||||
|
||||
entityid_t Player::getSelectedEntity() const {
|
||||
return selectedEid;
|
||||
}
|
||||
|
||||
std::shared_ptr<Inventory> Player::getInventory() const {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ class Player : public Object, public Serializable {
|
||||
bool flight = false;
|
||||
bool noclip = false;
|
||||
entityid_t eid;
|
||||
entityid_t selectedEid;
|
||||
public:
|
||||
std::shared_ptr<Camera> camera, spCamera, tpCamera;
|
||||
std::shared_ptr<Camera> currentCamera;
|
||||
@@ -66,6 +67,7 @@ public:
|
||||
void teleport(glm::vec3 position);
|
||||
void updateEntity();
|
||||
void updateInput(PlayerInput& input, float delta);
|
||||
void updateSelectedEntity();
|
||||
void postUpdate();
|
||||
|
||||
void attemptToFindSpawnpoint();
|
||||
@@ -83,6 +85,8 @@ public:
|
||||
|
||||
entityid_t getEntity() const;
|
||||
void setEntity(entityid_t eid);
|
||||
|
||||
entityid_t getSelectedEntity() const;
|
||||
|
||||
std::shared_ptr<Inventory> getInventory() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user