Merge remote-tracking branch 'origin' into connect_to_raillike
41
game_api.txt
|
@ -24,6 +24,42 @@ The bucket API allows registering new types of buckets for non-default liquids.
|
|||
"Lava Bucket" -- Bucket description
|
||||
)
|
||||
|
||||
Beds API
|
||||
--------
|
||||
beds.register_bed(
|
||||
"beds:bed", -- Bed name
|
||||
def: See [#Bed definition] -- Bed definition
|
||||
)
|
||||
|
||||
beds.read_spawns() -- returns a table containing players respawn positions
|
||||
beds.kick_players() -- forces all players to leave bed
|
||||
beds.skip_night() -- sets world time to morning and saves respawn position of all players currently sleeping
|
||||
|
||||
#Bed definition
|
||||
---------------
|
||||
{
|
||||
description = "Simple Bed",
|
||||
inventory_image = "beds_bed.png",
|
||||
wield_image = "beds_bed.png",
|
||||
tiles = {
|
||||
bottom = {[Tile definition],
|
||||
^ the tiles of the bottom part of the bed
|
||||
},
|
||||
top = {[Tile definition],
|
||||
^ the tiles of the bottom part of the bed
|
||||
}
|
||||
},
|
||||
nodebox = {
|
||||
bottom = regular nodebox, see [Node boxes], -- bottm part of bed
|
||||
top = regular nodebox, see [Node boxes], -- top part of bed
|
||||
},
|
||||
selectionbox = regular nodebox, see [Node boxes], -- for both nodeboxes
|
||||
recipe = { -- Craft recipe
|
||||
{"group:wool", "group:wool", "group:wool"},
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
}
|
||||
}
|
||||
|
||||
Doors API
|
||||
---------
|
||||
The doors mod allows modders to register custom doors and trapdoors.
|
||||
|
@ -89,7 +125,8 @@ farming.register_plant(name, Plant definition)
|
|||
description = "", -- Description for tooltip
|
||||
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
|
||||
max_uses = 30, -- Uses until destroyed
|
||||
recipe = { -- Craft recipe
|
||||
material = "", -- Material for recipes
|
||||
recipe = { -- Craft recipe, if material isn't used
|
||||
{"air", "air", "air"},
|
||||
{"", "group:stick"},
|
||||
{"", "group:stick"},
|
||||
|
@ -102,7 +139,7 @@ farming.register_plant(name, Plant definition)
|
|||
description = "", -- Description of seed item
|
||||
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
|
||||
steps = 8, -- How many steps the plant has to grow, until it can be harvested
|
||||
^ Always provide a plant texture for ech step, format: modname_plantname_i.png (i = stepnumber)
|
||||
^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
|
||||
minlight = 13, -- Minimum light to grow
|
||||
maxlight = default.LIGHT_MAX -- Maximum light to grow
|
||||
}
|
||||
|
|
BIN
menu/header.png
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 79 KiB |
BIN
menu/icon.png
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 2.9 KiB |
|
@ -1,3 +0,0 @@
|
|||
mg_flags = dungeons
|
||||
mgv6_spflags = biomeblend, jungles
|
||||
|
18
mods/beds/Changelog.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
1.0.1 beta
|
||||
----------
|
||||
- Add backwards compatibility with PilzAdam's beds mod
|
||||
- Fix placement
|
||||
- Fix small bugs
|
||||
- Prevent possible crash
|
||||
|
||||
1.1
|
||||
---
|
||||
- Add fancy bed model (based on jp's model)
|
||||
- Add API to register beds
|
||||
- Allow players always to detach from bed (by donat-b)
|
||||
- If more than 50% of players want sleep they can skip the night
|
||||
- Don't show sleep dialog in singleplayer
|
||||
|
||||
1.1.1
|
||||
-----
|
||||
- Prevent possbile crash by trying to reposition leaving players
|
29
mods/beds/README.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
Minetest mod "Beds"
|
||||
===================
|
||||
by BlockMen (c) 2014-2015
|
||||
|
||||
Version: 1.1.1
|
||||
|
||||
About
|
||||
~~~~~
|
||||
This mod adds a bed to Minetest which allows to skip the night. To sleep rightclick the bed, if playing
|
||||
in singleplayer mode the night gets skipped imideatly. If playing on server you get shown how many other
|
||||
players are in bed too. If all players are sleeping the night gets skipped aswell. Also the night skip can be forced
|
||||
if more than 50% of the players are lying in bed and use this option.
|
||||
|
||||
Another feature is a controled respawning. If you have slept in bed (not just lying in it) your respawn point
|
||||
is set to the beds location and you will respawn there after death.
|
||||
You can disable the respawn at beds by setting "enable_bed_respawn = false" in minetest.conf
|
||||
|
||||
|
||||
|
||||
License of source code, textures: WTFPL
|
||||
---------------------------------------
|
||||
(c) Copyright BlockMen (2014-2015)
|
||||
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the Do What The Fuck You Want
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
78
mods/beds/api.lua
Normal file
|
@ -0,0 +1,78 @@
|
|||
function beds.register_bed(name, def)
|
||||
minetest.register_node(name .. "_bottom", {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
wield_image = def.wield_image,
|
||||
drawtype = "nodebox",
|
||||
tiles = def.tiles.bottom,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
stack_max = 1,
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = def.nodebox.bottom,
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = def.selectionbox,
|
||||
|
||||
},
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local n = minetest.get_node_or_nil(pos)
|
||||
if not n or not n.param2 then
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
local dir = minetest.facedir_to_dir(n.param2)
|
||||
local p = {x=pos.x+dir.x,y=pos.y,z=pos.z+dir.z}
|
||||
local n2 = minetest.get_node_or_nil(p)
|
||||
local def = minetest.registered_items[n2.name] or nil
|
||||
if not n2 or not def or not def.buildable_to then
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
minetest.set_node(p, {name = n.name:gsub("%_bottom", "_top"), param2 = n.param2})
|
||||
return false
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local n = minetest.get_node_or_nil(pos)
|
||||
if not n then return end
|
||||
local dir = minetest.facedir_to_dir(n.param2)
|
||||
local p = {x=pos.x+dir.x,y=pos.y,z=pos.z+dir.z}
|
||||
local n2 = minetest.get_node(p)
|
||||
if minetest.get_item_group(n2.name, "bed") == 2 and n.param2 == n2.param2 then
|
||||
minetest.remove_node(p)
|
||||
end
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
beds.on_rightclick(pos, clicker)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node(name .. "_top", {
|
||||
drawtype = "nodebox",
|
||||
tiles = def.tiles.top,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = def.nodebox.top,
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0, 0, 0, 0, 0, 0},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_alias(name, name .. "_bottom")
|
||||
|
||||
-- register recipe
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = def.recipe
|
||||
})
|
||||
end
|
88
mods/beds/beds.lua
Normal file
|
@ -0,0 +1,88 @@
|
|||
-- fancy shaped bed
|
||||
beds.register_bed("beds:fancy_bed", {
|
||||
description = "Fancy Bed",
|
||||
inventory_image = "beds_bed_fancy.png",
|
||||
wield_image = "beds_bed_fancy.png",
|
||||
tiles = {
|
||||
bottom = {
|
||||
"beds_bed_top1.png",
|
||||
"default_wood.png",
|
||||
"beds_bed_side1.png",
|
||||
"beds_bed_side1.png^[transformFX",
|
||||
"default_wood.png",
|
||||
"beds_bed_foot.png",
|
||||
},
|
||||
top = {
|
||||
"beds_bed_top2.png",
|
||||
"default_wood.png",
|
||||
"beds_bed_side2.png",
|
||||
"beds_bed_side2.png^[transformFX",
|
||||
"beds_bed_head.png",
|
||||
"default_wood.png",
|
||||
}
|
||||
},
|
||||
nodebox = {
|
||||
bottom = {
|
||||
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
|
||||
{0.375, -0.5, -0.5, 0.5, -0.065, -0.4375},
|
||||
{-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375},
|
||||
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
|
||||
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
|
||||
{-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5},
|
||||
},
|
||||
top = {
|
||||
{-0.5, -0.5, 0.4375, -0.375, 0.1875, 0.5},
|
||||
{0.375, -0.5, 0.4375, 0.5, 0.1875, 0.5},
|
||||
{-0.5, 0, 0.4375, 0.5, 0.125, 0.5},
|
||||
{-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5},
|
||||
{-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5},
|
||||
{0.4375, -0.375, -0.5, 0.5, -0.125, 0.5},
|
||||
{-0.4375, -0.3125, -0.5, 0.4375, -0.0625, 0.4375},
|
||||
}
|
||||
},
|
||||
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||
recipe = {
|
||||
{"", "", "group:stick"},
|
||||
{"wool:red", "wool:red", "wool:white"},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
-- simple shaped bed
|
||||
beds.register_bed("beds:bed", {
|
||||
description = "Simple Bed",
|
||||
inventory_image = "beds_bed.png",
|
||||
wield_image = "beds_bed.png",
|
||||
tiles = {
|
||||
bottom = {
|
||||
"beds_bed_top_bottom.png^[transformR90",
|
||||
"default_wood.png",
|
||||
"beds_bed_side_bottom_r.png",
|
||||
"beds_bed_side_bottom_r.png^[transformfx",
|
||||
"beds_transparent.png",
|
||||
"beds_bed_side_bottom.png"
|
||||
},
|
||||
top = {
|
||||
"beds_bed_top_top.png^[transformR90",
|
||||
"default_wood.png",
|
||||
"beds_bed_side_top_r.png",
|
||||
"beds_bed_side_top_r.png^[transformfx",
|
||||
"beds_bed_side_top.png",
|
||||
"beds_transparent.png",
|
||||
}
|
||||
},
|
||||
nodebox = {
|
||||
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||
},
|
||||
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||
recipe = {
|
||||
{"wool:red", "wool:red", "wool:white"},
|
||||
{"group:wood", "group:wood", "group:wood"}
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
-- aliases for PA's beds mod
|
||||
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
|
||||
minetest.register_alias("beds:bed_top_red", "beds:bed_top")
|
2
mods/beds/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
wool
|
213
mods/beds/functions.lua
Normal file
|
@ -0,0 +1,213 @@
|
|||
local player_in_bed = 0
|
||||
local is_sp = minetest.is_singleplayer()
|
||||
local enable_respawn = minetest.setting_getbool("enable_bed_respawn")
|
||||
if enable_respawn == nil then
|
||||
enable_respawn = true
|
||||
end
|
||||
|
||||
|
||||
-- helper functions
|
||||
|
||||
local function get_look_yaw(pos)
|
||||
local n = minetest.get_node(pos)
|
||||
if n.param2 == 1 then
|
||||
return 7.9, n.param2
|
||||
elseif n.param2 == 3 then
|
||||
return 4.75, n.param2
|
||||
elseif n.param2 == 0 then
|
||||
return 3.15, n.param2
|
||||
else
|
||||
return 6.28, n.param2
|
||||
end
|
||||
end
|
||||
|
||||
local function check_in_beds(players)
|
||||
local in_bed = beds.player
|
||||
if not players then
|
||||
players = minetest.get_connected_players()
|
||||
end
|
||||
|
||||
for n, player in ipairs(players) do
|
||||
local name = player:get_player_name()
|
||||
if not in_bed[name] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function lay_down(player, pos, bed_pos, state, skip)
|
||||
local name = player:get_player_name()
|
||||
local hud_flags = player:hud_get_flags()
|
||||
|
||||
if not player or not name then
|
||||
return
|
||||
end
|
||||
|
||||
-- stand up
|
||||
if state ~= nil and not state then
|
||||
local p = beds.pos[name] or nil
|
||||
if beds.player[name] ~= nil then
|
||||
beds.player[name] = nil
|
||||
player_in_bed = player_in_bed - 1
|
||||
end
|
||||
-- skip here to prevent sending player specific changes (used for leaving players)
|
||||
if skip then
|
||||
return
|
||||
end
|
||||
if p then
|
||||
player:setpos(p)
|
||||
end
|
||||
|
||||
-- physics, eye_offset, etc
|
||||
player:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
|
||||
player:set_look_yaw(math.random(1, 180)/100)
|
||||
default.player_attached[name] = false
|
||||
player:set_physics_override(1, 1, 1)
|
||||
hud_flags.wielditem = true
|
||||
default.player_set_animation(player, "stand" , 30)
|
||||
|
||||
-- lay down
|
||||
else
|
||||
beds.player[name] = 1
|
||||
beds.pos[name] = pos
|
||||
player_in_bed = player_in_bed + 1
|
||||
|
||||
-- physics, eye_offset, etc
|
||||
player:set_eye_offset({x=0,y=-13,z=0}, {x=0,y=0,z=0})
|
||||
local yaw, param2 = get_look_yaw(bed_pos)
|
||||
player:set_look_yaw(yaw)
|
||||
local dir = minetest.facedir_to_dir(param2)
|
||||
local p = {x=bed_pos.x+dir.x/2,y=bed_pos.y,z=bed_pos.z+dir.z/2}
|
||||
player:set_physics_override(0, 0, 0)
|
||||
player:setpos(p)
|
||||
default.player_attached[name] = true
|
||||
hud_flags.wielditem = false
|
||||
default.player_set_animation(player, "lay" , 0)
|
||||
end
|
||||
|
||||
player:hud_set_flags(hud_flags)
|
||||
end
|
||||
|
||||
local function update_formspecs(finished)
|
||||
local ges = #minetest.get_connected_players()
|
||||
local form_n = ""
|
||||
local is_majority = (ges/2) < player_in_bed
|
||||
|
||||
if finished then
|
||||
form_n = beds.formspec ..
|
||||
"label[2.7,11; Good morning.]"
|
||||
else
|
||||
form_n = beds.formspec ..
|
||||
"label[2.2,11;"..tostring(player_in_bed).." of "..tostring(ges).." players are in bed]"
|
||||
if is_majority then
|
||||
form_n = form_n ..
|
||||
"button_exit[2,8;4,0.75;force;Force night skip]"
|
||||
end
|
||||
end
|
||||
|
||||
for name,_ in pairs(beds.player) do
|
||||
minetest.show_formspec(name, "beds_form", form_n)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- public functions
|
||||
|
||||
function beds.kick_players()
|
||||
for name,_ in pairs(beds.player) do
|
||||
local player = minetest.get_player_by_name(name)
|
||||
lay_down(player, nil, nil, false)
|
||||
end
|
||||
end
|
||||
|
||||
function beds.skip_night()
|
||||
minetest.set_timeofday(0.23)
|
||||
beds.set_spawns()
|
||||
end
|
||||
|
||||
function beds.on_rightclick(pos, player)
|
||||
local name = player:get_player_name()
|
||||
local ppos = player:getpos()
|
||||
local tod = minetest.get_timeofday()
|
||||
|
||||
if tod > 0.2 and tod < 0.805 then
|
||||
if beds.player[name] then
|
||||
lay_down(player, nil, nil, false)
|
||||
end
|
||||
minetest.chat_send_player(name, "You can only sleep at night.")
|
||||
return
|
||||
end
|
||||
|
||||
-- move to bed
|
||||
if not beds.player[name] then
|
||||
lay_down(player, ppos, pos)
|
||||
else
|
||||
lay_down(player, nil, nil, false)
|
||||
end
|
||||
|
||||
if not is_sp then
|
||||
update_formspecs(false)
|
||||
end
|
||||
|
||||
-- skip the night and let all players stand up
|
||||
if check_in_beds() then
|
||||
minetest.after(2, function()
|
||||
beds.skip_night()
|
||||
if not is_sp then
|
||||
update_formspecs(true)
|
||||
end
|
||||
beds.kick_players()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- callbacks
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
beds.read_spawns()
|
||||
end)
|
||||
|
||||
-- respawn player at bed if enabled and valid position is found
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
if not enable_respawn then
|
||||
return false
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local pos = beds.spawn[name] or nil
|
||||
if pos then
|
||||
player:setpos(pos)
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
lay_down(player, nil, nil, false, true)
|
||||
beds.player[name] = nil
|
||||
if check_in_beds() then
|
||||
minetest.after(2, function()
|
||||
beds.skip_night()
|
||||
update_formspecs(true)
|
||||
beds.kick_players()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "beds_form" then
|
||||
return
|
||||
end
|
||||
if fields.quit or fields.leave then
|
||||
lay_down(player, nil, nil, false)
|
||||
update_formspecs(false)
|
||||
end
|
||||
|
||||
if fields.force then
|
||||
beds.skip_night()
|
||||
update_formspecs(true)
|
||||
beds.kick_players()
|
||||
end
|
||||
end)
|
16
mods/beds/init.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
beds = {}
|
||||
beds.player = {}
|
||||
beds.pos = {}
|
||||
beds.spawn = {}
|
||||
|
||||
beds.formspec = "size[8,15;true]"..
|
||||
"bgcolor[#080808BB; true]"..
|
||||
"button_exit[2,12;4,0.75;leave;Leave Bed]"
|
||||
|
||||
local modpath = minetest.get_modpath("beds")
|
||||
|
||||
-- load files
|
||||
dofile(modpath.."/functions.lua")
|
||||
dofile(modpath.."/api.lua")
|
||||
dofile(modpath.."/beds.lua")
|
||||
dofile(modpath.."/spawns.lua")
|
58
mods/beds/spawns.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
local world_path = minetest.get_worldpath()
|
||||
local org_file = world_path .. "/beds_spawns"
|
||||
local file = world_path .. "/beds_spawns"
|
||||
local bkwd = false
|
||||
|
||||
-- check for PA's beds mod spawns
|
||||
local cf = io.open(world_path .. "/beds_player_spawns", "r")
|
||||
if cf ~= nil then
|
||||
io.close(cf)
|
||||
file = world_path .. "/beds_player_spawns"
|
||||
bkwd = true
|
||||
end
|
||||
|
||||
function beds.read_spawns()
|
||||
local spawns = beds.spawn
|
||||
local input = io.open(file, "r")
|
||||
if input and not bkwd then
|
||||
repeat
|
||||
local x = input:read("*n")
|
||||
if x == nil then
|
||||
break
|
||||
end
|
||||
local y = input:read("*n")
|
||||
local z = input:read("*n")
|
||||
local name = input:read("*l")
|
||||
spawns[name:sub(2)] = {x = x, y = y, z = z}
|
||||
until input:read(0) == nil
|
||||
io.close(input)
|
||||
elseif input and bkwd then
|
||||
beds.spawn = minetest.deserialize(input:read("*all"))
|
||||
input:close()
|
||||
beds.save_spawns()
|
||||
os.rename(file, file .. ".backup")
|
||||
file = org_file
|
||||
else
|
||||
spawns = {}
|
||||
end
|
||||
end
|
||||
|
||||
function beds.save_spawns()
|
||||
if not beds.spawn then
|
||||
return
|
||||
end
|
||||
local output = io.open(org_file, "w")
|
||||
for i, v in pairs(beds.spawn) do
|
||||
output:write(v.x.." "..v.y.." "..v.z.." "..i.."\n")
|
||||
end
|
||||
io.close(output)
|
||||
end
|
||||
|
||||
function beds.set_spawns()
|
||||
for name,_ in pairs(beds.player) do
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local p = player:getpos()
|
||||
beds.spawn[name] = p
|
||||
end
|
||||
beds.save_spawns()
|
||||
end
|
BIN
mods/beds/textures/beds_bed.png
Normal file
After Width: | Height: | Size: 540 B |
BIN
mods/beds/textures/beds_bed_fancy.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
mods/beds/textures/beds_bed_foot.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
mods/beds/textures/beds_bed_head.png
Normal file
After Width: | Height: | Size: 387 B |
BIN
mods/beds/textures/beds_bed_side1.png
Normal file
After Width: | Height: | Size: 296 B |
BIN
mods/beds/textures/beds_bed_side2.png
Normal file
After Width: | Height: | Size: 316 B |
BIN
mods/beds/textures/beds_bed_side_bottom.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
mods/beds/textures/beds_bed_side_bottom_r.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
mods/beds/textures/beds_bed_side_top.png
Normal file
After Width: | Height: | Size: 611 B |
BIN
mods/beds/textures/beds_bed_side_top_r.png
Normal file
After Width: | Height: | Size: 596 B |
BIN
mods/beds/textures/beds_bed_top1.png
Normal file
After Width: | Height: | Size: 583 B |
BIN
mods/beds/textures/beds_bed_top2.png
Normal file
After Width: | Height: | Size: 616 B |
BIN
mods/beds/textures/beds_bed_top_bottom.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
mods/beds/textures/beds_bed_top_top.png
Normal file
After Width: | Height: | Size: 556 B |
BIN
mods/beds/textures/beds_transparent.png
Normal file
After Width: | Height: | Size: 143 B |
|
@ -34,7 +34,7 @@ local boat = {
|
|||
physical = true,
|
||||
collisionbox = {-0.5, -0.4, -0.5, 0.5, 0.3, 0.5},
|
||||
visual = "mesh",
|
||||
mesh = "boat.x",
|
||||
mesh = "boat.obj",
|
||||
textures = {"default_wood.png"},
|
||||
|
||||
driver = nil,
|
||||
|
|
3111
mods/boats/models/boat.obj
Normal file
11110
mods/boats/models/boat.x
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 851 B |
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 546 B |
|
@ -105,7 +105,7 @@ end
|
|||
minetest.register_craftitem("bucket:bucket_empty", {
|
||||
description = "Empty Bucket",
|
||||
inventory_image = "bucket.png",
|
||||
stack_max = 1,
|
||||
stack_max = 99,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
|
@ -115,17 +115,41 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
|||
-- Check if pointing to a liquid source
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local liquiddef = bucket.liquids[node.name]
|
||||
if liquiddef ~= nil and liquiddef.itemname ~= nil and
|
||||
node.name == liquiddef.source then
|
||||
local item_count = user:get_wielded_item():get_count()
|
||||
|
||||
if liquiddef ~= nil
|
||||
and liquiddef.itemname ~= nil
|
||||
and node.name == liquiddef.source then
|
||||
if check_protection(pointed_thing.under,
|
||||
user:get_player_name(),
|
||||
"take ".. node.name) then
|
||||
return
|
||||
end
|
||||
|
||||
-- default set to return filled bucket
|
||||
local giving_back = liquiddef.itemname
|
||||
|
||||
-- check if holding more than 1 empty bucket
|
||||
if item_count > 1 then
|
||||
|
||||
-- if space in inventory add filled bucked, otherwise drop as item
|
||||
local inv = user:get_inventory()
|
||||
if inv:room_for_item("main", {name=liquiddef.itemname}) then
|
||||
inv:add_item("main", liquiddef.itemname)
|
||||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
core.add_item(pos, liquiddef.itemname)
|
||||
end
|
||||
|
||||
-- set to return empty buckets minus 1
|
||||
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
|
||||
|
||||
end
|
||||
|
||||
minetest.add_node(pointed_thing.under, {name="air"})
|
||||
|
||||
return ItemStack(liquiddef.itemname)
|
||||
return ItemStack(giving_back)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -131,6 +131,8 @@ BlockMen (CC BY-SA 3.0):
|
|||
default_chest_lock.png
|
||||
default_chest_side.png
|
||||
default_chest_top.png
|
||||
default_mineral_mese.png
|
||||
default_meselamp.png
|
||||
bubble.png
|
||||
heart.png
|
||||
gui_*.png
|
||||
|
|
|
@ -564,6 +564,14 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:meselamp 1',
|
||||
recipe = {
|
||||
{'', 'default:mese_crystal',''},
|
||||
{'default:mese_crystal', 'default:glass', 'default:mese_crystal'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'default:obsidian_shard 9',
|
||||
recipe = {
|
||||
|
|
|
@ -83,6 +83,7 @@ function default.node_sound_glass_defaults(table)
|
|||
return table
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
|
@ -102,8 +103,8 @@ minetest.register_abm({
|
|||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
default.cool_lava_flowing(pos, node, active_object_count, active_object_count_wider)
|
||||
action = function(...)
|
||||
default.cool_lava_flowing(...)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -112,37 +113,73 @@ minetest.register_abm({
|
|||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
default.cool_lava_source(pos, node, active_object_count, active_object_count_wider)
|
||||
action = function(...)
|
||||
default.cool_lava_source(...)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Papyrus and cactus growing
|
||||
--
|
||||
|
||||
function default.grow_cactus(pos, node)
|
||||
if node.param2 ~= 0 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y-1
|
||||
if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while node.name == "default:cactus" and height < 4 and node.param2 == 0 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 4
|
||||
or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name="default:cactus"})
|
||||
return true
|
||||
end
|
||||
|
||||
function default.grow_papyrus(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name ~= "default:dirt_with_grass"
|
||||
and name ~= "default:dirt" then
|
||||
return
|
||||
end
|
||||
if not minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while node.name == "default:papyrus" and height < 4 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
if height == 4
|
||||
or node.name ~= "air" then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name="default:papyrus"})
|
||||
return true
|
||||
end
|
||||
|
||||
-- wrapping the functions in abm action is necessary to make overriding them possible
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:cactus"},
|
||||
neighbors = {"group:sand"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if minetest.get_item_group(name, "sand") ~= 0 then
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "default:cactus" and height < 4 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="default:cactus"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
action = function(...)
|
||||
default.grow_cactus(...)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
|
@ -150,28 +187,12 @@ minetest.register_abm({
|
|||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 50,
|
||||
chance = 20,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "default:dirt" or name == "default:dirt_with_grass" then
|
||||
if minetest.find_node_near(pos, 3, {"group:water"}) == nil then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while minetest.get_node(pos).name == "default:papyrus" and height < 4 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name="default:papyrus"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
action = function(...)
|
||||
default.grow_papyrus(...)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- dig upwards
|
||||
--
|
||||
|
@ -185,6 +206,7 @@ function default.dig_up(pos, node, digger)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Leafdecay
|
||||
--
|
||||
|
|
BIN
mods/default/models/character.b3d
Normal file
|
@ -104,6 +104,9 @@ Liquids
|
|||
default:water_source
|
||||
default:water_flowing
|
||||
|
||||
default:river_water_source
|
||||
default:river_water_flowing
|
||||
|
||||
default:lava_source
|
||||
default:lava_flowing
|
||||
|
||||
|
@ -127,6 +130,8 @@ default:rail
|
|||
|
||||
default:brick
|
||||
|
||||
default:meselamp
|
||||
|
||||
Misc
|
||||
----
|
||||
default:cloud
|
||||
|
@ -351,7 +356,7 @@ minetest.register_node("default:snow", {
|
|||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_alias("snow", "default:snow")
|
||||
|
||||
|
||||
minetest.register_node("default:snowblock", {
|
||||
description = "Snow Block",
|
||||
|
@ -369,7 +374,7 @@ minetest.register_node("default:snowblock", {
|
|||
minetest.register_node("default:ice", {
|
||||
description = "Ice",
|
||||
tiles = {"default_ice.png"},
|
||||
is_ground_content = true,
|
||||
is_ground_content = false,
|
||||
paramtype = "light",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
|
@ -674,20 +679,24 @@ minetest.register_node("default:bronzeblock", {
|
|||
minetest.register_node("default:stone_with_mese", {
|
||||
description = "Mese Ore",
|
||||
tiles = {"default_stone.png^default_mineral_mese.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
groups = {cracky=1},
|
||||
groups = {cracky = 1},
|
||||
drop = "default:mese_crystal",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
light_source = 1,
|
||||
})
|
||||
|
||||
minetest.register_node("default:mese", {
|
||||
description = "Mese Block",
|
||||
tiles = {"default_mese_block.png"},
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
groups = {cracky=1,level=2},
|
||||
groups = {cracky = 1, level = 2},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
light_source = 3,
|
||||
})
|
||||
minetest.register_alias("default:mese_block", "default:mese")
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -893,6 +902,7 @@ minetest.register_node("default:water_source", {
|
|||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
|
@ -937,6 +947,7 @@ minetest.register_node("default:water_flowing", {
|
|||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
|
@ -948,6 +959,100 @@ minetest.register_node("default:water_flowing", {
|
|||
})
|
||||
|
||||
|
||||
minetest.register_node("default:river_water_source", {
|
||||
description = "River Water Source",
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name = "default_water_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "default_water_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
backface_culling = false,
|
||||
},
|
||||
},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "default:river_water_flowing",
|
||||
liquid_alternative_source = "default:river_water_source",
|
||||
liquid_viscosity = 1,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1},
|
||||
})
|
||||
|
||||
minetest.register_node("default:river_water_flowing", {
|
||||
description = "Flowing River Water",
|
||||
inventory_image = minetest.inventorycube("default_water.png"),
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"default_water.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
backface_culling = true,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "default:river_water_flowing",
|
||||
liquid_alternative_source = "default:river_water_source",
|
||||
liquid_viscosity = 1,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a=64, r=100, g=100, b=200},
|
||||
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("default:lava_source", {
|
||||
description = "Lava Source",
|
||||
|
@ -983,6 +1088,7 @@ minetest.register_node("default:lava_source", {
|
|||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
|
@ -1029,6 +1135,7 @@ minetest.register_node("default:lava_flowing", {
|
|||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
|
@ -1234,6 +1341,7 @@ minetest.register_node("default:chest_locked", {
|
|||
)
|
||||
end
|
||||
end,
|
||||
on_blast = function() end,
|
||||
})
|
||||
|
||||
|
||||
|
@ -1446,6 +1554,19 @@ minetest.register_node("default:brick", {
|
|||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("default:meselamp", {
|
||||
description = "Mese Lamp",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"default_meselamp.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
light_source = default.LIGHT_MAX,
|
||||
})
|
||||
|
||||
--
|
||||
-- Misc
|
||||
--
|
||||
|
|
|
@ -15,7 +15,7 @@ function default.player_register_model(name, def)
|
|||
end
|
||||
|
||||
-- Default player appearance
|
||||
default.player_register_model("character.x", {
|
||||
default.player_register_model("character.b3d", {
|
||||
animation_speed = 30,
|
||||
textures = {"character.png", },
|
||||
animations = {
|
||||
|
@ -93,7 +93,7 @@ end
|
|||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_model(player, "character.x")
|
||||
default.player_set_model(player, "character.b3d")
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
|
||||
-- set GUI
|
||||
|
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 583 B After Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 568 B After Width: | Height: | Size: 356 B |
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 314 B |
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 267 B |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 423 B |
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 469 B |
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 422 B |
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 272 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 608 B After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 647 B After Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 313 B |
Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 572 B |
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 558 B |
Before Width: | Height: | Size: 656 B After Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 578 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 859 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 179 B |
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 827 B After Width: | Height: | Size: 722 B |
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 347 B |
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 703 B After Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 744 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 224 B |