0.4.16 Update

master
maikerumine 2017-11-11 12:40:24 -05:00
parent 0031f387a2
commit ea3c53cc47
20 changed files with 944 additions and 37 deletions

View File

@ -22,11 +22,16 @@ minetest.register_alias("vendor:depositor", "smartshop:shop")
minetest.register_alias("vendorgoldblock:vendor", "smartshop:shop")
minetest.register_alias("vendorgoldblock:depositor", "smartshop:shop")
--[[
minetest.register_alias("esmobs:cobweb", "mobs:cobweb")
]]
minetest.register_alias("es:furnace", "es:infiniumblock")
minetest.register_alias("es:furnace_active", "es:infiniumblock")
minetest.register_alias("es:cfurnace", "es:infiniumblock")
minetest.register_alias("es:cfurnace_active", "es:infiniumblock")
minetest.register_alias("esmobs:cobweb", "mobs:cobweb")
minetest.register_alias("mg_villages:torch", "default:torch")
--esmobs pathfinding
minetest.register_alias("esmobs:stone", "default:leaves")
minetest.register_alias("esmobs:dirt", "default:leaves")
@ -70,12 +75,31 @@ minetest.register_alias("es:shield_nomad", "shields:shield_nomad")
minetest.register_alias("es:shield_rusher", "shields:shield_rusher")
minetest.register_alias("es:shield_veteran", "shields:shield_veteran")
--minetest.register_alias("doors:door_wood_t_1", "default:wood")
--minetest.register_alias("doors:door_wood_b_1", "default:wood")
--minetest.register_alias("doors:door_wood_t_2", "default:wood")
--[[
minetest.register_alias("doors:door_wood_t_1", "default:wood")
minetest.register_alias("doors:door_wood_b_1", "default:wood")
minetest.register_alias("doors:door_wood_b_2", "default:wood")
minetest.register_alias("doors:door_wood_t_2", "default:wood")
]]
minetest.register_alias("beds:bed_bottom_white", "default:wood")
minetest.register_alias("beds:bed_top_white", "default:wood")
minetest.register_alias("doors:door_wood_t_1", "doors:hidden")
minetest.register_alias("doors:door_wood_b_1", "doors:door_wood_a")
minetest.register_alias("doors:door_wood_b_2", "doors:door_wood_b")
minetest.register_alias("doors:door_wood_t_2", "doors:hidden")
minetest.register_alias("doors:door_steel_t_1", "doors:hidden")
minetest.register_alias("doors:door_steel_b_1", "doors:door_steel_a")
minetest.register_alias("doors:door_steel_b_2", "doors:door_steel_b")
minetest.register_alias("doors:door_steel_t_2", "doors:hidden")
minetest.register_alias("beds:bed_bottom_white", "beds:bed_bottom")
minetest.register_alias("beds:bed_top_white", "beds:bed_top")
minetest.register_alias("fishing:pole", "fishing:pole_wood")

532
builtin_flowlib.lua Normal file
View File

