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
ac107028
Commit
ac107028
authored
6 years ago
by
codexp
Committed by
Vanessa Dannenberg
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
prepare code to be reused later
parent
fe2acaaa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homedecor/wardrobe.lua
+15
-18
15 additions, 18 deletions
homedecor/wardrobe.lua
with
15 additions
and
18 deletions
homedecor/wardrobe.lua
+
15
−
18
View file @
ac107028
...
...
@@ -9,9 +9,21 @@ local wd_cbox = {
-- cache set_textures function (fallback to old version)
-- default.player_set_textures is deprecated and will be removed in future
local
set_player_textures
=
minetest
.
g
lobal_exists
(
"player_api"
)
and
player_api
.
set_textures
minetest
.
g
et_modpath
(
"player_api"
)
and
player_api
.
set_textures
or
default
.
player_set_textures
local
armor_mod_path
=
minetest
.
get_modpath
(
"3d_armor"
)
local
skins
=
{
"male1"
,
"male2"
,
"male3"
,
"male4"
,
"male5"
}
local
function
set_player_skin
(
player
,
skin
)
if
armor_mod_path
then
-- if 3D_armor's installed, let it set the skin
armor
.
textures
[
player
:
get_player_name
()].
skin
=
skin
armor
:
update_player_visuals
(
player
)
else
set_player_textures
(
player
,
{
skin
})
end
end
homedecor
.
register
(
"wardrobe"
,
{
mesh
=
"homedecor_bedroom_wardrobe.obj"
,
tiles
=
{
...
...
@@ -33,7 +45,6 @@ homedecor.register("wardrobe", {
},
on_construct
=
function
(
pos
)
local
meta
=
minetest
.
get_meta
(
pos
)
local
skins
=
{
"male1"
,
"male2"
,
"male3"
,
"male4"
,
"male5"
}
-- textures made by the Minetest community (mostly Calinou and Jordach)
local
clothes_strings
=
""
for
i
=
1
,
5
do
...
...
@@ -50,26 +61,12 @@ homedecor.register("wardrobe", {
"listring[]"
)
end
,
on_receive_fields
=
function
(
pos
,
formname
,
fields
,
sender
)
local
skins
=
{
"male1"
,
"male2"
,
"male3"
,
"male4"
,
"male5"
}
local
playerName
=
sender
:
get_player_name
()
local
armor_mod
=
minetest
.
get_modpath
(
"3d_armor"
)
for
i
=
1
,
5
do
if
fields
[
skins
[
i
]]
then
if
armor_mod
then
-- if 3D_armor's installed, let it set the skin
armor
.
textures
[
playerName
].
skin
=
"homedecor_clothes_"
..
skins
[
i
]
..
".png"
armor
:
update_player_visuals
(
sender
)
break
end
set_player_textures
(
sender
,
{
"homedecor_clothes_"
..
skins
[
i
]
..
".png"
})
set_player_skin
(
sender
,
"homedecor_clothes_"
..
skins
[
i
]
..
".png"
)
break
elseif
fields
[
"fe"
..
skins
[
i
]]
then
if
armor_mod
then
armor
.
textures
[
playerName
].
skin
=
"homedecor_clothes_fe"
..
skins
[
i
]
..
".png"
armor
:
update_player_visuals
(
sender
)
break
end
set_player_textures
(
sender
,
{
skin
=
"homedecor_clothes_fe"
..
skins
[
i
]
..
".png"
})
set_player_skin
(
sender
,
"homedecor_clothes_fe"
..
skins
[
i
]
..
".png"
)
break
end
end
...
...
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