tweak
This commit is contained in:
parent
c43a9834ea
commit
bba292b317
12
dirt.lua
12
dirt.lua
@ -1,6 +1,8 @@
|
||||
|
||||
local S = minetest.get_translator("ethereal")
|
||||
|
||||
local math_random = math.random
|
||||
|
||||
-- override default dirt (to stop caves cutting away dirt)
|
||||
|
||||
minetest.override_item("default:dirt", {is_ground_content = ethereal.cavedirt})
|
||||
@ -64,7 +66,7 @@ end
|
||||
|
||||
-- flower spread, also crystal and fire flower regeneration
|
||||
|
||||
local flower_spread = function(pos, node)
|
||||
local function flower_spread(pos, node)
|
||||
|
||||
if (minetest.get_node_light(pos) or 0) < 13 then return end
|
||||
|
||||
@ -83,7 +85,7 @@ local flower_spread = function(pos, node)
|
||||
if #grass > 4
|
||||
and not minetest.find_node_near(pos, 4, {"ethereal:crystal_spike"}) then
|
||||
|
||||
pos = grass[math.random(#grass)]
|
||||
pos = grass[math_random(#grass)]
|
||||
|
||||
pos.y = pos.y - 1
|
||||
|
||||
@ -105,7 +107,7 @@ local flower_spread = function(pos, node)
|
||||
if #grass > 8
|
||||
and not minetest.find_node_near(pos, 4, {"ethereal:fire_flower"}) then
|
||||
|
||||
pos = grass[math.random(#grass)]
|
||||
pos = grass[math_random(#grass)]
|
||||
|
||||
pos.y = pos.y - 1
|
||||
|
||||
@ -137,7 +139,7 @@ local flower_spread = function(pos, node)
|
||||
|
||||
if #seedling > 0 then
|
||||
|
||||
pos = seedling[math.random(#seedling)]
|
||||
pos = seedling[math_random(#seedling)]
|
||||
|
||||
pos.y = pos.y + 1
|
||||
|
||||
@ -149,7 +151,7 @@ end
|
||||
|
||||
-- grow papyrus up to 4 high and bamboo up to 8 high
|
||||
|
||||
local grow_papyrus = function(pos, node)
|
||||
local function grow_papyrus(pos, node)
|
||||
|
||||
local oripos = pos.y
|
||||
local high = 4
|
||||
|
11
sealife.lua
11
sealife.lua
@ -1,6 +1,9 @@
|
||||
|
||||
local S = minetest.get_translator("ethereal")
|
||||
|
||||
-- local math functions
|
||||
|
||||
local math_floor, math_max, math_random = math.floor, math.max, math.random
|
||||
-- Seaweed
|
||||
|
||||
minetest.register_node("ethereal:seaweed", {
|
||||
@ -94,7 +97,7 @@ minetest.register_node("ethereal:seaweed_rooted", {
|
||||
on_dig = function(pos, node, digger)
|
||||
|
||||
local p2 = node.param2 or 16
|
||||
local num = math.max(1, math.floor(p2 / 16))
|
||||
local num = math_max(1, math_floor(p2 / 16))
|
||||
local inv = digger and digger:get_inventory()
|
||||
|
||||
if not inv then return end
|
||||
@ -327,7 +330,7 @@ if ethereal.sealife == 1 then
|
||||
if node.name == "ethereal:seaweed_rooted" then
|
||||
|
||||
local p2 = node.param2 or 16
|
||||
local height = math.max(1, math.floor(p2 / 16))
|
||||
local height = math_max(1, math_floor(p2 / 16))
|
||||
|
||||
if height > 13 then return end
|
||||
|
||||
@ -345,7 +348,7 @@ if ethereal.sealife == 1 then
|
||||
return
|
||||
end
|
||||
|
||||
local sel = math.random(6)
|
||||
local sel = math_random(6)
|
||||
local pos_up = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local nod = minetest.get_node(pos_up).name
|
||||
|
||||
@ -353,7 +356,7 @@ if ethereal.sealife == 1 then
|
||||
|
||||
if sel == 1 then
|
||||
|
||||
local height = math.random(1, 6)
|
||||
local height = math_random(6)
|
||||
|
||||
minetest.set_node(pos, {name = "ethereal:seaweed_rooted",
|
||||
param2 = (height * 16)})
|
||||
|
@ -3,6 +3,8 @@ local S = minetest.get_translator("ethereal")
|
||||
|
||||
-- Thin Ice
|
||||
|
||||
local math_random = math.random
|
||||
|
||||
minetest.register_node("ethereal:thin_ice", {
|
||||
description = S("Thin Ice"),
|
||||
tiles = {"default_ice.png^[opacity:80"},
|
||||
@ -24,7 +26,7 @@ minetest.register_node("ethereal:thin_ice", {
|
||||
|
||||
on_walk_over = function(pos, node, player)
|
||||
|
||||
if math.random(50) == 13 then -- ice breaks if player unlucky
|
||||
if math_random(50) == 13 then -- ice breaks if player unlucky
|
||||
|
||||
minetest.sound_play("default_ice_dug",
|
||||
{pos = pos, gain = 0.5, pitch = 1.4, max_hear_distance = 5}, true)
|
||||
|
Loading…
x
Reference in New Issue
Block a user