From 3e2d77b7877ade8d70923e6439225eefffaece61 Mon Sep 17 00:00:00 2001 From: BlockMen Date: Sat, 25 May 2013 23:54:00 +0200 Subject: [PATCH] initial commit --- .gitattributes | 22 ++++ .gitignore | 215 +++++++++++++++++++++++++++++++++++++ README.txt | 22 ++++ depends.txt | 1 + init.lua | 135 +++++++++++++++++++++++ textures/torches_fire1.png | Bin 0 -> 429 bytes textures/torches_fire2.png | Bin 0 -> 582 bytes textures/torches_side.png | Bin 0 -> 217 bytes textures/torches_torch.png | Bin 0 -> 186 bytes 9 files changed, 395 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 README.txt create mode 100644 depends.txt create mode 100644 init.lua create mode 100644 textures/torches_fire1.png create mode 100644 textures/torches_fire2.png create mode 100644 textures/torches_side.png create mode 100644 textures/torches_torch.png diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9d6bd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,215 @@ +################# +## 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/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# 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/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# 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 +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..db19461 --- /dev/null +++ b/README.txt @@ -0,0 +1,22 @@ +Minetest mod "Torches" +======================= +version: 1.0 + +License of source code and textures: WTFPL +----------------------------------------- +(c) Copyright BlockMen (2013) + + +This program is free software. It comes without any warranty, to +the extent permitted by applicable law. You can redistribute it +and/or modify it under the terms of the Do What The Fuck You Want +To Public License, Version 2, as published by Sam Hocevar. See +http://sam.zoy.org/wtfpl/COPYING for more details. + + +Using the mod: +-------------- + +This mod adds 3D torches to Minetest. They also have real flames and look much more realistic. + +Notice: Already placed old torches wont be changed. \ No newline at end of file diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..8164c7b --- /dev/null +++ b/init.lua @@ -0,0 +1,135 @@ +local null = {x=0, y=0, z=0} +--fire_particles +local function add_fire(pos) + pos.y = pos.y+0.19 + minetest.add_particle(pos, null, null, 1.1, + 1.5, true, "torches_fire"..tostring(math.random(1,2)) ..".png") + pos.y = pos.y +0.01 + minetest.add_particle(pos, null, null, 0.8, + 1.5, true, "torches_fire"..tostring(math.random(1,2)) ..".png") +end + +minetest.register_abm({ + nodenames = {"torches:wand"}, + interval = 1, + chance = 1, + action = function(pos) + add_fire(pos) + end +}) + +minetest.register_abm({ + nodenames = {"torches:floor"}, + interval = 1, + chance = 1, + action = function(pos) + add_fire(pos) + end +}) + +--help function +local function is_wall(wallparam) + if wallparam == 0 then return false end + local para2 = 0 + if wallparam == 2 then + para2 = 1 + elseif wallparam == 3 then + para2 = 3 + elseif wallparam == 4 then + para2 = 0 + elseif wallparam == 5 then + para2 = 2 + end + return para2 +end + +--node_boxes +minetest.register_craftitem(":default:torch", { + description = "Torch", + inventory_image = "torches_torch.png", + wield_image = "torches_torch.png", + wield_scale = {x=1,y=1,z=1+1/16}, + liquids_pointable = false, + on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + local wdir = minetest.dir_to_wallmounted({x = under.x - above.x, y = under.y - above.y, z = under.z - above.z}) + if wdir == 1 then + minetest.env:add_node(above, {name = "torches:floor"}) + else + minetest.env:add_node(above, {name = "torches:wand", param2 = is_wall(wdir)}) + end + if not wdir == 0 or not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + + end + +}) + +minetest.register_node("torches:floor", { + --description = "Fakel", + inventory_image = "default_torch.png", + wield_image = "torches_torch.png", + wield_scale = {x=1,y=1,z=1+2/16}, + drawtype = "nodebox", + tiles = {"torches_torch.png^[transformfy", "default_wood.png", "torches_torch.png", + "torches_torch.png^[transformfx", "torches_torch.png", "torches_torch.png"}, + paramtype = "light", + paramtype2 = "none", + sunlight_propagates = true, + drop = "default:torch", + walkable = false, + light_source = 13, + groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,not_in_creative_inventory=1}, + legacy_wallmounted = true, + node_box = { + type = "fixed", + fixed = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16}, + }, + selection_box = { + type = "fixed", + fixed = {-1/16, -0.5, -1/16, 1/16, 2/16, 1/16}, + } +}) + +local wall_ndbx = { + {-1/16,-6/16, 6/16, 1/16, -5/16, 0.5}, + {-1/16,-5/16, 5/16, 1/16, -4/16, 7/16}, + {-1/16,-4/16, 4/16, 1/16, -3/16, 6/16}, + {-1/16,-3/16, 3/16, 1/16, -2/16, 5/16}, + {-1/16,-2/16, 2/16, 1/16, -1/16, 4/16}, + {-1/16,-1/16, 1/16, 1/16, 0, 3/16}, + {-1/16,0, 1/16, 1/16, 1/16, 2/16}, + {-1/16, 0, -1/16, 1/16, 2/16, 1/16}, +} + +minetest.register_node("torches:wand", { + --description = "Fakel", + inventory_image = "default_torch.png", + wield_image = "torches_torch.png", + wield_scale = {x=1,y=1,z=1+1/16}, + drawtype = "nodebox", + tiles = {"torches_torch.png^[transformfy", "default_wood.png", "torches_side.png", + "torches_side.png^[transformfx", "default_wood.png", "torches_torch.png"}, + + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + light_source = 13, + groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,not_in_creative_inventory=1}, + legacy_wallmounted = true, + drop = "default:torch", + node_box = { + type = "fixed", + fixed = wall_ndbx + }, + selection_box = { + type = "fixed", + fixed = wall_ndbx + }, + + +}) diff --git a/textures/torches_fire1.png b/textures/torches_fire1.png new file mode 100644 index 0000000000000000000000000000000000000000..45a5d282cb7543a57353472fd45451486c4161c0 GIT binary patch literal 429 zcmV;e0aE^nP)v05K}RUhEPy|+RQ^tTZtuJP=(rzLL3Pv>Q68O zaT;P4VlIhb72>je|5y^iKEwdxEX27af-1!FAU#MdxQ2KFu>$cH;wHrPegs8(W7$b^ z*+USTI^P~HLEMITpA#Q*X6**z(RT$cUQZ29f{qmNf^)I4B-R$pmj+RRZwq~h`IK1q z#7f#cqq!%(92%Z>%vvcbaBr-8;#)~9@AhnBl{x900n?ncKi{I=i& XlNm+s_Ce9M00000NkvXXu0mjf94oc( literal 0 HcmV?d00001 diff --git a/textures/torches_fire2.png b/textures/torches_fire2.png new file mode 100644 index 0000000000000000000000000000000000000000..d09eb190be022b69e84c6048946c0ceb376b6bcb GIT binary patch literal 582 zcmV-M0=fN(P)yWrkFE9jvs;9@{?-Y3R;lRQ>Cv@tET7b%9==of$1#V?b|b9E=d6^K`pt$Tv4lKAPU_~h^o zf)~y}xdO}j$ZrC>Yj7UoJ5%@p;sV6Ck+?nGq;W3!d;#L9bL2b}{yi9P*-_OmYA;xV zI03QJCpL0TUgpG-;nhKL87aQN^6jyofy>%)Z|yD#-a}k**q#x8)WXEaytRqoR!cZb zfn8aOp%8anFbnZ1#Pw_9X3^)_dGP_nAuA|C95#hR5O12|+Yl=!#Y!a3MB+*$evZVo z6XG<)OI8pXrn(VWs?HIXA>MG05E86Hd}NC6Kz!~9##%E731Wz^A(oN+XY3H-FI?Js UtC1I7S^xk507*qoM6N<$f)D=zAOHXW literal 0 HcmV?d00001 diff --git a/textures/torches_side.png b/textures/torches_side.png new file mode 100644 index 0000000000000000000000000000000000000000..d279c04b386b2e62c60bbe4dad9bf06af83e0b33 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F3${@^GvDCf{DA?`k z;uumfC;7+!|MtwPGnCFQW)nz0z}xo!|8L2E^%hglH*gDYNc{D`x4Y{9?pfN8Ojy=4 z8n^~~-~DGjQ!CN5MT6OH&Z+bn@$w(;AB!oXF{!fwq@G!*A zxoX10`e^2xQ10O#uJiw|RbBdj(v0DmP_b^|DIvkoASH&_JqMQUKWe)K=qv_LS3j3^ HP6