added names to setmonth command

adjusted puddle spawn
master
DonBatman 2015-11-10 18:57:35 -08:00
parent d8294c9e13
commit dae08c5b30
5 changed files with 35 additions and 19 deletions

11
README Normal file
View File

@ -0,0 +1,11 @@
Mymonths is licenced as WTFPL
The rain and snow code comes from the weather mod
from topic - https://forum.minetest.net/viewtopic.php?t=5245
by Jeija
- Code: LGPL
- Textures:
- Snow cover: WTFPL
- Rain / Snow: CC-BY-SA 3.0, credit goes to TeddyDesTodes, from his weather branch at https://github.com/TeddyDesTodes/minetest/tree/weather

View File

@ -72,9 +72,12 @@ minetest.register_abm({
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.weather == "rain" then
local na = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if minetest.get_node_light({x=pos.x,y=pos.y+1,z=pos.z}, 0.5) == 15
and na.name == "air" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="mymonths:puddle"})
local nn = minetest.find_node_near(pos, 20, "mymonths:puddle")
if nn == nil then
if minetest.get_node_light({x=pos.x,y=pos.y+1,z=pos.z}, 0.5) == 15
and na.name == "air" then
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="mymonths:puddle"})
end
end
end
end

View File

@ -19,32 +19,32 @@ minetest.register_chatcommand("setweather", {
--Set month
minetest.register_chatcommand("setmonth", {
params = "",
description = "Set the month. Use the number 1-12",
description = "Set the month. Use the number 1-12 or the name",
privs = {mymonths = true},
func = function(name, param)
if param == "1" then
if param == "1" or "January" or "january" or "jan" then
mymonths.month = "January"
elseif param == "2" then
elseif param == "2" or "Febuary" or "febuary" or "feb" then
mymonths.month = "Febuary"
elseif param == "3" then
elseif param == "3" or "March" or "march" or "mar" then
mymonths.month = "March"
elseif param == "4" then
elseif param == "4" or "April" or "april" or "apr" then
mymonths.month = "April"
elseif param == "5" then
elseif param == "5" or "May" or "may" then
mymonths.month = "May"
elseif param == "6" then
elseif param == "6" or "June" or "june" or "jun" then
mymonths.month = "June"
elseif param == "7" then
elseif param == "7" or "July" or "july" or "jul" then
mymonths.month = "July"
elseif param == "8" then
elseif param == "8" or "Augest" or "augest" or "aug" then
mymonths.month = "Augest"
elseif param == "9" then
elseif param == "9" or "September" or "september" or "sept" then
mymonths.month = "September"
elseif param == "10" then
elseif param == "10" or "October" or "october" or "oct" then
mymonths.month = "October"
elseif param == "11" then
elseif param == "11" or "November" or "november" or "nov" then
mymonths.month = "November"
elseif param == "12" then
elseif param == "12" or "December" or "december" or "dec"then
mymonths.month = "December"
end
mymonths.month_counter = param
@ -73,8 +73,10 @@ minetest.register_chatcommand("date", {
ampm = "pm"
th = th - 12
if th == 0 then th = 12 end
elseif tonumber(th..tm) >=2401 or tonumber(th) <= 1200 then
else
ampm = "am"
print(th)
if th == 0 or th == "" then th = 12 end
end
--
minetest.chat_send_player(name,"The time is "..th..":"..mi.." "..ampm.." on "..mymonths.month.." "..mymonths.day_counter)

View File

@ -20,7 +20,7 @@ minetest.register_globalstep(function(dtime)
end
end)
mymonths = {}
local days_per_month = 2
local days_per_month = 15
local morn = 6000
local night = 22000
local tseconds = 3

View File

@ -120,7 +120,7 @@ minetest.register_abm({ --apples grow in spring
action = function (pos, node, active_object_count, active_object_count_wider)
if mymonths.month == 'July' or 'August' or 'September' then
local posbelow = {x=pos.x, y=pos.y-1, z=pos.z}
local below = minetest.get_node_or_nil(posbelow)
local below = minetest.get_node(posbelow)
if below.name == 'air' then
local a = minetest.find_node_near(pos, 3, 'default:apple')
if a == nil then