@ -0,0 +1,532 @@
local function drop_attached_node(p)
local nn = minetest.get_node(p).name
minetest.remove_node(p)
for _, item in pairs(minetest.get_node_drops(nn, "")) do
local pos = {
x = p.x + math.random()/2 - 0.25,
y = p.y + math.random()/2 - 0.25,
z = p.z + math.random()/2 - 0.25,
}
minetest.add_item(pos, item)
end
end
-- Helper function for node actions for liquid flow
local liquid_flow_action = function(pos, group, action)
local check_detach = function(pos, xp, yp, zp)
local p = {x=pos.x+xp, y=pos.y+yp, z=pos.z+zp}
local n = minetest.get_node_or_nil(p)
if not n then
return false
end
local d = minetest.registered_nodes[n.name]
if not d then
return false
end
--[[ Check if we want to perform the liquid action.
* 1: Item must be in liquid group
* 2a: If target node is below liquid, always succeed
* 2b: If target node is horizontal to liquid: succeed if source, otherwise check param2 for horizontal flow direction ]]
local range = d.liquid_range or 8
if (minetest.get_item_group(n.name, group) ~= 0) and
((yp > 0) or
(yp == 0 and ((d.liquidtype == "source") or (n.param2 > (8-range) and n.param2 < 9)))) then
action(pos)
end
end
local posses = {
{ x=-1, y=0, z=0 },
{ x=1, y=0, z=0 },
{ x=0, y=0, z=-1 },
{ x=0, y=0, z=1 },
{ x=0, y=1, z=0 },
}
for p=1,#posses do
check_detach(pos, posses[p].x, posses[p].y, posses[p].z)
end
end
-- Drop some nodes next to flowing water, if it would flow into the node
minetest.register_abm({
label = "Wash away dig_by_water nodes by water flow",
nodenames = {"group:dig_by_water"},
neighbors = {"group:water"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
liquid_flow_action(pos, "water", function(pos)
drop_attached_node(pos)
minetest.dig_node(pos)
end)
end,
})
-- Destroy some nodes next to flowing lava, if it would flow into the node
minetest.register_abm({
label = "Destroy destroy_by_lava_flow nodes by lava flow",
nodenames = {"group:destroy_by_lava_flow"},
neighbors = {"group:lava"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
liquid_flow_action(pos, "lava", function(pos)
minetest.remove_node(pos)
--minetest.sound_play("builtin_item_lava", {pos = pos, gain = 0.25, max_hear_distance = 16})
core.check_for_falling(pos)
end)
end,
})
-- Minetest: builtin/item_entity.lua (27th January 2016)
-- water flow functions by QwertyMine3, edited by TenPlus1
local function to_unit_vector(dir_vector)
local inv_roots = {
[0] = 1,
[1] = 1,
[2] = 0.70710678118655,
[4] = 0.5,
[5] = 0.44721359549996,
[8] = 0.35355339059327
}
local sum = dir_vector.x * dir_vector.x + dir_vector.z * dir_vector.z
return {
x = dir_vector.x * inv_roots[sum],
y = dir_vector.y,
z = dir_vector.z * inv_roots[sum]
}
end
local function is_touching(realpos, nodepos, radius)
return (math.abs(realpos - nodepos) > (0.5 - radius))
end
local function node_ok(pos)
local node = minetest.get_node_or_nil(pos)
if not node then
return minetest.registered_nodes["default:dirt"]
end
if minetest.registered_nodes[node.name] then
return node
end
return minetest.registered_nodes["default:dirt"]
end
local function is_water(pos)
return (minetest.registered_nodes[
node_ok({x = pos.x, y = pos.y, z = pos.z}).name].groups.water)
end
local function is_liquid(pos)
return (minetest.registered_nodes[
node_ok({x = pos.x, y = pos.y, z = pos.z}).name].groups.liquid)
end
local function node_is_liquid(node)
return (minetest.registered_nodes[node.name].groups.liquid)
end
local function quick_flow_logic(node, pos_testing, direction)
if minetest.registered_nodes[node.name].liquidtype == "source" then
local node_testing = node_ok(pos_testing)
local param2_testing = node_testing.param2
if minetest.registered_nodes[node_testing.name].liquidtype ~= "flowing" then
return 0
else
return direction
end
elseif minetest.registered_nodes[node.name].liquidtype == "flowing" then
local node_testing = node_ok(pos_testing)
local param2_testing = node_testing.param2
if minetest.registered_nodes[node_testing.name].liquidtype == "source" then
return -direction
elseif minetest.registered_nodes[node_testing.name].liquidtype == "flowing" then
if param2_testing < node.param2 then
if (node.param2 - param2_testing) > 6 then
return -direction
else
return direction
end
elseif param2_testing > node.param2 then
if (param2_testing - node.param2) > 6 then
return direction
else
return -direction
end
end
end
end
return 0
end
local function quick_flow(pos, node)
local x, z = 0, 0
if not node_is_liquid(node) then
return {x = 0, y = 0, z = 0}
end
x = x + quick_flow_logic(node, {x = pos.x - 1, y = pos.y, z = pos.z},-1)
x = x + quick_flow_logic(node, {x = pos.x + 1, y = pos.y, z = pos.z}, 1)
z = z + quick_flow_logic(node, {x = pos.x, y = pos.y, z = pos.z - 1},-1)
z = z + quick_flow_logic(node, {x = pos.x, y = pos.y, z = pos.z + 1}, 1)
return to_unit_vector({x = x, y = 0, z = z})
end
--if not in water but touching, move centre to touching block
--x has higher precedence than z -- if pos changes with x, it affects z
local function move_centre(pos, realpos, node, radius)
if is_touching(realpos.x, pos.x, radius) then
if is_liquid({x = pos.x - 1, y = pos.y, z = pos.z}) then
pos = {x = pos.x - 1, y = pos.y, z = pos.z}
node = node_ok(pos)
elseif is_liquid({x = pos.x + 1, y = pos.y, z = pos.z}) then
pos = {x = pos.x + 1, y = pos.y, z = pos.z}
node = node_ok(pos)
end
end
if is_touching(realpos.z, pos.z, radius) then
if is_liquid({x = pos.x, y = pos.y, z = pos.z - 1}) then
pos = {x = pos.x, y = pos.y, z = pos.z - 1}
node = node_ok(pos)
elseif is_liquid({x = pos.x, y = pos.y, z = pos.z + 1}) then
pos = {x = pos.x, y = pos.y, z = pos.z + 1}
node = node_ok(pos)
end
end
return pos, node
end
-- END water flow functions
function core.spawn_item(pos, item)
local obj = core.add_entity(pos, "__builtin:item")
-- Don't use obj if it couldn't be added to the map.
if obj then
obj:get_luaentity():set_item(ItemStack(item):to_string())
end
return obj
end
-- if item_entity_ttl is not set, enity will have default life time
-- setting to -1 disables the feature
local time_to_live = tonumber(core.setting_get("item_entity_ttl")) or 900
-- if destroy_item is 1 then dropped items will burn inside lava
local destroy_item = tonumber(core.setting_get("destroy_item")) or 1
-- entity gravity
local gravity = tonumber(minetest.setting_get("movement_gravity")) or 9.81
-- particle effects for when item is destroyed
local function add_effects(pos)
minetest.add_particlespawner({
amount = 1,
time = 0.25,
minpos = pos,
maxpos = pos,
minvel = {x = -1, y = 2, z = -1},
maxvel = {x = 1, y = 5, z = 1},
minacc = {x = -4, y = -4, z = -4},
maxacc = {x = 4, y = 4, z = 4},
minexptime = 1,
maxexptime = 3,
minsize = 1,
maxsize = 4,
texture = "tnt_smoke.png",
})
end
-- check if within map limits (-30911 to 30927)
local function within_limits(pos)
if pos.x > -30913
and pos.x < 30928
and pos.y > -30913
and pos.y < 30928
and pos.z > -30913
and pos.z < 30928 then
return true -- within limits
end
return false -- beyond limits
end
core.register_entity(":__builtin:item", {
initial_properties = {
hp_max = 1,
physical = true,
collide_with_objects = false,
collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.3, 0.3},
visual = "wielditem",
visual_size = {x = 0.4, y = 0.4},
textures = {""},
spritediv = {x = 1, y = 1},
initial_sprite_basepos = {x = 0, y = 0},
is_visible = false,
infotext = "",
},
itemstring = "",
physical_state = true,
age = 0,
set_item = function(self, itemstring)
self.itemstring = itemstring
local stack = ItemStack(itemstring)
local itemname = stack:get_name()
local max_count = stack:get_stack_max()
local count = math.min(stack:get_count(), max_count)
local size = 0.2 + 0.1 * (count / max_count)
if not core.registered_items[itemname] then
itemname = "unknown"
end
self.object:set_properties({
is_visible = true,
visual = "wielditem",
textures = {itemname},
visual_size = {x = size, y = size},
collisionbox = {-size, -size, -size, size, size, size},
automatic_rotate = math.pi * 0.5,
infotext = core.registered_items[itemname].description
})
end,
update_gravity = function(self)
if not self.physical_state then
self.object:setacceleration({x = 0, y = 0, z = 0})
return
end
self.object:setacceleration({x = 0, y = -gravity, z = 0})
end,
get_staticdata = function(self)
return core.serialize({
itemstring = self.itemstring,
always_collect = self.always_collect,
age = self.age,
dropped_by = self.dropped_by
})
end,
on_activate = function(self, staticdata, dtime_s)
--[[
-- special function to fast remove entities (xanadu only)
if (mobs and mobs.entity and mobs.entity == false)
or not self then
self.object:remove()
return
end
]]
if string.sub(staticdata, 1, string.len("return")) == "return" then
local data = core.deserialize(staticdata)
if data and type(data) == "table" then
self.itemstring = data.itemstring
self.always_collect = data.always_collect
self.age = data.age or 0
self.age = self.age + dtime_s
self.dropped_by = data.dropped_by
end
else
self.itemstring = staticdata
end
self.object:set_armor_groups({immortal = 1})
self.object:setvelocity({x = 0, y = 2, z = 0})
self:update_gravity()
self:set_item(self.itemstring)
end,
try_merge_with = function(self, own_stack, object, entity)
if self.age == entity.age then
-- Can not merge with itself
return false
end
local stack = ItemStack(entity.itemstring)
local name = stack:get_name()
if own_stack:get_name() ~= name or own_stack:get_free_space() == 0 then
-- Can not merge different or full stack
return false
end
local count = own_stack:get_count()
local total_count = stack:get_count() + count
local max_count = stack:get_stack_max()
-- Merge the remote stack into this one
if total_count > max_count then
return false
end
local pos = object:getpos()
pos.y = pos.y + ((total_count - count) / max_count) * 0.15
self:set_item(name .. " " .. total_count)
entity.itemstring = ""
object:remove()
return true
end,
on_step = function(self, dtime)
self.age = self.age + dtime
if time_to_live > 0 and self.age > time_to_live then
self.itemstring = ""
self.object:remove()
return
end
local pos = self.object:getpos()
local node = node_ok({
x = pos.x,
y = pos.y - 0.5,
z = pos.z
})
local def = core.registered_nodes[node.name]
-- destroy item when dropped into lava (if enabled)
if destroy_item > 0 and def.groups.lava then
minetest.sound_play("builtin_item_lava", {
pos = pos,
max_hear_distance = 6,
gain = 0.5
})
add_effects(pos)
self.object:remove()
return
end
-- flowing water pushes item along (by QwertyMine3)
local nod = node_ok({x = pos.x, y = pos.y + 0.5, z = pos.z})
if minetest.registered_nodes[nod.name].liquidtype == "flowing" then
local vec = quick_flow(self.object:getpos(),
node_ok(self.object:getpos()))
if vec then
local v = self.object:getvelocity()
self.object:setvelocity(
{x = vec.x, y = v.y, z = vec.z})
end
return
end
-- Ignore is walkable -> stop until the block loaded
local entity_fall = (def and not def.walkable)
if self.physical_state == entity_fall then
return
end
self.object:setvelocity({x = 0, y = 0, z = 0})
self.physical_state = entity_fall
self.object:set_properties({
physical = entity_fall
})
self:update_gravity()
-- Collect the items around to merge with
local own_stack = ItemStack(self.itemstring)
if own_stack:get_free_space() == 0 then
return
end
local objects = core.get_objects_inside_radius(pos, 0.8)
for k, object in pairs(objects) do
local entity = object:get_luaentity()
if entity and entity.name == "__builtin:item" then
if self:try_merge_with(own_stack, object, entity) then
own_stack = ItemStack(self.itemstring)
if own_stack:get_free_space() == 0 then
return
end
end
end
end
end,
on_punch = function(self, puncher)
local inv = puncher:get_inventory()
if inv and self.itemstring ~= "" then
local left = inv:add_item("main", self.itemstring)
if left and not left:is_empty() then
self:set_item(left:to_string())
return
end
end
self.itemstring = ""
self.object:remove()
end,
})

View File

@ -35,6 +35,7 @@ minetest.register_globalstep(function(dtime)
time = 0
local name = player:get_player_name()
--local sky = player:get_attribute("skybox:skybox")--ADDED SKYBOX
local pos = player:getpos()
--If the player has reached Space
@ -51,10 +52,11 @@ minetest.register_globalstep(function(dtime)
--If the player is on Earth
elseif minetest.get_player_by_name(name) and pos.y < space then
player:set_physics_override(1, 1, 1,true,true) -- speed, jump, gravity [default]
--player:set_sky({}, "regular", {}) -- Sets skybox, in this case it sets the skybox to it's default setting if and only if the player's Y value is less than the value of space.
player:set_sky({}, "regular", {}) -- Sets skybox, in this case it sets the skybox to it's default setting if and only if the player's Y value is less than the value of space.
--player:set_sky(color, "plain", nil) --problem updating color
player:set_sky(color, "regular", nil) --seems to work but weather color is stuck
skycolor.update_sky_color()
--player:set_sky(color, "regular", nil) --seems to work but weather color is stuck
--skybox.set(player, 5)--ADDED SKYBOX
--skycolor.update_sky_color()

View File

@ -1,8 +1,9 @@
--CrushingFurnace mod by sfan5
--v1.1
--Added to es 20160318 maikerumine
minetest.register_alias("cottages:handmill", "es:furnace")
--minetest.register_alias("es:furnace", "es:compressedcobble")
--minetest.register_alias("es:furnace_active", "es:compressedcobble")
-- furnace
local function get_furnace_active_formspec(pos, percent)
local formspec =
"size[8,9]"..
@ -48,7 +49,7 @@ function crushingfurnace_get_craft_result(input)
return {item = ItemStack(""), time=0}, {items = ItemStack("")}
end
minetest.register_node("es:furnace", {
minetest.register_node("es:crushing_furnace", {
description = "Crushing Furnace",
tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "crushingfurnace_front.png"},
@ -119,12 +120,12 @@ minetest.register_node("es:furnace", {
end,
})
minetest.register_node("es:furnace_active", {
minetest.register_node("es:crushing_furnace_active", {
tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
"default_furnace_side.png", "default_furnace_side.png", "crushingfurnace_front_active.png"},
paramtype2 = "facedir",
light_source = 8,
drop = "es:furnace",
drop = "es:crushing_furnace",
groups = {cracky=2, not_in_creative_inventory=1,hot=1},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
@ -202,7 +203,7 @@ function hacky_swap_node(pos,name)
end
minetest.register_abm({
nodenames = {"es:furnace","es:furnace_active"},
nodenames = {"es:crushing_furnace","es:crushing_furnace_active"},
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
@ -252,7 +253,7 @@ minetest.register_abm({
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext","Crushing Furnace active: "..percent.."%")
hacky_swap_node(pos,"es:furnace_active")
hacky_swap_node(pos,"es:crushing_furnace_active")
meta:set_string("formspec", get_furnace_active_formspec(pos, percent))
return
end
@ -272,7 +273,7 @@ minetest.register_abm({
if fuel.time <= 0 then
meta:set_string("infotext", "Crushing Furnace out of fuel")
hacky_swap_node(pos, "es:furnace")
hacky_swap_node(pos, "es:crushing_furnace")
meta:set_string("formspec", furnace_inactive_formspec)
return
end
@ -280,7 +281,7 @@ minetest.register_abm({
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext", "Crushing Furnace is empty")
hacky_swap_node(pos, "es:furnace")
hacky_swap_node(pos, "es:crushing_furnace")
meta:set_string("formspec", furnace_inactive_formspec)
end
return
@ -294,7 +295,7 @@ minetest.register_abm({
})
minetest.register_craft({
output = 'es:furnace',
output = 'es:crushing_furnace',
recipe = {
{'default:cobble', 'default:steelblock', 'default:cobble'},
{'', 'default:diamondblock', ''},

View File

@ -1,7 +1,8 @@
default
farming?
flowers?
stairs
stairs?
moreblocks?
cblocks?
moreblocks?

View File

@ -58,4 +58,32 @@ minetest.after(0,function()
disable_placing_above_ground("es:mud");
-- add here all other sources: toxic water, mud ,....
end)
]]
]]
--Killme
minetest.register_chatcommand("killme", {
description = "Kill yourself to respawn",
func = function(name)
local player = minetest.get_player_by_name(name)
if player then
if minetest.settings:get_bool("enable_damage") then
player:set_hp(0)
return true
else
for _, callback in pairs(core.registered_on_respawnplayers) do
if callback(player) then
return true
end
end
-- There doesn't seem to be a way to get a default spawn pos from the lua API
return false, "No static_spawnpoint defined"
end
else
-- Show error message if used when not logged in, eg: from IRC mod
return false, "You need to be online to be killed!"
end
end
})

160
flowlib.lua Normal file
View File

@ -0,0 +1,160 @@
--default = {}
--sum of direction vectors must match an array index
local function to_unit_vector(dir_vector)
--(sum,root)
-- (0,1), (1,1+0=1), (2,1+1=2), (3,1+2^2=5), (4,2^2+2^2=8)
local inv_roots = {[0] = 1, [1] = 1, [2] = 0.70710678118655, [4] = 0.5
, [5] = 0.44721359549996, [8] = 0.35355339059327}
local sum = dir_vector.x*dir_vector.x + dir_vector.z*dir_vector.z
return {x=dir_vector.x*inv_roots[sum],y=dir_vector.y
,z=dir_vector.z*inv_roots[sum]}
end
local is_touching = function(realpos,nodepos,radius)
local boarder = 0.5 - radius
return (math.abs(realpos - nodepos) > (boarder))
end
default.is_touching = is_touching
local is_water = function(pos)
return (minetest.get_item_group(minetest.get_node(
{x=pos.x,y=pos.y,z=pos.z}).name
, "water") ~= 0)
end
default.is_water = is_water
local node_is_water = function(node)
return (minetest.get_item_group(node.name, "water") ~= 0)
end
default.node_is_water = node_is_water
local is_lava = function(pos)
return (minetest.get_item_group(minetest.get_node(
{x=pos.x,y=pos.y,z=pos.z}).name
, "lava") ~= 0)
end
default.is_lava = is_lava
local node_is_lava = function(node)
return (minetest.get_item_group(node.name, "lava") ~= 0)
end
default.node_is_lava = node_is_lava
local is_liquid = function(pos)
return (minetest.get_item_group(minetest.get_node(
{x=pos.x,y=pos.y,z=pos.z}).name
, "liquid") ~= 0)
end
default.is_liquid = is_liquid
local node_is_liquid = function(node)
return (minetest.get_item_group(node.name, "liquid") ~= 0)
end
default.node_is_liquid = node_is_liquid
--This code is more efficient
local function quick_flow_logic(node,pos_testing,direction)
local name = node.name
if minetest.registered_nodes[name].liquidtype == "source" then
local node_testing = minetest.get_node(pos_testing)
local param2_testing = node_testing.param2
if minetest.registered_nodes[node_testing.name].liquidtype
~= "flowing" then
return 0
else
return direction
end
elseif minetest.registered_nodes[name].liquidtype == "flowing" then
local node_testing = minetest.get_node(pos_testing)
local param2_testing = node_testing.param2
if minetest.registered_nodes[node_testing.name].liquidtype
== "source" then
return -direction
elseif minetest.registered_nodes[node_testing.name].liquidtype
== "flowing" then
if param2_testing < node.param2 then
if (node.param2 - param2_testing) > 6 then
return -direction
else
return direction
end
elseif param2_testing > node.param2 then
if (param2_testing - node.param2) > 6 then
return direction
else
return -direction
end
end
end
end
return 0
end
local quick_flow = function(pos,node)
local x = 0
local z = 0
if not node_is_liquid(node) then
return {x=0,y=0,z=0}
end
x = x + quick_flow_logic(node,{x=pos.x-1,y=pos.y,z=pos.z},-1)
x = x + quick_flow_logic(node,{x=pos.x+1,y=pos.y,z=pos.z}, 1)
z = z + quick_flow_logic(node,{x=pos.x,y=pos.y,z=pos.z-1},-1)
z = z + quick_flow_logic(node,{x=pos.x,y=pos.y,z=pos.z+1}, 1)
return to_unit_vector({x=x,y=0,z=z})
end
default.quick_flow = quick_flow
--if not in water but touching, move centre to touching block
--x has higher precedence than z
--if pos changes with x, it affects z
local move_centre = function(pos,realpos,node,radius)
if is_touching(realpos.x,pos.x,radius) then
if is_liquid({x=pos.x-1,y=pos.y,z=pos.z}) then
node = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})
pos = {x=pos.x-1,y=pos.y,z=pos.z}
elseif is_liquid({x=pos.x+1,y=pos.y,z=pos.z}) then
node = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})
pos = {x=pos.x+1,y=pos.y,z=pos.z}
end
end
if is_touching(realpos.z,pos.z,radius) then
if is_liquid({x=pos.x,y=pos.y,z=pos.z-1}) then
node = minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})
pos = {x=pos.x,y=pos.y,z=pos.z-1}
elseif is_liquid({x=pos.x,y=pos.y,z=pos.z+1}) then
node = minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})
pos = {x=pos.x,y=pos.y,z=pos.z+1}
end
end
return pos,node
end
default.move_centre = move_centre
--[[
Waterlib
================
Simple flow functions for use in Minetest mods by Qwertymine3
License of source code:
-----------------------
WTFPL
]]

75
hudclock.lua Normal file
View File

@ -0,0 +1,75 @@
local player_hud = { };
local timer = 0;
--local positionx = 0.97;
--local positiony = 0.02;
local positionx = 0.30; --horz
local positiony = 0.90; --vert
local last_time = os.time()
local function floormod ( x, y )
return (math.floor(x) % y);
end
local function get_time ( )
local secs = (60*60*24*minetest.get_timeofday());
local s = floormod(secs, 60);
local m = floormod(secs/60, 60);
local h = floormod(secs/3600, 60);
return ("%02d:%02d"):format(h, m);
end
minetest.register_globalstep(function ( dtime )
timer = timer + dtime;
if os.time() >= last_time then
last_time = os.time() + 1
if (timer >= 1.0) then
timer = 0;
for _,p in ipairs(minetest.get_connected_players()) do
local name = p:get_player_name();
local h = p:hud_add({
hud_elem_type = "text";
position = {x=positionx, y=positiony};
text = get_time();
number = 0xFFFFFF;
});
local g = p:hud_add({
hud_elem_type = "image",
position = {x=positionx, y=positiony},
offset = {x=-30, y=0},
scale = {x=1, y=1},
text = "mthudclock.png",
});
if (player_hud[name]) then
p:hud_remove(player_hud[name]);
end
player_hud[name] = h;
--player_hud[name] = g;
end
end
end
end);
-- minetest.register_chatcommand("hcr", {
-- params = "",
-- description = "This should reset your hudclock.",
-- func = function(name, param)
-- local player = minetest.get_player_by_name(name)
-- if not player then
-- return
-- end
-- player:hud_remove(player_hud[name]);
-- player_hud[name] = nil
-- end,
-- })
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
if player_hud[name] ~= nil then
player:hud_remove(player_hud[name]);
player_hud[name] = nil
end
return true
end)

View File

@ -27,7 +27,7 @@ dofile(modpath.."/antigrief.lua")
dofile(modpath.."/armor.lua")
dofile(modpath.."/kill.lua")
dofile(modpath.."/shields.lua")
dofile(modpath.."/shutdown.lua")
--dofile(modpath.."/shutdown.lua")
dofile(modpath.."/spawn.lua")
dofile(modpath.."/crushingfurnace.lua")
dofile(modpath.."/tools.lua")
@ -42,6 +42,10 @@ if flowers then
end
dofile(modpath.."/extra.lua")
dofile(modpath.."/item_entity.lua")
dofile(modpath.."/builtin_flowlib.lua")
dofile(modpath.."/flowlib.lua")
dofile(modpath.."/hudclock.lua")
dofile(modpath.."/nodes.lua")
dofile(modpath.."/oregen.lua")
dofile(modpath.."/cavespace.lua")
@ -61,7 +65,7 @@ end
--MOREBLOCKS / STAIRSPLUS SUPPORT
--if moreblocks then
--dofile(modpath.."/mostair.lua")
dofile(modpath.."/mostair.lua")
--end
--STAIR SUPPORT

74
item_entity.lua Normal file
View File

@ -0,0 +1,74 @@
-- mods/default/item_entity.lua
local builtin_item = minetest.registered_entities["__builtin:item"]
local item = {
set_item = function(self, itemstring)
builtin_item.set_item(self, itemstring)
local stack = ItemStack(itemstring)
local itemdef = minetest.registered_items[stack:get_name()]
if itemdef and itemdef.groups.flammable ~= 0 then
self.flammable = itemdef.groups.flammable
end
end,
burn_up = function(self)
-- disappear in a smoke puff
self.object:remove()
local p = self.object:getpos()
minetest.sound_play("default_item_smoke", {
pos = p,
max_hear_distance = 8,
})
minetest.add_particlespawner({
amount = 3,
time = 0.1,
minpos = {x = p.x - 0.1, y = p.y + 0.1, z = p.z - 0.1 },
maxpos = {x = p.x + 0.1, y = p.y + 0.2, z = p.z + 0.1 },
minvel = {x = 0, y = 2.5, z = 0},
maxvel = {x = 0, y = 2.5, z = 0},
minacc = {x = -0.15, y = -0.02, z = -0.15},
maxacc = {x = 0.15, y = -0.01, z = 0.15},
minexptime = 4,
maxexptime = 6,
minsize = 5,
maxsize = 5,
collisiondetection = true,
texture = "default_item_smoke.png"
})
end,
on_step = function(self, dtime)
builtin_item.on_step(self, dtime)
if self.flammable then
-- flammable, check for igniters
self.ignite_timer = (self.ignite_timer or 0) + dtime
if self.ignite_timer > 10 then
self.ignite_timer = 0
local node = minetest.get_node_or_nil(self.object:getpos())
if not node then
return
end
-- Immediately burn up flammable items in lava
if minetest.get_item_group(node.name, "lava") > 0 then
self:burn_up()
else
-- otherwise there'll be a chance based on its igniter value
local burn_chance = self.flammable
* minetest.get_item_group(node.name, "igniter")
if burn_chance > 0 and math.random(0, burn_chance) ~= 0 then
self:burn_up()
end
end
end
end
end,
}
-- set defined item as new __builtin:item, with the old one as fallback table
setmetatable(item, builtin_item)
minetest.register_entity(":__builtin:item", item)

View File

@ -50,7 +50,7 @@ minetest.override_item('default:stone_with_mese', {
--compressed cobble
minetest.register_node("es:compressedcobble", {
description = "Compressed Cobblestone",
tiles = {"default_cobble.png^default_ladder.png^[colorize:#000000:170"},
tiles = {"default_cobble.png^default_ladder_wood.png^[colorize:#000000:170"},
is_ground_content = false,
groups = {cracky = 3, stone = 2},
sounds = default.node_sound_stone_defaults(),
@ -73,7 +73,8 @@ hurt_cactus();
--TECHNIC NODES
minetest.register_node( "es:granite", {
description = "Granite",
tiles = { "technic_granite.png" },
--tiles = { "technic_granite.png" },
tiles = { "mcl_core_granite.png" },
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
@ -81,7 +82,8 @@ minetest.register_node( "es:granite", {
minetest.register_node( "es:granite_bricks", {
description = "Granite Bricks",
tiles = { "technic_granite_bricks.png",},
--tiles = { "technic_granite_bricks.png",},
tiles = { "mcl_core_granite_smooth.png",},
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
@ -89,7 +91,8 @@ minetest.register_node( "es:granite_bricks", {
minetest.register_node( "es:marble", {
description = "Marble",
tiles = { "technic_marble.png" },
--tiles = { "technic_marble.png" },
tiles = { "mcl_core_diorite.png" },
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
@ -97,7 +100,8 @@ minetest.register_node( "es:marble", {
minetest.register_node( "es:marble_bricks", {
description = "Marble Bricks",
tiles = { "technic_marble_bricks.png" },
--tiles = { "technic_marble_bricks.png" },
tiles = { "mcl_core_diorite_smooth.png" },
is_ground_content = true,
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
@ -422,13 +426,15 @@ minetest.register_node("es:messymese", {
minetest.register_node("es:what", {
description = "The What Block - Dig for random gift",
drawtype = "glasslike_framed_optional^bubble.png",
tiles = {"default_glass.png^bubble.png", "default_glass_detail.png^bubble.png"},
inventory_image = minetest.inventorycube("default_glass.png"),
drawtype = "glasslike_framed_optional",
tiles = {"default_obsidian_glass.png^bubble.png", "default_obsidian_glass_detail.png^bubble.png"},
inventory_image = minetest.inventorycube("default_obsidian_glass.png^bubble.png"),
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "glasslikeliquidlevel",
is_ground_content = false,
groups = {crumbly=3,},
sunlight_propagates = true,
sounds = default.node_sound_glass_defaults(),
groups = {cracky = 3},
drop = {
max_items = 2,
items = {
@ -492,7 +498,7 @@ end
minetest.register_node("es:vault", {
description = "Use this to store MANY items.",
tiles = { "vault.png", "vault.png", "vault.png",
"vault.png", "vault.png", "(vault.png^default_nc_front.png^[colorize:#00FF00:110)"},
"vault.png", "vault.png", "(vault.png^nyancat_front.png^[colorize:#00FF00:110)"},
inventory_image = "vault.png",
light_source = 14,
paramtype2 = "facedir",

View File

@ -4,7 +4,7 @@ local spawn_limit_max = 180; -- how much time must elapse to be able to use spaw
spawn_prison = {}
spawn_prison.pos = {x=0, y=10006, z=0}
spawn_prison.pos = {x=-15, y=4, z=0}
if minetest.setting_get_pos("static_spawnpoint") then
spawn_prison.pos = minetest.setting_get_pos("static_spawnpoint")

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
textures/mthudclock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B