initial commit

master
BlockMen 2013-03-20 19:41:45 +01:00
commit 9e632a1044
5 changed files with 325 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

24
README.txt Normal file
View File

@ -0,0 +1,24 @@
Minetest mod "Landscape"
=======================
version: 0.1
License of source code and textures:
------------------------------------
Written 2013 by BlockMen
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 lets changes Dirtblocks with grass to dirtblocks with full grass, and lets the landscape look smoother.
when not liked anymore the first line in init.lua should be changed to "local remove_full_grass = true", then
all "Full Grass Blocks" will be removed.

1
depends.txt Normal file
View File

@ -0,0 +1 @@
default

115
init.lua Normal file
View File

@ -0,0 +1,115 @@
local remove_full_grass = false --set "true" to remove all full_grass_blocks
minetest.register_node("landscape:full_grass_block", {
description = "Dirt with Grass",
tiles = {"default_grass.png"},
is_ground_content = true,
groups = {crumbly=3},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
})
local function get_type(pos) --1 for left, 2 for right, 3 for behind, 4 for front
if minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z}).name == "air" then
return 1
elseif minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z}).name == "air" then
return 2
elseif minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}).name == "air" then
return 3
elseif minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}).name == "air" then
return 4
else
return 0
end
end
local function is_edge(pos)
local l1 = {x=pos.x-1, y=pos.y, z=pos.z}
local l2 = {x=pos.x, y=pos.y, z=pos.z-1}
local r1 = {x=pos.x+1, y=pos.y, z=pos.z}
local r2 = {x=pos.x, y=pos.y, z=pos.z+1}
if minetest.env:get_node(l1).name == "air" or minetest.env:get_node(l2).name == "air" or minetest.env:get_node(r1).name == "air" or minetest.env:get_node(r2).name == "air" then
return true
end
end
local function check(pos)
if string.find(minetest.env:get_node(pos).name, "_grass") then
return true
else
return false
end
end
if remove_full_grass == false then
minetest.register_abm({
nodenames = {"default:dirt_with_grass"},
--neighbors = {"default:dirt_with_grass", "landscape:full_grass_block"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local under = {x=pos.x, y=pos.y-1, z=pos.z}
local above = {x=pos.x, y=pos.y+1, z=pos.z}
local under_front = {x=pos.x+1, y=pos.y-1, z=pos.z}
local under_front2 = {x=pos.x, y=pos.y-1, z=pos.z+1}
local under_back = {x=pos.x-1, y=pos.y-1, z=pos.z}
local under_back2 = {x=pos.x, y=pos.y-1, z=pos.z-1}
if minetest.env:get_node(above).name == "air" then
if get_type(pos) ~= 0 then
local typ = get_type(pos)
local ok = false
if typ == 1 then
ok = check(under_front)
elseif typ == 2 then
ok = check(under_back)
elseif typ == 3 then
ok = check(under_front2)
elseif typ == 4 then
ok = check(under_back2)
end
if ok then
if minetest.env:get_node(under).name == "default:dirt" then
if not is_edge(under) then
--IF GRAS UNTEN-DAVOR tthen....
local tmp_node3 = {name="landscape:full_grass_block"}
minetest.env:set_node(pos, tmp_node3)
end
else
local tmp_node3 = {name="landscape:full_grass_block"}
minetest.env:set_node(pos, tmp_node3)
end
end
end
end
end
})
--remove full grass when block is placed above
minetest.register_abm({
nodenames = {"landscape:full_grass_block"},
interval = 2.0,
chance = 20,
action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
local tmp_node3 = {name="default:dirt"}
minetest.env:set_node(pos, tmp_node3)
end
end
})
else
minetest.register_abm({
nodenames = {"landscape:full_grass_block"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local tmp_node3 = {name="default:dirt_with_grass"}
minetest.env:set_node(pos, tmp_node3)
end
})
end