Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
irc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
irc
Commits
b5786979
Commit
b5786979
authored
8 years ago
by
Diego Martínez
Browse files
Options
Downloads
Patches
Plain Diff
Use return values in `player_part.lua`.
Also minor style fixes.
parent
d5ad8ffc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
player_part.lua
+13
-13
13 additions, 13 deletions
player_part.lua
with
13 additions
and
13 deletions
player_part.lua
+
13
−
13
View file @
b5786979
...
...
@@ -4,20 +4,18 @@
function
irc
:
player_part
(
name
)
if
not
self
.
joined_players
[
name
]
then
minetest
.
chat_send_player
(
name
,
"IRC: You are not in the channel."
)
return
return
false
,
"You are not in the channel"
end
self
.
joined_players
[
name
]
=
nil
minetest
.
chat_send_player
(
name
,
"IRC: You are now out of
the channel
."
)
return
true
,
"You left
the channel
"
end
function
irc
:
player_join
(
name
)
if
self
.
joined_players
[
name
]
then
minetest
.
chat_send_player
(
name
,
"IRC: You are already in the channel."
)
return
return
false
,
"You are already in the channel"
end
self
.
joined_players
[
name
]
=
true
minetest
.
chat_send_player
(
name
,
"IRC: You are now in
the channel
."
)
return
true
,
"You joined
the channel
"
end
...
...
@@ -25,7 +23,7 @@ minetest.register_chatcommand("join", {
description
=
"Join the IRC channel"
,
privs
=
{
shout
=
true
},
func
=
function
(
name
,
param
)
irc
:
player_join
(
name
)
return
irc
:
player_join
(
name
)
end
})
...
...
@@ -33,7 +31,7 @@ minetest.register_chatcommand("part", {
description
=
"Part the IRC channel"
,
privs
=
{
shout
=
true
},
func
=
function
(
name
,
param
)
irc
:
player_part
(
name
)
return
irc
:
player_part
(
name
)
end
})
...
...
@@ -41,11 +39,13 @@ minetest.register_chatcommand("who", {
description
=
"Tell who is currently on the channel"
,
privs
=
{},
func
=
function
(
name
,
param
)
local
s
=
""
for
name
,
_
in
pairs
(
irc
.
joined_players
)
do
s
=
s
..
", "
..
name
local
out
,
n
=
{
},
0
for
name
in
pairs
(
irc
.
joined_players
)
do
n
=
n
+
1
out
[
n
]
=
name
end
minetest
.
chat_send_player
(
name
,
"Players On Channel:"
..
s
)
table.sort
(
out
)
return
true
,
"Players in channel: "
..
table.concat
(
out
,
", "
)
end
})
...
...
@@ -62,7 +62,7 @@ minetest.register_on_leaveplayer(function(player)
end
)
function
irc
:
sendLocal
(
message
)
for
name
,
_
in
pairs
(
self
.
joined_players
)
do
for
name
,
_
in
pairs
(
self
.
joined_players
)
do
minetest
.
chat_send_player
(
name
,
message
)
end
irc
:
logChat
(
message
)
...
...
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