Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wardrobe
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
wardrobe
Commits
fe4c644b
Commit
fe4c644b
authored
10 years ago
by
leroux raphael
Browse files
Options
Downloads
Patches
Plain Diff
Add support for 3d_armor
parent
f9787a93
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
init.lua
+16
-5
16 additions, 5 deletions
init.lua
with
16 additions
and
5 deletions
init.lua
+
16
−
5
View file @
fe4c644b
...
...
@@ -5,6 +5,10 @@ local WORLD_PATH = minetest.get_worldpath();
if
MOD_NAME
~=
"wardrobe"
then
error
(
"mod directory must be named 'wardrobe'"
);
end
local
armor_mod
=
false
;
if
minetest
.
get_modpath
(
"3d_armor"
)
then
armor_mod
=
true
;
end
;
wardrobe
=
{};
dofile
(
MOD_PATH
..
"/storage.lua"
);
...
...
@@ -21,7 +25,6 @@ do
local
haveCharName
=
false
;
-- 'character.*' has priority
local
name
=
nil
;
local
nNames
=
0
;
for
k
in
pairs
(
default
.
registered_player_models
)
do
if
string.find
(
k
,
"^character\\.[^\\.]+$"
)
then
if
haveCharName
then
nNames
=
2
;
break
;
end
;
...
...
@@ -39,11 +42,14 @@ do
end
;
function
wardrobe
.
setPlayerSkin
(
player
)
-- If 3d_armor is installed, let him set the model and textures
if
armor_mod
then
return
end
local
playerName
=
player
:
get_player_name
();
if
not
playerName
or
playerName
==
""
then
return
;
end
if
not
playerName
or
playerName
==
""
then
return
;
end
;
local
skin
=
wardrobe
.
playerSkins
[
playerName
];
if
not
skin
or
not
wardrobe
.
skinNames
[
skin
]
then
return
;
end
if
not
skin
or
not
wardrobe
.
skinNames
[
skin
]
then
return
;
end
;
player
:
set_properties
(
{
...
...
@@ -58,15 +64,21 @@ function wardrobe.changePlayerSkin(playerName, skin)
local
player
=
minetest
.
get_player_by_name
(
playerName
);
if
not
player
then
error
(
"unknown player '"
..
playerName
..
"'"
);
return
;
end
if
skin
and
not
wardrobe
.
skinNames
[
skin
]
then
error
(
"unknown skin '"
..
skin
..
"'"
);
return
;
end
wardrobe
.
playerSkins
[
playerName
]
=
skin
;
wardrobe
.
storage
.
savePlayerSkins
();
wardrobe
.
setPlayerSkin
(
player
);
-- If 3d_armor is installed, update the skin texture and the armor
if
armor_mod
then
armor
.
textures
[
playerName
].
skin
=
skin
;
armor
:
update_player_visuals
(
player
);
else
wardrobe
.
setPlayerSkin
(
player
)
end
end
minetest
.
register_on_joinplayer
(
...
...
@@ -77,4 +89,3 @@ minetest.register_on_joinplayer(
end
,
player
);
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