develop #35

Merged
milan merged 16 commits from develop into master 2021-07-24 12:49:35 +02:00
18 changed files with 168 additions and 68 deletions
Showing only changes of commit f36efacca8 - Show all commits

View file

@ -1,12 +1,4 @@
--[[
Copyright (C) 2012 PilzAdam
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
Copyright (C) 2015 - Auke Kok <sofar@foo-projects.org>
--]]
-- our API object
doors = {
mod = "redo",
@ -15,6 +7,18 @@ doors = {
}
local function replace_old_owner_information(pos)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("doors_owner")
if owner and owner ~= "" then
meta:set_string("owner", owner)
meta:set_string("doors_owner", "")
end
end
-- returns an object to a door object or nil
function doors.get(pos)
@ -181,9 +185,11 @@ function doors.door_toggle(pos, node, clicker)
state = tonumber(state)
end
replace_old_owner_information(pos)
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
local owner = meta:get_string("doors_owner")
local owner = meta:get_string("owner")
local prot = meta:get_string("doors_protected")
if prot ~= "" then
@ -221,10 +227,10 @@ function doors.door_toggle(pos, node, clicker)
if state % 2 == 0 then
minetest.sound_play(def.door.sounds[1],
{pos = pos, gain = 0.3, max_hear_distance = 10})
{pos = pos, gain = 0.3, max_hear_distance = 10}, true)
else
minetest.sound_play(def.door.sounds[2],
{pos = pos, gain = 0.3, max_hear_distance = 10})
{pos = pos, gain = 0.3, max_hear_distance = 10}, true)
end
minetest.swap_node(pos, {
@ -248,15 +254,9 @@ local function on_place_node(place_to, newnode, placer, oldnode, itemstack, poin
-- Deepcopy pos, node and pointed_thing because callback can modify them
local place_to_copy = {x = place_to.x, y = place_to.y, z = place_to.z}
local newnode_copy = {
name = newnode.name,
param1 = newnode.param1,
param2 = newnode.param2
}
name = newnode.name, param1 = newnode.param1, param2 = newnode.param2}
local oldnode_copy = {
name = oldnode.name,
param1 = oldnode.param1,
param2 = oldnode.param2
}
name = oldnode.name, param1 = oldnode.param1, param2 = oldnode.param2}
local pointed_thing_copy = {
type = pointed_thing.type,
above = vector.new(pointed_thing.above),
@ -272,13 +272,15 @@ end
local function can_dig_door(pos, digger)
replace_old_owner_information(pos)
local digger_name = digger and digger:get_player_name()
if digger_name and minetest.get_player_privs(digger_name).protection_bypass then
return true
end
return minetest.get_meta(pos):get_string("doors_owner") == digger_name
return minetest.get_meta(pos):get_string("owner") == digger_name
end
function doors.register(name, def)
@ -337,7 +339,7 @@ function doors.register(name, def)
on_place = function(itemstack, placer, pointed_thing)
local pos = nil
local pos
if not pointed_thing.type == "node" then
return itemstack
@ -415,14 +417,16 @@ function doors.register(name, def)
local pn = placer:get_player_name()
meta:set_string("doors_owner", pn)
meta:set_string("owner", pn)
meta:set_string("infotext", "Owned by " .. pn)
end
if not minetest.setting_getbool("creative_mode") then
if not minetest.is_creative_enabled(pn) then
itemstack:take_item()
end
minetest.sound_play(def.sounds.place, {pos = pos}, true)
on_place_node(pos, minetest.get_node(pos), placer, node, itemstack,
pointed_thing)
@ -436,7 +440,7 @@ function doors.register(name, def)
minetest.register_craft({
output = name,
recipe = def.recipe,
recipe = def.recipe
})
end
@ -457,10 +461,9 @@ function doors.register(name, def)
def.groups.not_in_creative_inventory = 1
def.groups.door = 1
def.drop = name
def.door = {
name = name,
sounds = { def.sound_close, def.sound_open }
}
def.door = {name = name, sounds = {def.sound_close, def.sound_open}}
if not def.on_rightclick then
def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
@ -468,6 +471,7 @@ function doors.register(name, def)
return itemstack
end
end
def.after_dig_node = function(pos, node, meta, digger)
@ -476,7 +480,9 @@ function doors.register(name, def)
minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z})
end
def.on_rotate = false
def.on_rotate = function(pos, node, user, mode, new_param2)
return false
end
if def.protected then
def.can_dig = can_dig_door
@ -509,10 +515,14 @@ function doors.register(name, def)
def.collision_box = {type = "fixed", fixed = { -1/2,-1/2,-1/2,1/2,3/2,-6/16}}
def.mesh = "door_a.obj"
minetest.register_node(":" .. name .. "_a", def)
minetest.register_node(":" .. name .. "_a", table.copy(def))
minetest.register_alias(name .. "_c", name .. "_b")
def.mesh = "door_b.obj"
minetest.register_node(":" .. name .. "_b", def)
minetest.register_node(":" .. name .. "_b", table.copy(def))
minetest.register_alias(name .. "_d", name .. "_a")
doors.registered_doors[name .. "_a"] = true
doors.registered_doors[name .. "_b"] = true
@ -523,7 +533,7 @@ doors.register("door_wood", {
tiles = {{name = "doors_door_wood.png", backface_culling = true}},
description = "Wooden Door",
inventory_image = "doors_item_wood.png",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
groups = {node = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "group:wood"},
@ -531,12 +541,13 @@ doors.register("door_wood", {
}
})
doors.register("door_steel", {
tiles = {{name = "doors_door_steel.png", backface_culling = true}},
description = "Steel Door",
inventory_image = "doors_item_steel.png",
protected = true,
groups = {cracky = 1, level = 2},
groups = {node = 1, cracky = 1, level = 2},
sounds = default.node_sound_stone_defaults(),
sound_open = "doors_steel_door_open",
sound_close = "doors_steel_door_close",
@ -552,7 +563,7 @@ doors.register("door_glass", {
tiles = { "doors_door_glass.png"},
description = "Glass Door",
inventory_image = "doors_item_glass.png",
groups = {cracky = 3, oddly_breakable_by_hand = 3},
groups = {node = 1, cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
sound_open = "doors_glass_door_open",
sound_close = "doors_glass_door_close",
@ -568,7 +579,7 @@ doors.register("door_obsidian_glass", {
tiles = { "doors_door_obsidian_glass.png" },
description = "Obsidian Glass Door",
inventory_image = "doors_item_obsidian_glass.png",
groups = {cracky = 3},
groups = {node = 1, cracky = 3},
sounds = default.node_sound_glass_defaults(),
sound_open = "doors_glass_door_open",
sound_close = "doors_glass_door_close",
@ -580,6 +591,33 @@ doors.register("door_obsidian_glass", {
})
-- special doors (CC0 textures by Phiwari123 and IceAgeComing)
doors.register("door_phiwari", {
tiles = {{name = "doors_door_phiwari.png", backface_culling = true}},
description = "Phiwari's Wooden Door",
inventory_image = "doors_item_phiwari.png",
groups = {node = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
recipe = {
{"group:wood", "default:obsidian_glass"},
{"group:wood", "group:wood"},
{"group:wood", "group:wood"}
}
})
doors.register("door_iceage", {
tiles = {{name = "doors_door_iceage.png", backface_culling = true}},
description = "IceAge's Wooden Door",
inventory_image = "doors_item_iceage.png",
groups = {node = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
recipe = {
{"group:wood", "default:iron_lump"},
{"group:wood", "group:wood"},
{"group:wood", "group:wood"}
}
})
-- Capture mods using the old API as best as possible.
function doors.register_door(name, def)
@ -613,12 +651,14 @@ end
function doors.trapdoor_toggle(pos, node, clicker)
replace_old_owner_information(pos)
node = node or minetest.get_node(pos)
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
local meta = minetest.get_meta(pos) ; if not meta then return false end
local owner = meta:get_string("doors_owner")
local owner = meta:get_string("owner")
local prot = meta:get_string("doors_protected")
if prot ~= "" then
@ -640,7 +680,7 @@ function doors.trapdoor_toggle(pos, node, clicker)
if string.sub(node.name, -5) == "_open" then
minetest.sound_play(def.sound_close,
{pos = pos, gain = 0.3, max_hear_distance = 10})
{pos = pos, gain = 0.3, max_hear_distance = 10}, true)
minetest.swap_node(pos, {
name = string.sub(node.name, 1, string.len(node.name) - 5),
@ -648,7 +688,7 @@ function doors.trapdoor_toggle(pos, node, clicker)
})
else
minetest.sound_play(def.sound_open,
{pos = pos, gain = 0.3, max_hear_distance = 10})
{pos = pos, gain = 0.3, max_hear_distance = 10}, true)
minetest.swap_node(pos, {
name = node.name .. "_open",
@ -689,10 +729,10 @@ function doors.register_trapdoor(name, def)
local pn = placer:get_player_name()
local meta = minetest.get_meta(pos)
meta:set_string("doors_owner", pn)
meta:set_string("owner", pn)
meta:set_string("infotext", "Owned by "..pn)
return minetest.setting_getbool("creative_mode")
return minetest.is_creative_enabled(pn)
end
def.on_blast = function() end
@ -817,9 +857,11 @@ minetest.register_tool("doors:key", {
return
end
replace_old_owner_information(pos)
local player_name = user:get_player_name()
local meta = minetest.get_meta(pos) ; if not meta then return end
local owner = meta:get_string("doors_owner")
local owner = meta:get_string("owner")
local prot = meta:get_string("doors_protected")
local ok = 0
local infotext = ""
@ -863,10 +905,10 @@ minetest.register_tool("doors:key", {
if ok == 1 then
meta:set_string("infotext", infotext)
meta:set_string("doors_owner", owner)
meta:set_string("owner", owner)
meta:set_string("doors_protected", prot)
if not minetest.settings:get_bool("creative_mode") then
if not minetest.is_creative_enabled(player_name) then
itemstack:add_wear(65535 / 50)
end
end
@ -890,13 +932,14 @@ minetest.register_craft({
--end
----fence gate----
local fence_collision_extra = minetest.settings:get_bool("enable_fence_tall") and 3/8 or 0
function doors.register_fencegate(name, def)
local fence = {
description = def.description,
drawtype = "mesh",
tiles = { def.texture },
tiles = {},
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
@ -905,19 +948,34 @@ function doors.register_fencegate(name, def)
connect_sides = {"left", "right"},
groups = def.groups,
sounds = def.sounds,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local node_def = minetest.registered_nodes[node.name]
minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2})
minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3,
max_hear_distance = 8})
max_hear_distance = 8}, true)
return itemstack
end,
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4}
}
}
if type(def.texture) == "string" then
fence.tiles[1] = {name = def.texture, backface_culling = true}
elseif def.texture.backface_culling == nil then
fence.tiles[1] = table.copy(def.texture)
fence.tiles[1].backface_culling = true
else
fence.tiles[1] = def.texture
end
if not fence.sounds then
fence.sounds = default.node_sound_wood_defaults()
end
@ -931,7 +989,7 @@ function doors.register_fencegate(name, def)
fence_closed.sound = "doors_fencegate_open"
fence_closed.collision_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4}
fixed = {-1/2, -1/2, -1/4, 1/2, 1/2 + fence_collision_extra, 1/4}
}
local fence_open = table.copy(fence)
@ -942,8 +1000,8 @@ function doors.register_fencegate(name, def)
fence_open.groups.not_in_creative_inventory = 1
fence_open.collision_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -1/4, -3/8, 1/2, 1/4},
{-5/8, -3/8, -14/16, -3/8, 1/2, 0}}, -- 1/2 was 3/8
fixed = {{-1/2, -1/2, -1/8, -3/8, 1/2 + fence_collision_extra, 1/8},
{-1/2, -3/8, -1/2, -3/8, 3/8, 0}},
}
minetest.register_node(":" .. name .. "_closed", fence_closed)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

View file

@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20210527",
version = "20210601",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -66,9 +66,9 @@ local mob_nospawn_range = tonumber(settings:get("mob_nospawn_range") or 12)
local active_limit = tonumber(settings:get("mob_active_limit") or 0)
local mob_chance_multiplier = tonumber(settings:get("mob_chance_multiplier") or 1)
local peaceful_player_enabled = settings:get_bool("enable_peaceful_player")
local mob_smooth_rotate = settings:get_bool("mob_smooth_rotate") ~= false
local active_mobs = 0
-- Peaceful mode message so players will know there are no monsters
if peaceful_only then
minetest.register_on_joinplayer(function(player)
@ -339,10 +339,12 @@ function mob_class:set_yaw(yaw, delay)
yaw = 0
end
delay = delay or 0
delay = mob_smooth_rotate and (delay or 0) or 0
if delay == 0 then
self.object:set_yaw(yaw)
return yaw
end

View file

@ -722,6 +722,7 @@ External Settings for "minetest.conf"
'mob_area_spawn' When true will check surrounding area the size of the
mob for obstructions before spawning, otherwise it
defaults to checking the height of the mob only.
'mob_smooth_rotate' Enables smooth rotation when mobs turn by default.
Players can override the spawn chance for each mob registered by adding a line
to their minetest.conf file with a new value, the lower the value the more each

View file

@ -39,3 +39,6 @@ mob_area_spawn (Mob Area Spawn) bool false
# Enable peaceful player attack prevention
enable_peaceful_player (Mobs do not attack peaceful player without reason) bool false
# Enable mobs smooth rotation
mob_smooth_rotate (Smooth rotation for mobs) bool true

View file

@ -707,7 +707,7 @@ end
function signs_lib.rightclick_sign(pos, node, player, itemstack, pointed_thing)
if not signs_lib.can_modify(pos, player) then return end
if not player or not signs_lib.can_modify(pos, player) then return end
player:get_meta():set_string("signslib:pos", minetest.pos_to_string(pos))
minetest.show_formspec(player:get_player_name(), "signs_lib:sign", get_sign_formspec(pos, node.name))

View file

@ -0,0 +1,3 @@
My Skin
GroupNebula563
CC BY-NC-SA 3.0

View file

@ -0,0 +1,3 @@
Sunset E-Boy
Greenify
CC BY-NC-SA 3.0

View file

@ -0,0 +1,3 @@
Sunset E-Boy Skin
Greenify
CC BY-SA 4.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -337,6 +337,17 @@ else
tubelib.add_grinder_recipe({input="default:sand", output="default:clay"})
end
if minetest.get_modpath("underch") then
for regnodename,v in pairs(minetest.registered_nodes) do
if string.find(regnodename, "underch:") then
if string.find(regnodename, "_cobble") and not string.find(regnodename, "_wall") then
print("tubelib.add_grinder_recipe: " .. regnodename)
tubelib.add_grinder_recipe({input=regnodename, output="default:gravel"})
end
end
end
end
tubelib.add_grinder_recipe({input="default:sandstone", output="default:sand 4"})
tubelib.add_grinder_recipe({input="default:desert_sandstone", output="default:desert_sand 4"})
tubelib.add_grinder_recipe({input="default:silver_sandstone", output="default:silver_sand 4"})

View file

@ -254,6 +254,21 @@ gn("ethereal:illumishroom")
gn("ethereal:illumishroom2")
gn("ethereal:illumishroom3")
-------------------------------------------------------------------------------
-- underch Ground
-------------------------------------------------------------------------------
if minetest.get_modpath("underch") then
for regnodename,v in pairs(minetest.registered_nodes) do
if string.find(regnodename, "underch:") then
if string.find(regnodename, "_cobble") and not string.find(regnodename, "_wall") then
gnname = string.gsub(regnodename, "_cobble", "")
print("tubelib_addons1.register_ground_node: " .. gnname)
gn(gnname, regnodename)
end
end
end
end
-------------------------------------------------------------------------------
-- Registered flowers

View file

@ -66,6 +66,7 @@ local ferment = {
{"farming:grapes", "wine:glass_wine"},
{"farming:barley", "wine:glass_beer"},
{"mobs:honey", "wine:glass_mead"},
{"xdecor:honey", "wine:glass_mead"}, -- for when xdcecor is installed
{"default:apple", "wine:glass_cider"},
{"default:papyrus", "wine:glass_rum"},
{"wine:blue_agave", "wine:glass_tequila"},