added character editor
This commit is contained in:
parent
fba463ef4a
commit
e0459d1783
16
mods/character_editor/LICENSE.txt
Normal file
16
mods/character_editor/LICENSE.txt
Normal file
@ -0,0 +1,16 @@
|
||||
License for Code
|
||||
----------------
|
||||
|
||||
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
License for Media
|
||||
-----------------
|
||||
|
||||
CC-BY-SA 3.0 UNPORTED. Created by cd2 (cdqwertz)
|
56
mods/character_editor/init.lua
Normal file
56
mods/character_editor/init.lua
Normal file
@ -0,0 +1,56 @@
|
||||
character_editor = {}
|
||||
character_editor.characters = {}
|
||||
character_editor.mesh = {}
|
||||
|
||||
character_editor.shirts = {"character_editor_red_shirt.png", "character_editor_blue_shirt.png", "character_editor_yellow_shirt.png"}
|
||||
|
||||
function character_editor.update_character(player)
|
||||
local name = player:get_player_name()
|
||||
player:set_properties({
|
||||
mesh = character_editor.mesh[name],
|
||||
textures = {table.concat(character_editor.characters[name], "^")},
|
||||
visual = "mesh",
|
||||
visual_size = {x=1, y=1},
|
||||
})
|
||||
print(table.concat(character_editor.characters[name], "^"))
|
||||
end
|
||||
|
||||
function character_editor.set_mesh(player, mesh)
|
||||
local name = player:get_player_name()
|
||||
character_editor.mesh[name] = mesh
|
||||
character_editor.update_character(player)
|
||||
end
|
||||
|
||||
function character_editor.set_texture(player, pos, texture)
|
||||
local name = player:get_player_name()
|
||||
if not character_editor.characters[name] then
|
||||
character_editor.characters[name] = {}
|
||||
end
|
||||
|
||||
character_editor.characters[name][pos] = texture
|
||||
print(character_editor.characters[name][pos])
|
||||
character_editor.update_character(player)
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("shirt", {
|
||||
params = "<name>",
|
||||
description = "[TEST CMD] Select your shirt",
|
||||
privs = {interact = true},
|
||||
func = function(plname , name)
|
||||
local player = minetest.get_player_by_name(plname)
|
||||
if character_editor.shirts[tonumber(name)] then
|
||||
character_editor.set_texture(player, 2, character_editor.shirts[tonumber(name)])
|
||||
return true, "You selected ".. name
|
||||
else
|
||||
return true, "There is no shirt named ".. name
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
character_editor.mesh[player:get_player_name()] = "character.x"
|
||||
character_editor.characters[player:get_player_name()] = {}
|
||||
character_editor.set_texture(player, 1, "character.png")
|
||||
end)
|
||||
|
||||
|
BIN
mods/character_editor/textures/character_editor_blue_shirt.png
Normal file
BIN
mods/character_editor/textures/character_editor_blue_shirt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 704 B |
BIN
mods/character_editor/textures/character_editor_red_shirt.png
Normal file
BIN
mods/character_editor/textures/character_editor_red_shirt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 709 B |
BIN
mods/character_editor/textures/character_editor_yellow_shirt.png
Normal file
BIN
mods/character_editor/textures/character_editor_yellow_shirt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 699 B |
@ -9,7 +9,7 @@ minetest.register_node("torch:torch", {
|
||||
light_source = 14,
|
||||
walkable = false,
|
||||
inventory_image = "torch_torch_inv.png",
|
||||
wield_image = "torch_torch_inv.png",
|
||||
--wield_image = "torch_torch_inv.png",
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
|
Loading…
x
Reference in New Issue
Block a user