Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
homedecor_modpack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
homedecor_modpack
Commits
a4ca53cc
Commit
a4ca53cc
authored
6 years ago
by
bell07
Committed by
Vanessa Dannenberg
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix players in bed count for multiplayer (#404)
parent
017326db
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
homedecor/handlers/mt_game_beds_functions.lua
+9
-4
9 additions, 4 deletions
homedecor/handlers/mt_game_beds_functions.lua
with
9 additions
and
4 deletions
homedecor/handlers/mt_game_beds_functions.lua
+
9
−
4
View file @
a4ca53cc
...
...
@@ -2,7 +2,6 @@
-- with changes needed for homedecor's beds.
local
pi
=
math.pi
local
player_in_bed
=
0
local
is_sp
=
minetest
.
is_singleplayer
()
local
enable_respawn
=
minetest
.
settings
:
get_bool
(
"enable_bed_respawn"
)
if
enable_respawn
==
nil
then
...
...
@@ -49,6 +48,14 @@ local function check_in_beds(players)
return
#
players
>
0
end
local
function
get_player_in_bed
()
local
player_in_bed
=
0
for
k
,
v
in
pairs
(
beds
.
player
)
do
player_in_bed
=
player_in_bed
+
1
end
return
player_in_bed
end
local
function
lay_down
(
player
,
pos
,
bed_pos
,
state
,
skip
)
local
name
=
player
:
get_player_name
()
local
hud_flags
=
player
:
hud_get_flags
()
...
...
@@ -62,7 +69,6 @@ local function lay_down(player, pos, bed_pos, state, skip)
local
p
=
beds
.
pos
[
name
]
or
nil
if
beds
.
player
[
name
]
~=
nil
then
beds
.
player
[
name
]
=
nil
player_in_bed
=
player_in_bed
-
1
end
-- skip here to prevent sending player specific changes (used for leaving players)
if
skip
then
...
...
@@ -84,8 +90,6 @@ local function lay_down(player, pos, bed_pos, state, skip)
else
beds
.
player
[
name
]
=
1
beds
.
pos
[
name
]
=
pos
player_in_bed
=
player_in_bed
+
1
-- physics, eye_offset, etc
player
:
set_eye_offset
({
x
=
0
,
y
=
-
13
,
z
=
0
},
{
x
=
0
,
y
=
0
,
z
=
0
})
local
yaw
,
fdir
=
get_look_yaw
(
bed_pos
)
...
...
@@ -109,6 +113,7 @@ end
local
function
update_formspecs
(
finished
)
local
ges
=
#
minetest
.
get_connected_players
()
local
player_in_bed
=
get_player_in_bed
()
local
form_n
local
is_majority
=
(
ges
/
2
)
<
player_in_bed
...
...
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