Fix several placing bugs

master
BlockMen 2013-05-26 14:54:07 +02:00
parent 3e2d77b787
commit f9160b7523
4 changed files with 50 additions and 242 deletions

22
.gitattributes vendored
View File

@ -1,22 +0,0 @@
# 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

215
.gitignore vendored
View File

@ -1,215 +0,0 @@
#################
## 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

View File

@ -1,6 +1,6 @@
Minetest mod "Torches"
=======================
version: 1.0
version: 1.1
License of source code and textures: WTFPL
-----------------------------------------
@ -19,4 +19,11 @@ 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.
Notice: Already placed old torches wont be changed.
Changelog:
----------
- Torches on wall dont fall when node under it is dug
- Torches fall directly when not placed on floor or wall
- fixed different placing bugs

View File

@ -9,12 +9,39 @@ local function add_fire(pos)
1.5, true, "torches_fire"..tostring(math.random(1,2)) ..".png")
end
function check_attached_node_fdir(p, n)
local def = minetest.registered_nodes[n.name]
local d = {x=0, y=0, z=0}
if def.paramtype2 == "facedir" then
if n.param2 == 0 then
d.z = 1
elseif n.param2 == 1 then
d.x = 1
elseif n.param2 == 2 then
d.z = -1
elseif n.param2 == 3 then
d.x = -1
end
end
local p2 = {x=p.x+d.x, y=p.y+d.y, z=p.z+d.z}
local nn = minetest.env:get_node(p2).name
local def2 = minetest.registered_nodes[nn]
if def2 and not def2.walkable then
return false
end
return true
end
minetest.register_abm({
nodenames = {"torches:wand"},
interval = 1,
chance = 1,
action = function(pos)
add_fire(pos)
if not check_attached_node_fdir(pos, minetest.env:get_node(pos)) then
minetest.env:dig_node(pos)
minetest.env:add_item(pos, {name="default:torch"})
end
end
})
@ -24,6 +51,14 @@ minetest.register_abm({
chance = 1,
action = function(pos)
add_fire(pos)
pos.y = pos.y-1
local nn = minetest.env:get_node(pos).name
local def2 = minetest.registered_nodes[nn]
if def2 and not def2.walkable then
pos.y = pos.y+1
minetest.env:dig_node(pos)
minetest.env:add_item(pos, {name="default:torch"})
end
end
})
@ -51,11 +86,14 @@ minetest.register_craftitem(":default:torch", {
wield_scale = {x=1,y=1,z=1+1/16},
liquids_pointable = false,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" or string.find(minetest.env:get_node(pointed_thing.above).name, "torch") then
return itemstack
end
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"})
minetest.env:add_node(above, {name = "torches:floor"})
else
minetest.env:add_node(above, {name = "torches:wand", param2 = is_wall(wdir)})
end
@ -82,7 +120,7 @@ minetest.register_node("torches:floor", {
drop = "default:torch",
walkable = false,
light_source = 13,
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,not_in_creative_inventory=1},
groups = {choppy=2,dig_immediate=3,flammable=1,not_in_creative_inventory=1},
legacy_wallmounted = true,
node_box = {
type = "fixed",
@ -119,7 +157,7 @@ minetest.register_node("torches:wand", {
sunlight_propagates = true,
walkable = false,
light_source = 13,
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,not_in_creative_inventory=1},
groups = {choppy=2,dig_immediate=3,flammable=1,not_in_creative_inventory=1},
legacy_wallmounted = true,
drop = "default:torch",
node_box = {