Initial commit

master
m97 2013-06-06 20:58:53 +02:00
commit a63f96cad8
6 changed files with 355 additions and 0 deletions

22
.gitattributes vendored Normal file
View File

@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

163
.gitignore vendored Normal file
View File

@ -0,0 +1,163 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
# Visual Studio profiler
*.psess
*.vsp
# ReSharper is a .NET coding add-in
_ReSharper*
# Installshield output folder
[Ee]xpress
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish
# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
############
## Windows
############
# Windows image file caches
Thumbs.db
# Folder config file
Desktop.ini
#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
# Mac crap
.DS_Store

2
depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
technic

168
init.lua Normal file
View File

@ -0,0 +1,168 @@
minetest.register_alias("barrels_checker", "barrels:barrels_checker")
minetest.register_craftitem("barrels:barrels_checker", {
description = "Barrels Checker",
inventory_image = "barrels_barrel_checker.png",
stack_max = 1,
})
minetest.register_craft({
output = 'barrels:barrels_checker',
recipe = {
{'barrels:barrel', 'technic:control_logic_unit', ''},
{'', '', ''},
{'', '', ''},
},
additional_wear = -1
})
minetest.register_entity("barrels:item_put",{
hp_max = 1,
visual="wielditem",
visual_size={x=.30,y=.30},
collisionbox = {0,0,0,0,0,0},
physical=false,
textures={"air"}
})
local facedir = {}
facedir[0] = {x=0,y=0,z=1.2} --
facedir[1] = {x=1.2,y=0,z=0} --
facedir[2] = {x=0,y=0,z=-1.2} --
facedir[3] = {x=-1.2,y=0,z=0} --
local remove_item = function(pos)
objs = minetest.env:get_objects_inside_radius(pos, .6)
if objs then
for _, obj in ipairs(objs) do
if obj and obj:get_luaentity() and obj:get_luaentity().name == "barrels:item_put" then
obj:remove()
end
end
end
end
local update_item = function(pos, node)
remove_item(pos)
local meta = minetest.env:get_meta(pos)
if meta:get_string("item") ~= "" then
posad = facedir[node.param2]
pos.x = pos.x + posad.x*7/16
pos.y = pos.y + posad.y*7/16
pos.z = pos.z + posad.z*7/16
local e = minetest.env:add_entity(pos,"barrels:item_put")
local name = ItemStack(meta:get_string("item")):get_name()
e:set_properties({textures={name}})
local yaw = math.pi*2 - node.param2 * math.pi/2
e:setyaw(yaw)
end
end
minetest.register_alias("barrel","barrels:barrel")
minetest.register_craft({
output = 'barrels:barrel,2',
recipe = {
{'default:tree','default:tree', 'default:tree'},
{'default:tree', '', 'default:tree'},
{'default:tree', 'default:tree', 'default:tree'},
}
})
minetest.register_node("barrels:barrel", {
description = "Barrel",
tiles = {"barrels_barrel_side.png"},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
local item = ""
local item_amount = 0
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
if not(meta:get_string("item") == "")then
return false
end
return true
end,
on_rightclick = function(pos, node, player, itemstack)
local keys = {}
local itemp = itemstack
local meta = minetest.env:get_meta(pos);
if itemstack:get_stack_max() > 1 then
if meta:get_string("item") == itemstack:get_name() then
meta:set_int("item_amount",meta:get_int("item_amount")+itemstack:get_count())
minetest.debug(meta:get_int("item_amount"))
itemstack:clear()
end
if meta:get_string("item") == "" then
meta:set_string("item",itemp:get_name() )
meta:set_int("item_amount",meta:get_int("item_amount")+itemstack:get_count())
minetest.debug(meta:get_int("item_amount"))
itemstack:clear()
update_item(pos,node)
end
end
if itemstack:get_name() == "barrels:barrels_checker" then
local items_amount = meta:get_int("item_amount")
minetest.chat_send_player(player:get_player_name(),items_amount.." "..meta:get_string("item"),true)
end
end,
})
minetest.register_on_punchnode(function(pos, node, puncher)
if node.name == "barrels:barrel" then
local keys = {}
keys = puncher:get_player_control()
local meta = minetest.env:get_meta(pos);
local stack1 = meta:get_string("item")
local stack2 = stack1.." 99"
local items = meta:get_int("item_amount")
if keys["sneak"] == true then
if meta:get_int("item_amount") >= 99 then
minetest.env:add_item(puncher:getpos(),stack2)
meta:set_int("item_amount",meta:get_int("item_amount")-99)
if meta:get_int("item_amount") > 1 then
meta:set_string("item","")
update_item(pos,node)
end
return
end
if meta:get_int("item_amount") < 99 then
if meta:get_int("item_amount") > 0 then
local stack2 = stack1.." "..items
minetest.env:add_item(puncher:getpos(),stack2)
meta:set_int("item_amount",meta:get_int("item_amount")-meta:get_int("item_amount"))
if meta:get_int("item_amount") < 1 then
meta:set_string("item","")
update_item(pos,node)
end
end
return
end
end
if keys["sneak"] == false then
minetest.env:add_item(puncher:getpos(),stack1)
meta:set_int("item_amount",meta:get_int("item_amount")-1)
if meta:get_int("item_amount") < 1 then
meta:set_string("item","")
update_item(pos,node)
end
return
end
end
end)
minetest.register_abm({
nodenames = {"barrels:barrel"},
interval = 1.0,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
update_item(pos,node)
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B