add 'entity.despawn' command

This commit is contained in:
MihailRis
2024-07-17 07:35:02 +03:00
parent c9958c9718
commit 41a22938d6
8 changed files with 41 additions and 5 deletions
+8
View File
@@ -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;
}
+4
View File
@@ -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;