From 6b05344b54c7e377dbe13a853548a38d5fa13ba0 Mon Sep 17 00:00:00 2001 From: Izzy Date: Wed, 13 Jul 2016 21:14:36 -0700 Subject: [PATCH] first commit. snow expands. --- .gitignore | 41 +++++++++++++++++++++++++++++++++++++++++ LICENSE.md | 13 +++++++++++++ README.md | 11 +++++++++++ depends.txt | 1 + init.lua | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 depends.txt create mode 100644 init.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6fd0a37 --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +# Compiled Lua sources +luac.out + +# luarocks build files +*.src.rock +*.zip +*.tar.gz + +# Object files +*.o +*.os +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo +*.def +*.exp + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..9eac51b --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,13 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2016 Izzy + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..68786c1 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +Winter Is Coming +========= + +Snow biomes expand and envelope the entire map. Existing resources are transformed. + + + +Copyright 2016 Izzy + +WTFPL. Do what the fuck you want. + diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..291b0cf --- /dev/null +++ b/init.lua @@ -0,0 +1,49 @@ + + +local modpath = minetest.get_modpath("winter_is_coming") + +local modname = "winter_is_coming" + + + +minetest.register_abm({ + nodenames = { "default:snow" }, + interval = 1, + chance = 5, + action = function(pos, node, active_object_count, active_object_count_wider) + local n = minetest.find_node_near(pos, 2, {"default:dirt_with_grass"}) + if n == nil then + return + end + + minetest.set_node(n, {name="default:dirt_with_snow"}) + + n.y = n.y + 1 + local q = minetest.get_node(n) + + if q == nil then + return + end + + if minetest.get_item_group(q.name, "flora") > 0 then + minetest.set_node(n, {name="default:dry_shrub"}) + end + + end, +}) + +minetest.register_abm({ + nodenames = { "default:dirt_with_snow" }, + interval = 1, + chance = 10, + action = function(pos, node, active_object_count, active_object_count_wider) + local n = minetest.find_node_near(pos, 1, {"default:dirt_with_snow"}) + if n ~= nil then + n.y = n.y + 1 + local q = minetest.get_node(n) + if q ~= nil and (q.name == "air" or q.name == "default:grass") then + minetest.set_node(n, {name="default:snow"}) + end + end + end, +})