Package list minetest-mod-character-creator / 4100c12
Import upstream version 1.1+git20211006.1.e026a1f Debian Janitor 6 months ago
17 changed file(s) with 74 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
33 unified_inventory?
44 skinsdb?
55 sfinv_buttons?
6 sfinv?
141141
142142 local function save_skin(player)
143143 local player_meta = player:get_meta()
144 if player_meta == nil then
145 -- The player disconnected before this function was dispatched
146 return
147 end
144148
145149 local function save_data(data_name)
146150 local indexes = skin_indexes[player]
161165
162166 local function get_texture(player)
163167 local player_meta = player:get_meta()
168 if player_meta == nil then
169 -- The player disconnected before this function was dispatched
170 return ""
171 end
172
164173 local indexes = skin_indexes[player]
165174 local texture = ""
166175 local gender = player_meta:get_string("character_creator:gender")
198207
199208 local function change_skin(player)
200209 local player_meta = player:get_meta()
210 if player_meta == nil then
211 -- The player disconnected before this function was dispatched
212 return
213 end
214
201215 local texture = get_texture(player)
202216
203217 local width = player_meta:get_float("character_creator:width")
210224 }
211225 })
212226
213 local name = player:get_player_name()
214
215227 if minetest.get_modpath("multiskin") then
216 multiskin.layers[name].skin = texture
217 armor:set_player_armor(player)
218 multiskin:set_player_textures(player, {textures = {texture}})
228 local name = player:get_player_name()
229 minetest.after(0, function(name)
230 local player = minetest.get_player_by_name(name)
231 if player then
232 multiskin.layers[player_name].skin = texture
233 armor:set_player_armor(player)
234 multiskin:set_player_textures(player, {textures = {texture}})
235 end
236 end, name)
237
219238 elseif minetest.get_modpath("3d_armor") then
220 armor.textures[name].skin = texture
221 armor:set_player_armor(player)
239 local name = player:get_player_name()
240 minetest.after(0, function(name)
241 local player = minetest.get_player_by_name(name)
242 if player then
243 armor.textures[name].skin = texture
244 armor:set_player_armor(player)
245 end
246 end, name)
247
222248 else
223249 player:set_properties({textures = {texture}})
224250 end
230256 --change skin redefinition for skinsdb
231257 function change_skin(player)
232258 local player_meta = player:get_meta()
259 if player_meta == nil then
260 -- The player disconnected before this function was dispatched
261 return
262 end
263
233264 local playername = player:get_player_name()
234265 local skinname = "character_creator:"..playername
235266 local skin_obj = skinsdb.get(skinname) or skinsdb.new(skinname)
236267 skin_obj:set_meta("format", "1.0")
237268 skin_obj:set_meta("visual_size_x", player_meta:get_float("character_creator:width"))
238269 skin_obj:set_meta("visual_size_y", player_meta:get_float("character_creator:height"))
239 skin_obj:apply_skin_to_player(player)
240 skinsdb.assign_player_skin(player, "character_creator:"..playername)
270 skinsdb.assign_player_skin(player, skinname)
271 skinsdb.update_player_skin(player)
241272 save_skin(player)
242273 end
243274 end
261292 end
262293
263294 -- set data
264 skin_obj:set_preview("inventory_plus_character_creator.png")
265295 skin_obj:set_meta("name","Character Creator")
266296 --skin_obj:set_meta("author", "???")
267297 skin_obj:set_meta("license", "MIT / CC-BY-SA 3.0 Unported")
429459 title = "Character Creator",
430460 action = show_formspec,
431461 })
432 end
462
463 elseif not skinsdb and not minetest.get_modpath("sfinv_buttons")
464 and minetest.global_exists("sfinv") and sfinv.enabled then
465
466 local old_func = sfinv.pages["sfinv:crafting"].get
467 sfinv.override_page("sfinv:crafting", {
468 get = function(self, player, context)
469 local fs = old_func(self, player, context)
470 return fs .. "image_button[0,0;1,1;inventory_plus_character_creator.png;character_creator;]"
471 end
472 })
473
474 minetest.register_on_player_receive_fields(function(player, formname, fields)
475 if fields.character_creator then
476 show_formspec(player)
477 return true
478 end
479 end)
480 end
00 name = character_creator
11 description = Allows the creation of customized character skins inside the game.
22 license = MIT
3 optional_depends = 3d_armor, multiskin, inventory_plus, unified_inventory, skinsdb, sfinv_buttons
3 optional_depends = 3d_armor, multiskin, inventory_plus, unified_inventory, skinsdb, sfinv_buttons, sfinv
248248 ["Yellow T-Shirt"] = "cc_tshirt_yellow.png",
249249 ["Black T-Shirt"] = "cc_tshirt_black.png",
250250 ["Blue T-Shirt"] = "cc_tshirt_blue.png",
251 ["Brown Vest"] = "cc_vest_brown.png",
252 ["Green Vest"] = "cc_vest_green.png",
253 ["Blue Vest"] = "cc_vest_blue.png",
254 ["Brown Shirt"] = "cc_shirt_canvas_brown.png",
255 ["Green Shirt"] = "cc_shirt_canvas_green.png",
256 ["Blue Shirt"] = "cc_shirt_canvas_blue.png",
251257 },
252258
253259 pants = {
259265 ["White Pants"] = "cc_pants_white.png",
260266 ["Yellow Pants"] = "cc_pants_yellow.png",
261267 ["Black Pants"] = "cc_pants_black.png",
268 ["Brown Canvas Pants"] = "cc_pants_canvas_brown.png",
269 ["Green Canvas Pants"] = "cc_pants_canvas_green.png",
270 ["Blue Canvas Pants"] = "cc_pants_canvas_blue.png",
262271 },
263272
264273 shoes = {
265274 ["Leather Shoes"] = "cc_shoes_leather.png",
266275 ["Canvas Shoes"] = "cc_shoes_canvas.png",
267276 ["Fur Shoes"] = "cc_shoes_fur.png",
277 ["Brown Shoes"] = "cc_shoes_brown.png",
278 ["Green Shoes"] = "cc_shoes_green.png",
279 ["Blue Shoes"] = "cc_shoes_blue.png",
280 ["Black Shoes"] = "cc_shoes_black.png",
268281 }
269282 }
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown