Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
0b0075e6
Commit
0b0075e6
authored
8 years ago
by
Xunto
Committed by
est31
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Move on join and on leave messages to lua (#4460)
parent
cafa400f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
builtin/game/misc.lua
+11
-3
11 additions, 3 deletions
builtin/game/misc.lua
src/server.cpp
+0
-30
0 additions, 30 deletions
src/server.cpp
with
11 additions
and
33 deletions
builtin/game/misc.lua
+
11
−
3
View file @
0b0075e6
...
@@ -87,11 +87,19 @@ end
...
@@ -87,11 +87,19 @@ end
local
player_list
=
{}
local
player_list
=
{}
core
.
register_on_joinplayer
(
function
(
player
)
core
.
register_on_joinplayer
(
function
(
player
)
player_list
[
player
:
get_player_name
()]
=
player
local
player_name
=
player
:
get_player_name
()
player_list
[
player_name
]
=
player
core
.
chat_send_all
(
"*** "
..
player_name
..
" joined the game."
)
end
)
end
)
core
.
register_on_leaveplayer
(
function
(
player
)
core
.
register_on_leaveplayer
(
function
(
player
,
timed_out
)
player_list
[
player
:
get_player_name
()]
=
nil
local
player_name
=
player
:
get_player_name
()
player_list
[
player_name
]
=
nil
local
announcement
=
"*** "
..
player_name
..
" left the game."
if
timed_out
then
announcement
=
announcement
..
" (timed out)"
end
core
.
chat_send_all
(
announcement
)
end
)
end
)
function
core
.
get_connected_players
()
function
core
.
get_connected_players
()
...
...
This diff is collapsed.
Click to expand it.
src/server.cpp
+
0
−
30
View file @
0b0075e6
...
@@ -1118,23 +1118,6 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
...
@@ -1118,23 +1118,6 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
if
(
!
m_simple_singleplayer_mode
)
{
if
(
!
m_simple_singleplayer_mode
)
{
// Send information about server to player in chat
// Send information about server to player in chat
SendChatMessage
(
peer_id
,
getStatusString
());
SendChatMessage
(
peer_id
,
getStatusString
());
// Send information about joining in chat
{
std
::
string
name
=
"unknown"
;
Player
*
player
=
m_env
->
getPlayer
(
peer_id
);
if
(
player
!=
NULL
)
name
=
player
->
getName
();
std
::
wstring
message
;
message
+=
L"*** "
;
message
+=
narrow_to_wide
(
name
);
message
+=
L" joined the game."
;
SendChatMessage
(
PEER_ID_INEXISTENT
,
message
);
if
(
m_admin_chat
)
m_admin_chat
->
outgoing_queue
.
push_back
(
new
ChatEventNick
(
CET_NICK_ADD
,
name
));
}
}
}
Address
addr
=
getPeerAddress
(
player
->
peer_id
);
Address
addr
=
getPeerAddress
(
player
->
peer_id
);
std
::
string
ip_str
=
addr
.
serializeString
();
std
::
string
ip_str
=
addr
.
serializeString
();
...
@@ -2660,19 +2643,6 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
...
@@ -2660,19 +2643,6 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
Player
*
player
=
m_env
->
getPlayer
(
peer_id
);
Player
*
player
=
m_env
->
getPlayer
(
peer_id
);
// Collect information about leaving in chat
{
if
(
player
!=
NULL
&&
reason
!=
CDR_DENY
)
{
std
::
wstring
name
=
narrow_to_wide
(
player
->
getName
());
message
+=
L"*** "
;
message
+=
name
;
message
+=
L" left the game."
;
if
(
reason
==
CDR_TIMEOUT
)
message
+=
L" (timed out)"
;
}
}
/* Run scripts and remove from environment */
/* Run scripts and remove from environment */
{
{
if
(
player
!=
NULL
)
if
(
player
!=
NULL
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment