mirror of
https://github.com/stujones11/wield3d.git
synced 2024-12-27 00:07:28 +01:00
Initial Commit
This commit is contained in:
parent
245414e852
commit
462d21cc7a
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
## Generic ignorable patterns and files
|
||||
*~
|
||||
.*.swp
|
||||
*bak*
|
||||
tags
|
||||
*.vim
|
||||
|
4
LICENSE.md
Normal file
4
LICENSE.md
Normal file
@ -0,0 +1,4 @@
|
||||
[mod] 3d wielded items [wield3d]
|
||||
================================
|
||||
|
||||
Copyright (C) 2013 Stuart Jones - WTFPL
|
13
README.md
13
README.md
@ -1,4 +1,11 @@
|
||||
wield3d
|
||||
=======
|
||||
[mod] 3d wielded items [wield3d]
|
||||
================================
|
||||
|
||||
decription: Visible 3d wielded items for Minetest
|
||||
|
||||
depends: default
|
||||
|
||||
Makes hand wielded items visible to other players.
|
||||
|
||||
Please note this mod is currently not compatible with minetest-3d_armor or any other mod that changes the default character model.
|
||||
|
||||
Visible 3d wielded items for Minetest
|
||||
|
2
depends.txt
Normal file
2
depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
default
|
||||
|
72
init.lua
Normal file
72
init.lua
Normal file
@ -0,0 +1,72 @@
|
||||
local update_time = 2 -- number of seconds between wielditem updates
|
||||
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/rotation.lua")
|
||||
|
||||
minetest.register_item("wield3d:hand", {
|
||||
type = "none",
|
||||
wield_image = "wield3d_trans.png",
|
||||
})
|
||||
|
||||
minetest.register_entity("wield3d:wield_entity", {
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collisionbox = {x=0, y=0, z=0},
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.25, y=0.25},
|
||||
},
|
||||
wield_item = "",
|
||||
player = nil,
|
||||
timer = 0,
|
||||
rotation = 0,
|
||||
on_step = function(self, dtime)
|
||||
local player = self.player
|
||||
if player == nil then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
self.timer = self.timer + dtime
|
||||
if self.timer < update_time then
|
||||
return
|
||||
end
|
||||
self.timer = 0
|
||||
if minetest.env:get_player_by_name(player:get_player_name()) == nil then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
local stack = player:get_wielded_item()
|
||||
local item = stack:get_name()
|
||||
if item == self.wield_item then
|
||||
return
|
||||
end
|
||||
self.wield_item = item
|
||||
if item == "" then
|
||||
item = "wield3d:hand"
|
||||
end
|
||||
local rotation = wield3d_rotation[item] or 0
|
||||
if rotation ~= self.rotation then
|
||||
self.object:setpos(player:getpos())
|
||||
self.object:set_detach()
|
||||
self.object:set_attach(player, "Armature_Wield_Item", {x=0, y=0, z=0}, {x=0, y=0, z=rotation})
|
||||
self.rotation = rotation
|
||||
end
|
||||
self.object:set_properties({textures={item}})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
minetest.after(0.5, function(player)
|
||||
player:set_properties({
|
||||
visual = "mesh",
|
||||
mesh = "wield3d_character.x",
|
||||
visual_size = {x=1, y=1},
|
||||
})
|
||||
local pos = player:getpos()
|
||||
local entity = minetest.env:add_entity(pos, "wield3d:wield_entity")
|
||||
if entity ~= nil then
|
||||
entity:set_attach(player, "Armature_Wield_Item", {x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||
entity = entity:get_luaentity()
|
||||
entity.player = player
|
||||
end
|
||||
end, player)
|
||||
end)
|
||||
|
7242
models/wield3d_character.x
Normal file
7242
models/wield3d_character.x
Normal file
File diff suppressed because it is too large
Load Diff
26
rotation.lua
Normal file
26
rotation.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-- Wielded Item Rotation Overrides - [item_name]=degrees,
|
||||
|
||||
wield3d_rotation = {
|
||||
["default:torch"]=315,
|
||||
["default:sapling"]=315,
|
||||
["flowers:dandelion_white"]=315,
|
||||
["flowers:dandelion_yellow"]=315,
|
||||
["flowers:geranium"]=315,
|
||||
["flowers:rose"]=315,
|
||||
["flowers:tulip"]=315,
|
||||
["flowers:viola"]=315,
|
||||
["default:shovel_wood"]=270,
|
||||
["default:shovel_stone"]=270,
|
||||
["default:shovel_steel"]=270,
|
||||
["default:shovel_bronze"]=270,
|
||||
["default:shovel_mese"]=270,
|
||||
["default:shovel_diamond"]=270,
|
||||
["bucket:bucket_empty"]=270,
|
||||
["bucket:bucket_water"]=270,
|
||||
["bucket:bucket_lava"]=270,
|
||||
["screwdriver:screwdriver"]=270,
|
||||
["screwdriver:screwdriver1"]=270,
|
||||
["screwdriver:screwdriver2"]=270,
|
||||
["screwdriver:screwdriver3"]=270,
|
||||
["screwdriver:screwdriver4"]=270,
|
||||
}
|
BIN
textures/wield3d_trans.png
Normal file
BIN
textures/wield3d_trans.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 B |
Loading…
Reference in New Issue
Block a user