Skip to content

Commit 9dd432c

Browse files
committedMay 12, 2018
Run detach callbacks on player leave
Correct docs regarding non-nil detaching children
1 parent a292d19 commit 9dd432c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎doc/lua_api.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -4869,9 +4869,9 @@ Registered entities
48694869
* `killer`: an `ObjectRef` (can be `nil`)
48704870
* `on_rightclick(self, clicker)`
48714871
* `on_attach_child(self, child)`
4872-
* `child`: an `ObjectRef` (can be `nil`) of the child that attaches
4872+
* `child`: an `ObjectRef` of the child that attaches
48734873
* `on_detach_child(self, child)`
4874-
* `child`: an `ObjectRef` (can be `nil`) of the child that detaches
4874+
* `child`: an `ObjectRef` of the child that detaches
48754875
* `on_detach(self, parent)`
48764876
* `parent`: an `ObjectRef` (can be `nil`) from where it got detached
48774877
* This happens before the parent object is removed from the world

‎src/server.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -2632,6 +2632,9 @@ void Server::DeleteClient(session_t peer_id, ClientDeletionReason reason)
26322632
PlayerSAO *playersao = player->getPlayerSAO();
26332633
assert(playersao);
26342634

2635+
playersao->clearChildAttachments();
2636+
playersao->clearParentAttachment();
2637+
26352638
// inform connected clients
26362639
NetworkPacket notice(TOCLIENT_UPDATE_PLAYER_LIST, 0, PEER_ID_INEXISTENT);
26372640
// (u16) 1 + std::string represents a vector serialization representation

0 commit comments

Comments
 (0)
Please sign in to comment.