Add more things
This commit is contained in:
parent
be2262fa17
commit
d6662e8094
26 changed files with 565 additions and 26 deletions
98
mods/rgt_cosmetics/init.lua
Normal file
98
mods/rgt_cosmetics/init.lua
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
rgt_cosmetics = {
|
||||
characters = {}
|
||||
}
|
||||
local ns = rgt_cosmetics
|
||||
|
||||
--[[
|
||||
{
|
||||
name = "", -- Technical name
|
||||
label = "", -- Displayed name
|
||||
texture = "",
|
||||
scale = 0.88, -- Amount by which to scale visual_size for this character
|
||||
eye_height = 1.6, -- For use with `scale`
|
||||
}
|
||||
]]
|
||||
function ns.register_character(def)
|
||||
ns.characters[def.name] = def
|
||||
end
|
||||
|
||||
function ns.set_character(m, chr)
|
||||
if type(chr) == "string" then
|
||||
chr = ns.characters[chr]
|
||||
end
|
||||
m.object:set_properties {
|
||||
visual = "mesh",
|
||||
mesh = "rgt_character.gltf",
|
||||
textures = {chr.texture},
|
||||
visual_size = vector.new(1,1,1) *chr.scale,
|
||||
eye_height = chr.eye_height,
|
||||
shaded = false,
|
||||
}
|
||||
m.object:get_inventory():set_stack("hand", 1, ItemStack("red_glazed_terracotta:_hand_"..chr.name))
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(p)
|
||||
local m = rgt.players[p:get_player_name()]
|
||||
ns.set_character(m, m.object:get_meta():get("character") or "key")
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("character", {
|
||||
func = function(name, args)
|
||||
ns.set_character(rgt.players[name], args)
|
||||
end
|
||||
})
|
||||
|
||||
local _hand = minetest.registered_items[""]
|
||||
function rgt.register_hand(name, caps, realname)
|
||||
rgt.register_node("_hand_"..name, {
|
||||
description = "",
|
||||
paramtype = "light",
|
||||
drawtype = "mesh",
|
||||
mesh = "rgt_hand.gltf",
|
||||
tiles = {"rgt_base_"..(realname or name or "placeholder")..".png"},
|
||||
use_texture_alpha = "opaque",
|
||||
visual_scale = 1,
|
||||
wield_scale = vector.new(2,2,2),
|
||||
node_placement_prediction = "",
|
||||
on_construct = function(pos)
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
drop = "",
|
||||
on_drop = function()
|
||||
return ""
|
||||
end,
|
||||
range = _hand.range,
|
||||
pointabilities = caps and caps.pointabilities or {},
|
||||
tool_capabilities = caps or {
|
||||
full_punch_interval = 0,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
-- dig_immediate = {times = {0}, uses = 0, maxlevel = 5},
|
||||
hand_breakable = {times = {0.3, 0.5, 0.7}, uses = 0, maxlevel = 5}
|
||||
},
|
||||
damage_groups = {fleshy=1},
|
||||
},
|
||||
groups = {not_in_creative_inventory = 1, dig_immediate = 1}
|
||||
})
|
||||
end
|
||||
|
||||
rgt.register_hand("key")
|
||||
rgt.register_hand("vix")
|
||||
|
||||
-- Builtin characters
|
||||
|
||||
ns.register_character {
|
||||
name = "key",
|
||||
label = "Key",
|
||||
texture = "rgt_base_key.png",
|
||||
scale = 0.88,
|
||||
eye_height = 1.6
|
||||
}
|
||||
|
||||
ns.register_character {
|
||||
name = "vix",
|
||||
label = "Vix",
|
||||
texture = "rgt_base_vix.png",
|
||||
scale = 0.8,
|
||||
eye_height = 1.5
|
||||
}
|
||||
2
mods/rgt_cosmetics/mod.conf
Normal file
2
mods/rgt_cosmetics/mod.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
name = rgt_cosmetics
|
||||
depends = rgt_player
|
||||
BIN
mods/rgt_cosmetics/textures/rgt_base_key.png
Normal file
BIN
mods/rgt_cosmetics/textures/rgt_base_key.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
mods/rgt_cosmetics/textures/rgt_base_vix.png
Normal file
BIN
mods/rgt_cosmetics/textures/rgt_base_vix.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Loading…
Add table
Add a link
Reference in a new issue