fixes segfault when the world is being simulated after the player
exits (like e.g. on a server :>)
sprite/particle system
these could help make the world seem more alive
-
-server
-
- fix segfault at disconnect
public:
PlayerController(World &, Player &);
+ ~PlayerController();
World &GetWorld() noexcept { return world; }
const World &GetWorld() const noexcept { return world; }
player.GetEntity().SetController(*this);
}
+PlayerController::~PlayerController() {
+ if (&player.GetEntity().GetController() == this) {
+ player.GetEntity().UnsetController();
+ }
+}
+
void PlayerController::SetMovement(const glm::vec3 &m) noexcept {
if (dot(m, m) > 1.0f) {
move_dir = normalize(m);