initial mods

master
Juraj Vajda 2021-03-14 14:18:43 -04:00
parent e12a82195d
commit 290687e195
1076 changed files with 30838 additions and 0 deletions

30
mods/beds/README.txt Normal file
View File

@ -0,0 +1,30 @@
Minetest Game mod: beds
=======================
See license.txt for license information.
Authors of source code
----------------------
Originally by BlockMen (MIT)
Various Minetest developers and contributors (MIT)
Authors of media (textures)
---------------------------
BlockMen (CC BY-SA 3.0)
All textures unless otherwise noted
TumeniNodes (CC BY-SA 3.0)
beds_bed_under.png
This mod adds a bed to Minetest which allows players to skip the night.
To sleep, right click on the bed. If playing in singleplayer mode the night gets skipped
immediately. If playing multiplayer you get shown how many other players are in bed too,
if all players are sleeping the night gets skipped. The night skip can be forced if more
than half of the players are lying in bed and use this option.
Another feature is a controlled 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.
You can disable the night skip feature by setting "enable_bed_night_skip = false" in
minetest.conf or by using the /set command in-game.

183
mods/beds/api.lua Normal file
View File

@ -0,0 +1,183 @@
local reverse = true
local function destruct_bed(pos, n)
local node = minetest.get_node(pos)
local other
if n == 2 then
local dir = minetest.facedir_to_dir(node.param2)
other = vector.subtract(pos, dir)
elseif n == 1 then
local dir = minetest.facedir_to_dir(node.param2)
other = vector.add(pos, dir)
end
if reverse then
reverse = not reverse
minetest.remove_node(other)
minetest.check_for_falling(other)
beds.remove_spawns_at(pos)
beds.remove_spawns_at(other)
else
reverse = not reverse
end
end
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",
is_ground_content = false,
stack_max = 1,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
sounds = def.sounds or default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = def.nodebox.bottom,
},
selection_box = {
type = "fixed",
fixed = def.selectionbox,
},
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
local pos
if udef and udef.buildable_to then
pos = under
else
pos = pointed_thing.above
end
local player_name = placer and placer:get_player_name() or ""
if minetest.is_protected(pos, player_name) and
not minetest.check_player_privs(player_name, "protection_bypass") then
minetest.record_protection_violation(pos, player_name)
return itemstack
end
local node_def = minetest.registered_nodes[minetest.get_node(pos).name]
if not node_def or not node_def.buildable_to then
return itemstack
end
local dir = placer and placer:get_look_dir() and
minetest.dir_to_facedir(placer:get_look_dir()) or 0
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))
if minetest.is_protected(botpos, player_name) and
not minetest.check_player_privs(player_name, "protection_bypass") then
minetest.record_protection_violation(botpos, player_name)
return itemstack
end
local botdef = minetest.registered_nodes[minetest.get_node(botpos).name]
if not botdef or not botdef.buildable_to then
return itemstack
end
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(player_name)) then
itemstack:take_item()
end
return itemstack
end,
on_destruct = function(pos)
destruct_bed(pos, 1)
end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
beds.on_rightclick(pos, clicker)
return itemstack
end,
on_rotate = function(pos, node, user, _, new_param2)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
local node2 = minetest.get_node_or_nil(p)
if not node2 or not minetest.get_item_group(node2.name, "bed") == 2 or
not node.param2 == node2.param2 then
return false
end
if minetest.is_protected(p, user:get_player_name()) then
minetest.record_protection_violation(p, user:get_player_name())
return false
end
if new_param2 % 32 > 3 then
return false
end
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
local node3 = minetest.get_node_or_nil(newp)
local node_def = node3 and minetest.registered_nodes[node3.name]
if not node_def or not node_def.buildable_to then
return false
end
if minetest.is_protected(newp, user:get_player_name()) then
minetest.record_protection_violation(newp, user:get_player_name())
return false
end
node.param2 = new_param2
-- do not remove_node here - it will trigger destroy_bed()
minetest.set_node(p, {name = "air"})
minetest.set_node(pos, node)
minetest.set_node(newp, {name = name .. "_top", param2 = new_param2})
return true
end,
can_dig = function(pos, player)
return beds.can_dig(pos)
end,
})
minetest.register_node(name .. "_top", {
drawtype = "nodebox",
tiles = def.tiles.top,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
pointable = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2,
not_in_creative_inventory = 1},
sounds = def.sounds or default.node_sound_wood_defaults(),
drop = name .. "_bottom",
node_box = {
type = "fixed",
fixed = def.nodebox.top,
},
on_destruct = function(pos)
destruct_bed(pos, 2)
end,
can_dig = function(pos, player)
local node = minetest.get_node(pos)
local dir = minetest.facedir_to_dir(node.param2)
local p = vector.add(pos, dir)
return beds.can_dig(p)
end,
})
minetest.register_alias(name, name .. "_bottom")
minetest.register_craft({
output = name,
recipe = def.recipe
})
end

109
mods/beds/beds.lua Normal file
View File

@ -0,0 +1,109 @@
-- beds/beds.lua
-- support for MT game translation.
local S = beds.get_translator
-- Fancy shaped bed
beds.register_bed("beds:fancy_bed", {
description = S("Fancy Bed"),
inventory_image = "beds_bed_fancy.png",
wield_image = "beds_bed_fancy.png",
tiles = {
bottom = {
"beds_bed_top1.png",
"beds_bed_under.png",
"beds_bed_side1.png",
"beds_bed_side1.png^[transformFX",
"beds_bed_foot.png",
"beds_bed_foot.png",
},
top = {
"beds_bed_top2.png",
"beds_bed_under.png",
"beds_bed_side2.png",
"beds_bed_side2.png^[transformFX",
"beds_bed_head.png",
"beds_bed_head.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:white", "wool:white", "wool:white"},
{"group:wood", "group:wood", "group:wood"},
},
})
-- Simple shaped bed
beds.register_bed("beds:bed", {
description = S("Simple Bed"),
inventory_image = "beds_bed.png",
wield_image = "beds_bed.png",
tiles = {
bottom = {
"beds_bed_top_bottom.png^[transformR90",
"beds_bed_under.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",
"beds_bed_under.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.0625, 0.5},
top = {-0.5, -0.5, -0.5, 0.5, 0.0625, 0.5},
},
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.0625, 1.5},
recipe = {
{"wool:white", "wool:white", "wool:white"},
{"group:wood", "group:wood", "group:wood"}
},
})
-- Aliases for PilzAdam's beds mod
minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom")
minetest.register_alias("beds:bed_top_red", "beds:bed_top")
-- Fuel
minetest.register_craft({
type = "fuel",
recipe = "beds:fancy_bed_bottom",
burntime = 13,
})
minetest.register_craft({
type = "fuel",
recipe = "beds:bed_bottom",
burntime = 12,
})

286
mods/beds/functions.lua Normal file
View File

@ -0,0 +1,286 @@
local pi = math.pi
local is_sp = minetest.is_singleplayer()
local enable_respawn = minetest.settings:get_bool("enable_bed_respawn")
if enable_respawn == nil then
enable_respawn = true
end
-- support for MT game translation.
local S = beds.get_translator
-- Helper functions
local function get_look_yaw(pos)
local rotation = minetest.get_node(pos).param2
if rotation > 3 then
rotation = rotation % 4 -- Mask colorfacedir values
end
if rotation == 1 then
return pi / 2, rotation
elseif rotation == 3 then
return -pi / 2, rotation
elseif rotation == 0 then
return pi, rotation
else
return 0, rotation
end
end
local function is_night_skip_enabled()
local enable_night_skip = minetest.settings:get_bool("enable_bed_night_skip")
if enable_night_skip == nil then
enable_night_skip = true
end
return enable_night_skip
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 #players > 0
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
beds.player[name] = nil
beds.bed_position[name] = nil
-- skip here to prevent sending player specific changes (used for leaving players)
if skip then
return
end
if p then
player:set_pos(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_horizontal(math.random(1, 180) / 100)
player_api.player_attached[name] = false
player:set_physics_override({speed = 1, jump = 1, gravity = 1})
hud_flags.wielditem = true
player_api.set_animation(player, "stand" , 30)
-- lay down
else
-- Check if bed is occupied
for _, other_pos in pairs(beds.bed_position) do
if vector.distance(bed_pos, other_pos) < 0.1 then
minetest.chat_send_player(name, S("This bed is already occupied!"))
return false
end
end
-- Check if player is moving
if vector.length(player:get_velocity()) > 0.001 then
minetest.chat_send_player(name, S("You have to stop moving before going to bed!"))
return false
end
beds.pos[name] = pos
beds.bed_position[name] = bed_pos
beds.player[name] = 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_horizontal(yaw)
local dir = minetest.facedir_to_dir(param2)
-- p.y is just above the nodebox height of the 'Simple Bed' (the highest bed),
-- to avoid sinking down through the bed.
local p = {
x = bed_pos.x + dir.x / 2,
y = bed_pos.y + 0.07,
z = bed_pos.z + dir.z / 2
}
player:set_physics_override({speed = 0, jump = 0, gravity = 0})
player:set_pos(p)
player_api.player_attached[name] = true
hud_flags.wielditem = false
player_api.set_animation(player, "lay" , 0)
end
player:hud_set_flags(hud_flags)
end
local function get_player_in_bed_count()
local c = 0
for _, _ in pairs(beds.player) do
c = c + 1
end
return c
end
local function update_formspecs(finished)
local ges = #minetest.get_connected_players()
local player_in_bed = get_player_in_bed_count()
local is_majority = (ges / 2) < player_in_bed
local form_n
local esc = minetest.formspec_escape
if finished then
form_n = beds.formspec .. "label[2.7,9;" .. esc(S("Good morning.")) .. "]"
else
form_n = beds.formspec .. "label[2.2,9;" ..
esc(S("@1 of @2 players are in bed", player_in_bed, ges)) .. "]"
if is_majority and is_night_skip_enabled() then
form_n = form_n .. "button_exit[2,6;4,0.75;force;" ..
esc(S("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)
end
function beds.on_rightclick(pos, player)
local name = player:get_player_name()
local ppos = player:get_pos()
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, S("You can only sleep at night."))
return
end
-- move to bed
if not beds.player[name] then
lay_down(player, ppos, pos)
beds.set_spawns() -- save respawn positions when entering bed
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()
if not is_sp then
update_formspecs(is_night_skip_enabled())
end
if is_night_skip_enabled() then
beds.skip_night()
beds.kick_players()
end
end)
end
end
function beds.can_dig(bed_pos)
-- Check all players in bed which one is at the expected position
for _, player_bed_pos in pairs(beds.bed_position) do
if vector.equals(bed_pos, player_bed_pos) then
return false
end
end
return true
end
-- Callbacks
-- Only register respawn callback if respawn enabled
if enable_respawn then
-- respawn player at bed if enabled and valid position is found
minetest.register_on_respawnplayer(function(player)
local name = player:get_player_name()
local pos = beds.spawn[name]
if pos then
player:set_pos(pos)
return true
end
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()
update_formspecs(is_night_skip_enabled())
if is_night_skip_enabled() then
beds.skip_night()
beds.kick_players()
end
end)
end
end)
minetest.register_on_dieplayer(function(player)
local name = player:get_player_name()
local in_bed = beds.player
local pos = player:get_pos()
local yaw = get_look_yaw(pos)
if in_bed[name] then
lay_down(player, nil, pos, false)
player:set_look_horizontal(yaw)
player:set_pos(pos)
end
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "beds_form" then
return
end
-- Because "Force night skip" button is a button_exit, it will set fields.quit
-- and lay_down call will change value of player_in_bed, so it must be taken
-- earlier.
local last_player_in_bed = get_player_in_bed_count()
if fields.quit or fields.leave then
lay_down(player, nil, nil, false)
update_formspecs(false)
end
if fields.force then
local is_majority = (#minetest.get_connected_players() / 2) < last_player_in_bed
if is_majority and is_night_skip_enabled() then
update_formspecs(true)
beds.skip_night()
beds.kick_players()
else
update_formspecs(false)
end
end
end)

26
mods/beds/init.lua Normal file
View File

@ -0,0 +1,26 @@
-- beds/init.lua
-- Load support for MT game translation.
local S = minetest.get_translator("beds")
local esc = minetest.formspec_escape
beds = {}
beds.player = {}
beds.bed_position = {}
beds.pos = {}
beds.spawn = {}
beds.get_translator = S
beds.formspec = "size[8,11;true]" ..
"no_prepend[]" ..
"bgcolor[#080808BB;true]" ..
"button_exit[2,10;4,0.75;leave;" .. esc(S("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")

61
mods/beds/license.txt Normal file
View File

@ -0,0 +1,61 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2014-2016 BlockMen
Copyright (C) 2014-2016 Various Minetest developers and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2014-2016 BlockMen
Copyright (C) 2018 TumeniNodes
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -0,0 +1,8 @@
# textdomain: beds
Fancy Bed=Schickes Bett
Simple Bed=Schlichtes Bett
Leave Bed=Bett verlassen
Good morning.=Guten Morgen.
@1 of @2 players are in bed=@1 von @2 Spielern sind im Bett
Force night skip=Überspringen der Nacht erzwingen
You can only sleep at night.=Sie können nur nachts schlafen.

View File

@ -0,0 +1,8 @@
# textdomain: beds
Fancy Bed=Cama de lujo
Simple Bed=Cama sencilla
Leave Bed=Abandonar cama
Good morning.=Buenos días.
@1 of @2 players are in bed=@1 de @2 jugadores están en cama
Force night skip=Forzar evitar noche
You can only sleep at night.=Sólo puedes dormir por la noche.

View File

@ -0,0 +1,8 @@
# textdomain: beds
Fancy Bed=Lit chic
Simple Bed=Lit simple
Leave Bed=Se lever du lit
Good morning.=Bonjour.
@1 of @2 players are in bed=@1 joueur(s) sur @2 sont au lit
Force night skip=Forcer le passage de la nuit
You can only sleep at night.=Vous ne pouvez dormir que la nuit.

View File

@ -0,0 +1,8 @@
# textdomain: beds
Leave Bed=Tinggalkan Dipan
Good morning.=Selamat pagi.
@1 of @2 players are in bed=@1 dari @2 pemain sedang tidur
Force night skip=Paksa lewati malam
You can only sleep at night.=Anda hanya boleh tidur pada waktu malam.
Fancy Bed=Dipan Mewah
Simple Bed=Dipan Sederhana

View File

@ -0,0 +1,4 @@
# textdomain: beds
Fancy Bed=Letto decorato
Simple Bed=Letto semplice
Leave Bed=Alzati dal letto

View File

@ -0,0 +1,8 @@
# textdomain: beds
Fancy Bed=Katil Beragam
Simple Bed=Katil Biasa
Leave Bed=Bangun
Good morning.=Selamat pagi.
@1 of @2 players are in bed=@1 daripada @2 pemain sedang tidur
Force night skip=Paksa langkau malam
You can only sleep at night.=Anda hanya boleh tidur pada waktu malam.

View File

@ -0,0 +1,8 @@
# textdomain: beds
Fancy Bed=Детализированная Кровать
Simple Bed=Обычная Кровать
Leave Bed=Встать с кровати
Good morning.=Доброе утро.
@1 of @2 players are in bed=@1 из @2 игроков в кровати
Force night skip=Пропустить ночь
You can only sleep at night.=Вы можете спать только ночью.

View File

@ -0,0 +1,8 @@
# textdomain: beds
Fancy Bed=Fin säng
Simple Bed=Enkel Säng
Leave Bed=Lämna Säng
Good morning.= God morgon.
@1 of @2 players are in bed=@1 av @2 spelar försöker sover.
Force night skip=Tvinga över natten
You can only sleep at night.=Du kan bara sova på natten.

View File

@ -0,0 +1,8 @@
# textdomain: beds
Leave Bed=Opusti posteľ
Good morning.=Dobré ráno.
@1 of @2 players are in bed=@1 z @2 hráčov sú v posteli
Force night skip=Nútene preskočiť noc
You can only sleep at night.=Môžeš spať len v noci.
Fancy Bed=Pekná posteľ
Simple Bed=Jednoduchá posteľ

View File

@ -0,0 +1,8 @@
# textdomain: beds
Fancy Bed=花式床
Simple Bed=简易床
Leave Bed=离开床
Good morning.=早安!
@1 of @2 players are in bed=@2位玩家中的@1位在床上
Force night skip=强制跳过夜晚
You can only sleep at night.=你只能在晚上睡觉。

View File

@ -0,0 +1,9 @@
# textdomain: beds
Fancy Bed=花式床
Simple Bed=簡易床
Leave Bed=離開床
Good morning.=早安!
@1 of @2 players are in bed=@2位玩家中的@1位在床上
Force night skip=強制跳過夜晚
You can only sleep at night.=你只能在晚上睡覺。

View File

@ -0,0 +1,8 @@
# textdomain: beds
Leave Bed=
Good morning.=
@1 of @2 players are in bed=
Force night skip=
You can only sleep at night.=
Fancy Bed=
Simple Bed=

3
mods/beds/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = beds
description = Minetest Game mod: beds
depends = default, wool

72
mods/beds/spawns.lua Normal file
View File

@ -0,0 +1,72 @@
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
end
end
beds.read_spawns()
function beds.save_spawns()
if not beds.spawn then
return
end
local data = {}
local output = io.open(org_file, "w")
for k, v in pairs(beds.spawn) do
table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, k))
end
output:write(table.concat(data))
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:get_pos()
-- but don't change spawn location if borrowing a bed
if not minetest.is_protected(p, name) then
beds.spawn[name] = p
end
end
beds.save_spawns()
end
function beds.remove_spawns_at(pos)
for name, p in pairs(beds.spawn) do
if vector.equals(vector.round(p), pos) then
beds.spawn[name] = nil
end
end
beds.save_spawns()
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

View File

@ -0,0 +1,37 @@
Minetest Game mod: binoculars
=============================
See license.txt for license information.
Authors of source code
----------------------
paramat (MIT)
Authors of media (textures)
---------------------------
paramat (CC BY-SA 3.0):
binoculars_binoculars.png
Crafting
--------
binoculars:binoculars
default:obsidian_glass O
default:bronze_ingot B
O_O
BBB
O_O
Usage
-----
In survival mode, use of zoom requires the binoculars item in your inventory,
they will allow a 10 degree field of view.
It can take up to 5 seconds for adding to or removal from inventory to have an
effect, however to instantly allow the use of this zoom 'use' (leftclick) the
item.
Zoom with a field of view of 15 degrees is automatically allowed in creative
mode and for any player with the 'creative' privilege.
The 'binoculars.update_player_property()' function is global so can be
redefined by a mod for alternative behaviour.

81
mods/binoculars/init.lua Normal file
View File

@ -0,0 +1,81 @@
-- binoculars/init.lua
-- Mod global namespace
binoculars = {}
-- Load support for MT game translation.
local S = minetest.get_translator("binoculars")
-- Detect creative mod
local creative_mod = minetest.get_modpath("creative")
-- Cache creative mode setting as fallback if creative mod not present
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
-- Update player property
-- Global to allow overriding
function binoculars.update_player_property(player)
local creative_enabled =
(creative_mod and creative.is_enabled_for(player:get_player_name())) or
creative_mode_cache
local new_zoom_fov = 0
if player:get_inventory():contains_item(
"main", "binoculars:binoculars") then
new_zoom_fov = 10
elseif creative_enabled then
new_zoom_fov = 15
end
-- Only set property if necessary to avoid player mesh reload
if player:get_properties().zoom_fov ~= new_zoom_fov then
player:set_properties({zoom_fov = new_zoom_fov})
end
end
-- Set player property 'on joinplayer'
minetest.register_on_joinplayer(function(player)
binoculars.update_player_property(player)
end)
-- Cyclic update of player property
local function cyclic_update()
for _, player in ipairs(minetest.get_connected_players()) do
binoculars.update_player_property(player)
end
minetest.after(4.7, cyclic_update)
end
minetest.after(4.7, cyclic_update)
-- Binoculars item
minetest.register_craftitem("binoculars:binoculars", {
description = S("Binoculars") .. "\n" .. S("Use with 'Zoom' key"),
inventory_image = "binoculars_binoculars.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
binoculars.update_player_property(user)
end,
})
-- Crafting
minetest.register_craft({
output = "binoculars:binoculars",
recipe = {
{"default:obsidian_glass", "", "default:obsidian_glass"},
{"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"},
{"default:obsidian_glass", "", "default:obsidian_glass"},
}
})

View File

@ -0,0 +1,59 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2017 paramat
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2017 paramat
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Fernglas
Use with 'Zoom' key=Mit „Zoom“-Taste benutzen

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Prismáticos
Use with 'Zoom' key=Usar con la tecla 'Zoom'

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Jumelles
Use with 'Zoom' key=Utiliser avec le bouton « Zoom »

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Binokular
Use with 'Zoom' key=Pakai dengan tombol 'Zum'

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Binocolo
Use with 'Zoom' key=Usalo col tasto 'Ingrandimento'

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Binokular
Use with 'Zoom' key=Guna dengan kekunci 'Zum'

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Бинокль
Use with 'Zoom' key=Используется с привилегией 'Zoom'

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Kikare
Use with 'Zoom' key=Används med 'Zoom' knappen

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=Ďalekohľad
Use with 'Zoom' key=Použi s klávesou "Priblíž"

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=望远镜
Use with 'Zoom' key=与“缩放”键一起使用

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=望遠鏡
Use with 'Zoom' key=與“縮放”鍵一起使用

View File

@ -0,0 +1,3 @@
# textdomain: binoculars
Binoculars=
Use with 'Zoom' key=

4
mods/binoculars/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = binoculars
description = Minetest Game mod: binoculars
depends = default
optional_depends = creative

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

31
mods/boats/README.txt Normal file
View File

@ -0,0 +1,31 @@
Minetest Game mod: boats
========================
See license.txt for license information.
Authors of source code
----------------------
Originally by PilzAdam (MIT)
Various Minetest developers and contributors (MIT)
Authors of media (textures and model)
-------------------------------------
Textures: Zeg9 (CC BY-SA 3.0)
Model: thetoon and Zeg9 (CC BY-SA 3.0),
modified by PavelS(SokolovPavel) (CC BY-SA 3.0),
modified by sofar (CC BY-SA 3.0)
Controls
--------
Right mouse button = Enter or exit boat when pointing at boat.
Forward = Speed up.
Slow down when moving backwards.
Forward + backward = Enable cruise mode: Boat will accelerate to maximum forward
speed and remain at that speed without needing to hold the
forward key.
Backward = Slow down.
Speed up when moving backwards.
Disable cruise mode.
Left = Turn to the left.
Turn to the right when moving backwards.
Right = Turn to the right.
Turn to the left when moving backwards.

294
mods/boats/init.lua Normal file
View File

@ -0,0 +1,294 @@
-- boats/init.lua
-- Load support for MT game translation.
local S = minetest.get_translator("boats")
--
-- Helper functions
--
local function is_water(pos)
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_velocity(v, yaw, y)
local x = -math.sin(yaw) * v
local z = math.cos(yaw) * v
return {x = x, y = y, z = z}
end
local function get_v(v)
return math.sqrt(v.x ^ 2 + v.z ^ 2)
end
--
-- Boat entity
--
local boat = {
initial_properties = {
physical = true,
-- Warning: Do not change the position of the collisionbox top surface,
-- lowering it causes the boat to fall through the world if underwater
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
mesh = "boats_boat.obj",
textures = {"default_wood.png"},
},
driver = nil,
v = 0,
last_v = 0,
removed = false,
auto = false
}
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
end
local name = clicker:get_player_name()
if self.driver and name == self.driver then
self.driver = nil
self.auto = false
clicker:set_detach()
player_api.player_attached[name] = false
player_api.set_animation(clicker, "stand" , 30)
local pos = clicker:get_pos()
pos = {x = pos.x, y = pos.y + 0.2, z = pos.z}
minetest.after(0.1, function()
clicker:set_pos(pos)
end)
elseif not self.driver then
local attach = clicker:get_attach()
if attach and attach:get_luaentity() then
local luaentity = attach:get_luaentity()
if luaentity.driver then
luaentity.driver = nil
end
clicker:set_detach()
end
self.driver = name
clicker:set_attach(self.object, "",
{x = 0.5, y = 1, z = -3}, {x = 0, y = 0, z = 0})
player_api.player_attached[name] = true
minetest.after(0.2, function()
player_api.set_animation(clicker, "sit" , 30)
end)
clicker:set_look_horizontal(self.object:get_yaw())
end
end
-- If driver leaves server while driving boat
function boat.on_detach_child(self, child)
self.driver = nil
self.auto = false
end
function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal = 1})
if staticdata then
self.v = tonumber(staticdata)
end
self.last_v = self.v
end
function boat.get_staticdata(self)
return tostring(self.v)
end
function boat.on_punch(self, puncher)
if not puncher or not puncher:is_player() or self.removed then
return
end
local name = puncher:get_player_name()
if self.driver and name == self.driver then
self.driver = nil
puncher:set_detach()
player_api.player_attached[name] = false
end
if not self.driver then
self.removed = true
local inv = puncher:get_inventory()
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(name))
or not inv:contains_item("main", "boats:boat") then
local leftover = inv:add_item("main", "boats:boat")
-- if no room in inventory add a replacement boat to the world
if not leftover:is_empty() then
minetest.add_item(self.object:get_pos(), leftover)
end
end
-- delay remove to ensure player is detached
minetest.after(0.1, function()
self.object:remove()
end)
end
end
function boat.on_step(self, dtime)
self.v = get_v(self.object:get_velocity()) * math.sign(self.v)
if self.driver then
local driver_objref = minetest.get_player_by_name(self.driver)
if driver_objref then
local ctrl = driver_objref:get_player_control()
if ctrl.up and ctrl.down then
if not self.auto then
self.auto = true
minetest.chat_send_player(self.driver, S("Boat cruise mode on"))
end
elseif ctrl.down then
self.v = self.v - dtime * 2.0
if self.auto then
self.auto = false
minetest.chat_send_player(self.driver, S("Boat cruise mode off"))
end
elseif ctrl.up or self.auto then
self.v = self.v + dtime * 2.0
end
if ctrl.left then
if self.v < -0.001 then
self.object:set_yaw(self.object:get_yaw() - dtime * 0.9)
else
self.object:set_yaw(self.object:get_yaw() + dtime * 0.9)
end
elseif ctrl.right then
if self.v < -0.001 then
self.object:set_yaw(self.object:get_yaw() + dtime * 0.9)
else
self.object:set_yaw(self.object:get_yaw() - dtime * 0.9)
end
end
end
end
local velo = self.object:get_velocity()
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
self.object:set_pos(self.object:get_pos())
return
end
-- We need to preserve velocity sign to properly apply drag force
-- while moving backward
local drag = dtime * math.sign(self.v) * (0.01 + 0.0796 * self.v * self.v)
-- If drag is larger than velocity, then stop horizontal movement
if math.abs(self.v) <= math.abs(drag) then
self.v = 0
else
self.v = self.v - drag
end
local p = self.object:get_pos()
p.y = p.y - 0.5
local new_velo
local new_acce = {x = 0, y = 0, z = 0}
if not is_water(p) then
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
if (not nodedef) or nodedef.walkable then
self.v = 0
new_acce = {x = 0, y = 1, z = 0}
else
new_acce = {x = 0, y = -9.8, z = 0}
end
new_velo = get_velocity(self.v, self.object:get_yaw(),
self.object:get_velocity().y)
self.object:set_pos(self.object:get_pos())
else
p.y = p.y + 1
if is_water(p) then
local y = self.object:get_velocity().y
if y >= 5 then
y = 5
elseif y < 0 then
new_acce = {x = 0, y = 20, z = 0}
else
new_acce = {x = 0, y = 5, z = 0}
end
new_velo = get_velocity(self.v, self.object:get_yaw(), y)
self.object:set_pos(self.object:get_pos())
else
new_acce = {x = 0, y = 0, z = 0}
if math.abs(self.object:get_velocity().y) < 1 then
local pos = self.object:get_pos()
pos.y = math.floor(pos.y) + 0.5
self.object:set_pos(pos)
new_velo = get_velocity(self.v, self.object:get_yaw(), 0)
else
new_velo = get_velocity(self.v, self.object:get_yaw(),
self.object:get_velocity().y)
self.object:set_pos(self.object:get_pos())
end
end
end
self.object:set_velocity(new_velo)
self.object:set_acceleration(new_acce)
end
minetest.register_entity("boats:boat", boat)
minetest.register_craftitem("boats:boat", {
description = S("Boat"),
inventory_image = "boats_inventory.png",
wield_image = "boats_wield.png",
wield_scale = {x = 2, y = 2, z = 1},
liquids_pointable = true,
groups = {flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if pointed_thing.type ~= "node" then
return itemstack
end
if not is_water(pointed_thing.under) then
return itemstack
end
pointed_thing.under.y = pointed_thing.under.y + 0.5
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
if boat then
if placer then
boat:set_yaw(placer:get_look_horizontal())
end
local player_name = placer and placer:get_player_name() or ""
if not (creative and creative.is_enabled_for and
creative.is_enabled_for(player_name)) then
itemstack:take_item()
end
end
return itemstack
end,
})
minetest.register_craft({
output = "boats:boat",
recipe = {
{"", "", "" },
{"group:wood", "", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
},
})
minetest.register_craft({
type = "fuel",
recipe = "boats:boat",
burntime = 20,
})

63
mods/boats/license.txt Normal file
View File

@ -0,0 +1,63 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2012-2016 PilzAdam
Copyright (C) 2012-2016 Various Minetest developers and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures and model)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2012-2016 Zeg9
Copyright (C) 2012-2016 thetoon
Copyright (C) 2012-2016 PavelS(SokolovPavel)
Copyright (C) 2016 sofar (sofar@foo-projects.org)
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Schneller Bootsmodus an
Boat cruise mode off=Schneller Bootsmodus aus
Boat=Boot

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Modo crucero en bote activado
Boat cruise mode off=Modo crucero en bote desactivado
Boat=Bote

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Bateau mode rapide activé
Boat cruise mode off=Bateau mode rapide désactivé
Boat=Bateau

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Mode perahu jelajah nyala
Boat cruise mode off=Mode perahu jelajah mati
Boat=Perahu

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Modalità movimento automatico barca attivata
Boat cruise mode off=Modalità movimento automatico barca disattivata
Boat=Barca

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Mod bot layar makan angin dibolehkan
Boat cruise mode off=Mod bot layar makan angin dilumpuhkan
Boat=Bot

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Режим путешествия на лодке включен
Boat cruise mode off=Режим путешествия на лодке выключен
Boat=Лодка

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Båtkryssningsläge på
Boat cruise mode off=Båtkryssningsläge av
Boat=Båt

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=Cestovný režim loďky zapnutý
Boat cruise mode off=Cestovný režim loďky vypnutý
Boat=Loďka

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=巡航模式开启
Boat cruise mode off=巡航模式关闭
Boat=船

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=巡航模式開啟
Boat cruise mode off=巡航模式關閉
Boat=船

View File

@ -0,0 +1,4 @@
# textdomain: boats
Boat cruise mode on=
Boat cruise mode off=
Boat=

3
mods/boats/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = boats
description = Minetest Game mod: boats
depends = default, player_api

View File

@ -0,0 +1,358 @@
# Blender v2.76 (sub 11) OBJ File: 'boat.blend'
# www.blender.org
mtllib boat.mtl
o boats_boat
v -6.786140 -3.033999 -9.415440
v -6.786140 -1.967150 -9.415440
v -6.786140 -1.967150 8.793510
v -6.786140 -3.033999 8.793510
v 5.732520 -1.967150 -9.415440
v 5.732520 -3.033999 -9.415440
v 5.732520 -3.033999 8.793510
v 5.732520 -1.967150 8.793510
v -2.233900 -3.033999 -9.415440
v -2.233900 -1.967150 -9.415440
v -2.233900 -1.967150 8.793510
v -2.233900 -3.033999 8.793510
v 2.318340 -3.033999 -9.415440
v 2.318340 -1.967150 -9.415440
v 2.318340 -1.967150 8.793510
v 2.318340 -3.033999 8.793510
v -3.371960 -3.033999 8.793510
v -3.371960 -1.967150 8.793510
v -3.371960 -1.967150 -9.415440
v -3.371960 -3.033999 -9.415440
v 2.318340 0.276645 8.793510
v 1.180280 -1.967150 8.793510
v 5.732520 0.276645 8.793510
v 5.732520 1.039180 8.793510
v 6.870580 0.276645 8.793510
v 6.870580 -1.967150 8.793510
v 2.318340 1.039180 8.793510
v 1.180280 0.276645 8.793510
v 1.180280 1.039180 8.793510
v 1.180280 -3.033999 8.793510
v -2.233900 0.276645 8.793510
v -3.371960 0.276645 8.793510
v -2.233900 1.039180 8.793510
v -3.371960 1.039180 8.793510
v -6.786140 0.276645 8.793510
v -7.786200 0.276645 8.793510
v -7.786200 -1.967150 8.793510
v -6.786140 1.039180 8.793510
v 1.180280 -1.967150 -9.415440
v 1.180280 -3.033999 -9.415440
v 2.318340 0.276645 -9.415440
v 1.180280 0.276645 -9.415440
v 2.318340 1.039180 -9.415440
v 5.732520 0.276645 -9.415440
v 6.870580 -1.967150 -9.415440
v 5.732520 1.039180 -9.415440
v 6.870580 0.276645 -9.415440
v 0.042220 1.039180 -9.415440
v 1.180280 1.039180 -9.415440
v 0.042220 -1.967150 -9.415440
v -1.095840 -1.967150 -9.415440
v -2.233900 0.276645 -9.415440
v -3.371960 0.276645 -9.415440
v -2.233900 1.039180 -9.415440
v -1.095840 1.039180 -9.415440
v -3.371960 1.039180 -9.415440
v -6.786140 0.276645 -9.415440
v -6.786140 1.039180 -9.415440
v -7.786200 -1.967150 -9.415440
v -7.786200 0.276645 -9.415440
v -1.095840 0.156645 -12.044100
v -1.095840 -4.601110 -9.415440
v -1.095840 1.039181 -10.802900
v -1.095840 2.868579 -10.802900
v -1.095840 2.868580 -7.883420
v -1.095840 3.746069 -12.034100
v -1.095840 3.746070 -7.883420
v -1.095840 0.156645 -14.294900
v -1.095840 -4.601110 -14.284900
v 0.042220 -4.601110 -14.284900
v 0.042220 -4.601110 -9.415440
v 0.042220 1.039181 -10.802900
v 0.042220 0.156645 -12.044100
v 0.042220 2.868579 -10.802900
v 0.042220 0.156645 -14.294900
v 0.042220 3.746069 -12.034100
v 0.042220 3.746070 -7.883420
v 0.042220 2.868580 -7.883420
v -1.096322 -3.033999 -9.415440
v 0.044046 -3.035397 -9.415440
vt 1.000000 0.187500
vt -1.000000 0.312500
vt 1.000000 0.312500
vt 0.687500 1.000000
vt 0.500000 0.875000
vt 0.500000 0.625000
vt -1.000000 0.062500
vt 1.000000 0.062500
vt 1.000000 -0.000000
vt -1.000000 0.125000
vt 1.000000 0.125000
vt 0.437500 0.125000
vt 0.312500 0.500000
vt 0.312500 0.125000
vt 1.000000 0.625000
vt -1.000000 0.500000
vt 1.000000 0.500000
vt 0.187500 0.687500
vt -0.187500 0.687500
vt -0.187500 0.312500
vt 1.000000 0.812500
vt -1.000000 0.937500
vt -1.000000 0.812500
vt 0.812500 0.687500
vt 1.187500 0.687500
vt 0.812500 0.312500
vt 1.000000 0.562500
vt 0.312500 0.437500
vt 1.000000 0.437500
vt 1.000000 0.750000
vt -1.000000 0.875000
vt -1.000000 0.750000
vt -1.000000 1.000000
vt 1.000000 1.000000
vt 0.437500 0.625000
vt 0.562500 0.437500
vt 0.562500 0.625000
vt -1.000000 0.437500
vt -1.000000 0.000000
vt 0.500000 0.062500
vt 0.375000 0.750000
vt 0.500000 0.750000
vt -1.000000 0.250000
vt -1.000000 0.687500
vt 1.000000 0.687500
vt 0.625000 0.375000
vt 1.000000 0.375000
vt 1.000000 0.250000
vt 1.000000 0.937500
vt 0.437500 0.812500
vt 0.312500 0.312500
vt 0.312500 0.812500
vt 0.437500 0.312500
vt 0.437500 0.437500
vt 0.687500 0.812500
vt 0.000000 0.687500
vt 0.000000 0.812500
vt -1.000000 0.562500
vt 0.875000 0.812500
vt 0.875000 0.687500
vt 0.250000 0.312500
vt 0.562500 0.187500
vt 0.250000 0.187500
vt -1.000000 0.187500
vt 0.312500 0.625000
vt 0.312500 0.187500
vt 0.312500 -0.187500
vt 1.000000 -0.187500
vt 0.687500 0.500000
vt -0.000000 1.000000
vt 0.000000 0.875000
vt 0.437500 0.500000
vt -1.000000 0.625000
vt 0.812500 0.187500
vt 1.187500 0.187500
vt 1.187500 0.312500
vt 1.312500 0.312500
vt 1.312500 0.687500
vt 0.687500 0.187500
vt 0.687500 0.312500
vt 1.187500 0.812500
vt 0.812500 0.812500
vt 0.187500 0.312500
vt 0.312500 0.687500
vt 0.687500 0.687500
vt -0.187500 0.187500
vt 0.187500 0.187500
vt -0.312500 0.687500
vt -0.312500 0.312500
vt 0.187500 0.812500
vt -0.187500 0.812500
vt 0.437500 0.687500
vt 0.437500 0.187500
vt 0.562500 0.812500
vt 0.562500 0.687500
vt 0.312500 0.562500
vt 1.000000 0.875000
vt 0.375000 0.062500
vt -1.000000 0.375000
vt 0.625000 0.500000
vt 0.875000 0.562500
vt 0.937500 0.812500
vt 0.937500 0.687500
vt 0.875000 0.937500
vt 0.562500 0.312500
vn -1.000000 0.000000 0.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 -1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 -0.002100 -1.000000
vn 0.001200 -1.000000 0.000000
vn 0.000000 0.002800 -1.000000
vn -0.001200 -1.000000 0.000200
g boats_boat_boats_boat_None
usemtl None
s off
f 41/1/1 27/2/1 43/3/1
f 76/4/2 74/5/2 72/6/2
f 8/7/2 6/1/2 5/8/2
f 15/9/1 13/10/1 16/11/1
f 51/12/3 71/13/3 50/14/3
f 56/15/2 32/16/2 53/17/2
f 15/18/3 8/19/3 23/20/3
f 22/21/2 40/22/2 39/23/2
f 19/24/4 2/25/4 53/26/4
f 70/27/5 62/28/5 69/29/5
f 11/30/5 19/31/5 10/32/5
f 4/15/5 20/33/5 17/34/5
f 72/35/3 64/36/3 63/37/3
f 13/8/5 7/38/5 16/7/5
f 23/39/6 47/11/6 44/9/6
f 68/40/7 70/41/7 69/42/7
f 80/43/8 40/10/8 30/11/8
f 3/15/1 1/32/1 4/30/1
f 20/44/2 18/27/2 17/45/2
f 74/17/5 65/46/5 64/47/5
f 31/43/1 54/47/1 52/48/1
f 22/47/5 14/43/5 15/48/5
f 46/1/2 23/7/2 44/8/2
f 57/21/1 38/22/1 58/49/1
f 61/50/9 76/51/9 73/52/9
f 37/45/5 2/23/5 3/21/5
f 78/28/3 67/53/3 65/54/3
f 64/5/1 66/4/1 63/6/1
f 76/55/6 67/56/6 77/57/6
f 47/17/2 26/10/2 45/11/2
f 5/16/5 26/47/5 8/17/5
f 33/58/6 48/59/6 55/60/6
f 29/38/2 42/3/2 49/29/2
f 32/44/6 52/21/6 53/45/6
f 58/15/6 34/33/6 56/34/6
f 27/7/6 46/29/6 43/8/6
f 73/61/6 68/62/6 61/63/6
f 21/58/6 42/29/6 28/38/6
f 11/29/1 9/58/1 12/27/1
f 59/45/1 36/2/1 60/3/1
f 60/9/6 35/10/6 57/11/6
f 41/1/1 21/64/1 27/2/1
f 72/6/2 48/65/2 50/66/2
f 50/66/2 71/67/2 70/68/2
f 70/68/2 75/17/2 73/69/2
f 76/4/2 77/70/2 74/5/2
f 77/70/2 78/71/2 74/5/2
f 50/66/2 70/68/2 73/69/2
f 73/69/2 76/4/2 72/6/2
f 72/6/2 50/66/2 73/69/2
f 8/7/2 7/64/2 6/1/2
f 15/9/1 14/39/1 13/10/1
f 51/12/3 62/72/3 71/13/3
f 56/15/2 34/73/2 32/16/2
f 32/26/3 34/74/3 38/75/3
f 35/76/3 36/77/3 37/78/3
f 32/26/3 38/75/3 35/76/3
f 29/66/3 33/79/3 31/80/3
f 32/26/3 35/76/3 3/25/3
f 28/51/3 29/66/3 31/80/3
f 31/80/3 32/26/3 18/24/3
f 3/25/3 4/81/3 17/82/3
f 35/76/3 37/78/3 3/25/3
f 21/83/3 28/51/3 22/84/3
f 3/25/3 17/82/3 18/24/3
f 11/85/3 12/55/3 30/52/3
f 32/26/3 3/25/3 18/24/3
f 11/85/3 30/52/3 22/84/3
f 31/80/3 18/24/3 11/85/3
f 24/86/3 27/87/3 21/83/3
f 28/51/3 31/80/3 11/85/3
f 11/85/3 22/84/3 28/51/3
f 24/86/3 21/83/3 23/20/3
f 26/88/3 25/89/3 23/20/3
f 23/20/3 21/83/3 15/18/3
f 15/18/3 16/90/3 7/91/3
f 21/83/3 22/84/3 15/18/3
f 8/19/3 26/88/3 23/20/3
f 15/18/3 7/91/3 8/19/3
f 22/21/2 30/49/2 40/22/2
f 47/89/4 45/88/4 5/19/4
f 5/19/4 6/91/4 13/90/4
f 5/19/4 13/90/4 14/18/4
f 44/20/4 47/89/4 5/19/4
f 43/87/4 46/86/4 44/20/4
f 41/83/4 43/87/4 44/20/4
f 44/20/4 5/19/4 14/18/4
f 39/84/4 40/52/4 80/50/4
f 44/20/4 14/18/4 41/83/4
f 42/51/4 41/83/4 39/84/4
f 39/84/4 80/50/4 50/92/4
f 41/83/4 14/18/4 39/84/4
f 48/93/4 49/66/4 42/51/4
f 50/92/4 48/93/4 42/51/4
f 80/50/4 79/94/4 50/92/4
f 50/92/4 42/51/4 39/84/4
f 54/79/4 55/62/4 52/80/4
f 50/92/4 79/94/4 51/95/4
f 52/80/4 55/62/4 51/95/4
f 51/95/4 79/94/4 10/85/4
f 79/94/4 9/55/4 10/85/4
f 53/26/4 52/80/4 10/85/4
f 58/75/4 56/74/4 53/26/4
f 59/78/4 60/77/4 57/76/4
f 57/76/4 58/75/4 53/26/4
f 52/80/4 51/95/4 10/85/4
f 19/24/4 20/82/4 1/81/4
f 53/26/4 10/85/4 19/24/4
f 59/78/4 57/76/4 2/25/4
f 19/24/4 1/81/4 2/25/4
f 2/25/4 57/76/4 53/26/4
f 70/27/5 71/96/5 62/28/5
f 11/30/5 18/97/5 19/31/5
f 4/15/5 1/73/5 20/33/5
f 72/35/3 74/54/3 64/36/3
f 13/8/5 6/29/5 7/38/5
f 23/39/6 25/10/6 47/11/6
f 68/40/7 75/98/7 70/41/7
f 30/11/5 12/17/5 79/99/5
f 79/99/10 80/43/10 30/11/10
f 12/17/5 9/16/5 79/99/5
f 3/15/1 2/73/1 1/32/1
f 20/44/2 19/58/2 18/27/2
f 74/17/5 78/100/5 65/46/5
f 31/43/1 33/99/1 54/47/1
f 22/47/5 39/99/5 14/43/5
f 46/1/2 24/64/2 23/7/2
f 57/21/1 35/23/1 38/22/1
f 61/50/9 66/53/9 76/51/9
f 37/45/5 59/44/5 2/23/5
f 78/28/3 77/51/3 67/53/3
f 62/67/1 51/66/1 69/68/1
f 51/66/1 55/65/1 63/6/1
f 68/17/1 69/68/1 61/69/1
f 61/69/1 69/68/1 51/66/1
f 61/69/1 51/66/1 63/6/1
f 65/71/1 67/70/1 64/5/1
f 61/69/1 63/6/1 66/4/1
f 64/5/1 67/70/1 66/4/1
f 76/55/6 66/85/6 67/56/6
f 47/17/2 25/16/2 26/10/2
f 5/16/5 45/99/5 26/47/5
f 55/60/6 54/101/6 33/58/6
f 33/58/6 29/22/6 48/59/6
f 48/59/6 72/102/6 63/103/6
f 29/22/6 49/104/6 48/59/6
f 48/59/6 63/103/6 55/60/6
f 29/38/2 28/2/2 42/3/2
f 32/44/6 31/23/6 52/21/6
f 58/15/6 38/73/6 34/33/6
f 27/7/6 24/38/6 46/29/6
f 73/61/6 75/105/6 68/62/6
f 21/58/6 41/27/6 42/29/6
f 11/29/1 10/38/1 9/58/1
f 59/45/1 37/44/1 36/2/1
f 60/9/6 36/39/6 35/10/6

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

12
mods/bones/README.txt Normal file
View File

@ -0,0 +1,12 @@
Minetest Game mod: bones
========================
See license.txt for license information.
Authors of source code
----------------------
Originally by PilzAdam (MIT)
Various Minetest developers and contributors (MIT)
Authors of media (textures)
---------------------------
All textures: paramat (CC BY-SA 3.0)

284
mods/bones/init.lua Normal file
View File

@ -0,0 +1,284 @@
-- bones/init.lua
-- Minetest 0.4 mod: bones
-- See README.txt for licensing and other information.
-- Load support for MT game translation.
local S = minetest.get_translator("bones")
bones = {}
local function is_owner(pos, name)
local owner = minetest.get_meta(pos):get_string("owner")
if owner == "" or owner == name or minetest.check_player_privs(name, "protection_bypass") then
return true
end
return false
end
local bones_formspec =
"size[8,9]" ..
"list[current_name;main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[current_name;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
local share_bones_time = tonumber(minetest.settings:get("share_bones_time")) or 1200
local share_bones_time_early = tonumber(minetest.settings:get("share_bones_time_early")) or share_bones_time / 4
minetest.register_node("bones:bones", {
description = S("Bones"),
tiles = {
"bones_top.png^[transform2",
"bones_bottom.png",
"bones_side.png",
"bones_side.png",
"bones_rear.png",
"bones_front.png"
},
paramtype2 = "facedir",
groups = {dig_immediate = 2},
sounds = default.node_sound_gravel_defaults(),
can_dig = function(pos, player)
local inv = minetest.get_meta(pos):get_inventory()
local name = ""
if player then
name = player:get_player_name()
end
return is_owner(pos, name) and inv:is_empty("main")
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if is_owner(pos, player:get_player_name()) then
return count
end
return 0
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if is_owner(pos, player:get_player_name()) then
return stack:get_count()
end
return 0
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
if meta:get_inventory():is_empty("main") then
local inv = player:get_inventory()
if inv:room_for_item("main", {name = "bones:bones"}) then
inv:add_item("main", {name = "bones:bones"})
else
minetest.add_item(pos, "bones:bones")
end
minetest.remove_node(pos)
end
end,
on_punch = function(pos, node, player)
if not is_owner(pos, player:get_player_name()) then
return
end
if minetest.get_meta(pos):get_string("infotext") == "" then
return
end
local inv = minetest.get_meta(pos):get_inventory()
local player_inv = player:get_inventory()
local has_space = true
for i = 1, inv:get_size("main") do
local stk = inv:get_stack("main", i)
if player_inv:room_for_item("main", stk) then
inv:set_stack("main", i, nil)
player_inv:add_item("main", stk)
else
has_space = false
break
end
end
-- remove bones if player emptied them
if has_space then
if player_inv:room_for_item("main", {name = "bones:bones"}) then
player_inv:add_item("main", {name = "bones:bones"})
else
minetest.add_item(pos,"bones:bones")
end
minetest.remove_node(pos)
end
end,
on_timer = function(pos, elapsed)
local meta = minetest.get_meta(pos)
local time = meta:get_int("time") + elapsed
if time >= share_bones_time then
meta:set_string("infotext", S("@1's old bones", meta:get_string("owner")))
meta:set_string("owner", "")
else
meta:set_int("time", time)
return true
end
end,
on_blast = function(pos)
end,
})
local function may_replace(pos, player)
local node_name = minetest.get_node(pos).name
local node_definition = minetest.registered_nodes[node_name]
-- if the node is unknown, we return false
if not node_definition then
return false
end
-- allow replacing air and liquids
if node_name == "air" or node_definition.liquidtype ~= "none" then
return true
end
-- don't replace filled chests and other nodes that don't allow it
local can_dig_func = node_definition.can_dig
if can_dig_func and not can_dig_func(pos, player) then
return false
end
-- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones?
-- flowers being squished by bones are more realistical than a squished stone, too
-- exception are of course any protected buildable_to
return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name())
end
local drop = function(pos, itemstack)
local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count()))
if obj then
obj:set_velocity({
x = math.random(-10, 10) / 9,
y = 5,
z = math.random(-10, 10) / 9,
})
end
end
local player_inventory_lists = { "main", "craft" }
bones.player_inventory_lists = player_inventory_lists
local function is_all_empty(player_inv)
for _, list_name in ipairs(player_inventory_lists) do
if not player_inv:is_empty(list_name) then
return false
end
end
return true
end
minetest.register_on_dieplayer(function(player)
local bones_mode = minetest.settings:get("bones_mode") or "bones"
if bones_mode ~= "bones" and bones_mode ~= "drop" and bones_mode ~= "keep" then
bones_mode = "bones"
end
local bones_position_message = minetest.settings:get_bool("bones_position_message") == true
local player_name = player:get_player_name()
local pos = vector.round(player:get_pos())
local pos_string = minetest.pos_to_string(pos)
-- return if keep inventory set or in creative mode
if bones_mode == "keep" or (creative and creative.is_enabled_for
and creative.is_enabled_for(player:get_player_name())) then
minetest.log("action", player_name .. " dies at " .. pos_string ..
". No bones placed")
if bones_position_message then
minetest.chat_send_player(player_name, S("@1 died at @2.", player_name, pos_string))
end
return
end
local player_inv = player:get_inventory()
if is_all_empty(player_inv) then
minetest.log("action", player_name .. " dies at " .. pos_string ..
". No bones placed")
if bones_position_message then
minetest.chat_send_player(player_name, S("@1 died at @2.", player_name, pos_string))
end
return
end
-- check if it's possible to place bones, if not find space near player
if bones_mode == "bones" and not may_replace(pos, player) then
local air = minetest.find_node_near(pos, 1, {"air"})
if air and not minetest.is_protected(air, player_name) then
pos = air
else
bones_mode = "drop"
end
end
if bones_mode == "drop" then
for _, list_name in ipairs(player_inventory_lists) do
for i = 1, player_inv:get_size(list_name) do
drop(pos, player_inv:get_stack(list_name, i))
end
player_inv:set_list(list_name, {})
end
drop(pos, ItemStack("bones:bones"))
minetest.log("action", player_name .. " dies at " .. pos_string ..
". Inventory dropped")
if bones_position_message then
minetest.chat_send_player(player_name, S("@1 died at @2, and dropped their inventory.", player_name, pos_string))
end
return
end
local param2 = minetest.dir_to_facedir(player:get_look_dir())
minetest.set_node(pos, {name = "bones:bones", param2 = param2})
minetest.log("action", player_name .. " dies at " .. pos_string ..
". Bones placed")
if bones_position_message then
minetest.chat_send_player(player_name, S("@1 died at @2, and bones were placed.", player_name, pos_string))
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("main", 8 * 4)
for _, list_name in ipairs(player_inventory_lists) do
for i = 1, player_inv:get_size(list_name) do
local stack = player_inv:get_stack(list_name, i)
if inv:room_for_item("main", stack) then
inv:add_item("main", stack)
else -- no space left
drop(pos, stack)
end
end
player_inv:set_list(list_name, {})
end
meta:set_string("formspec", bones_formspec)
meta:set_string("owner", player_name)
if share_bones_time ~= 0 then
meta:set_string("infotext", S("@1's fresh bones", player_name))
if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then
meta:set_int("time", 0)
else
meta:set_int("time", (share_bones_time - share_bones_time_early))
end
minetest.get_node_timer(pos):start(10)
else
meta:set_string("infotext", S("@1's bones", player_name))
end
end)

58
mods/bones/license.txt Normal file
View File

@ -0,0 +1,58 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2012-2016 PilzAdam
Copyright (C) 2012-2016 Various Minetest developers and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2016 paramat
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Knochen
@1's old bones=Alte Knochen von @1
@1 died at @2.=@1 starb bei @2.
@1 died at @2, and dropped their inventory.=@1 starb bei @2 und ließ das Inventar fallen.
@1 died at @2, and bones were placed.=@1 starb bei @2 und Knochen wurden platziert.
@1's fresh bones=Frische Knochen von @1
@1's bones=Knochen von @1

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Huesos
@1's old bones=Huesos antiguos de @1
@1 died at @2.=@1 murió en @2.
@1 died at @2, and dropped their inventory.=@1 murió en @2, y su inventario se desprendió.
@1 died at @2, and bones were placed.=@1 murió en @2, y sus huesos fueron depositados.
@1's fresh bones=Huesos recientes de @1
@1's bones=Huesos de @1

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Os
@1's old bones=Vieux os de @1
@1 died at @2.=@1 est mort à @2.
@1 died at @2, and dropped their inventory.=@1 est mort à @2 et a laissé tomber son inventaire.
@1 died at @2, and bones were placed.=@1 est mort à @2 et ses os ont été placés.
@1's fresh bones=Os frais de @1
@1's bones=Os de @1

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Tulang
@1's old bones=Tulang lama @1
@1 died at @2.=@1 mati di @2.
@1 died at @2, and dropped their inventory.=@1 mati di @2 dan meninggalkan barangnya.
@1 died at @2, and bones were placed.=@1 mati di @2 dan tulangnya diletakkan.
@1's fresh bones=Tulang segar @1
@1's bones=Tulang @1

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Ossa
@1's old bones=Ossa vecchie di @1
@1 died at @2.=@1 è morto alla posizione @2.
@1 died at @2, and dropped their inventory.=@1 è morto alla posizione @2, e ha lasciato a terra il contenuto del suo inventario.
@1 died at @2, and bones were placed.=@1 è morto alla posizione @2, e vi sono state posizionate delle ossa.
@1's fresh bones=Ossa fresche di @1
@1's bones=Ossa di @1

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Tulang
@1's old bones=Tulang lama @1
@1 died at @2.=@1 mati di @2.
@1 died at @2, and dropped their inventory.=@1 mati di @2, dan menjatuhkan inventorinya.
@1 died at @2, and bones were placed.=@1 mati di @2, dan tulang diletakkan.
@1's fresh bones=Tulang segar @1
@1's bones=Tulang @1

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Кости
@1's old bones=Старые кости @1
@1 died at @2.=@1 умер в @2.
@1 died at @2, and dropped their inventory.=@1 умер в @2 и потерял содержимое своего инвентаря.
@1 died at @2, and bones were placed.=@1 умер в @2, помещены кости.
@1's fresh bones=новые кости @1
@1's bones=кости @1

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Ben
@1's old bones=@1s Gamla ben
@1 died at @2.=@1 dog på @a.
@1 died at @2, and dropped their inventory.=@1 dog på @a, och tappade deras saker.
@1 died at @2, and bones were placed.=@1 dog på @2, och deras ben var placerade.
@1's fresh bones=@1s färska ben
@1's bones=@1s ben

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=Kosti
@1's old bones=Staré kosti hráča @1
@1 died at @2.=@1 zomrel na pozícií @2.
@1 died at @2, and dropped their inventory.=@1 zomrel na pozícií @2 a vysypal svoj inventár.
@1 died at @2, and bones were placed.=@1 zomrel na pozícií @2 a ostali po ňom kosti.
@1's fresh bones=Čerstvé kosti hráča @1
@1's bones=Kosti hráča @1

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=骨骸
@1's old bones=@1的旧骨骸
@1 died at @2.=@1在@2死亡。
@1 died at @2, and dropped their inventory.=@1在@2死亡丢掉了物品栏。
@1 died at @2, and bones were placed.=@1在@2死亡骨骸被放置。
@1's fresh bones=@1的新鲜骨骸
@1's bones=@1的骨骸

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=骨骸
@1's old bones=@1的舊骨骸
@1 died at @2.=@1在@2死亡。
@1 died at @2, and dropped their inventory.=@1在@2死亡丟掉了物品欄。
@1 died at @2, and bones were placed.=@1在@2死亡骨骸被放置。
@1's fresh bones=@1的新鮮骨骸
@1's bones=@1的骨骸

View File

@ -0,0 +1,8 @@
# textdomain: bones
Bones=
@1's old bones=
@1 died at @2.=
@1 died at @2, and dropped their inventory.=
@1 died at @2, and bones were placed.=
@1's fresh bones=
@1's bones=

3
mods/bones/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = bones
description = Minetest Game mod: bones
depends = default

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

13
mods/bucket/README.txt Normal file
View File

@ -0,0 +1,13 @@
Minetest Game mod: bucket
=========================
See license.txt for license information.
Authors of source code
----------------------
Kahrl <kahrl@gmx.net> (LGPLv2.1+)
celeron55, Perttu Ahola <celeron55@gmail.com> (LGPLv2.1+)
Various Minetest developers and contributors (LGPLv2.1+)
Authors of media (textures)
---------------------------
ElementW (CC BY-SA 3.0)

240
mods/bucket/init.lua Normal file
View File

@ -0,0 +1,240 @@
-- Minetest 0.4 mod: bucket
-- See README.txt for licensing and other information.
-- Load support for MT game translation.
local S = minetest.get_translator("bucket")
minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water")
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
minetest.register_craft({
output = "bucket:bucket_empty 1",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"", "default:steel_ingot", ""},
}
})
bucket = {}
bucket.liquids = {}
local function check_protection(pos, name, text)
if minetest.is_protected(pos, name) then
minetest.log("action", (name ~= "" and name or "A mod")
.. " tried to " .. text
.. " at protected position "
.. minetest.pos_to_string(pos)
.. " with a bucket")
minetest.record_protection_violation(pos, name)
return true
end
return false
end
-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- name = text description of the bucket item
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
-- force_renew = (optional) bool. Force the liquid source to renew if it has a
-- source neighbour, even if defined as 'liquid_renewable = false'.
-- Needed to avoid creating holes in sloping rivers.
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image, name,
groups, force_renew)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
force_renew = force_renew,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = groups,
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
local ndef = node and minetest.registered_nodes[node.name]
-- Call on_rightclick if the pointed node defines it
if ndef and ndef.on_rightclick and
not (user and user:is_player() and
user:get_player_control().sneak) then
return ndef.on_rightclick(
pointed_thing.under,
node, user,
itemstack)
end
local lpos
-- Check if pointing to a buildable node
if ndef and ndef.buildable_to then
-- buildable; replace the node
lpos = pointed_thing.under
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
lpos = pointed_thing.above
node = minetest.get_node_or_nil(lpos)
local above_ndef = node and minetest.registered_nodes[node.name]
if not above_ndef or not above_ndef.buildable_to then
-- do not remove the bucket with the liquid
return itemstack
end
end
if check_protection(lpos, user
and user:get_player_name()
or "", "place "..source) then
return
end
minetest.set_node(lpos, {name = source})
return ItemStack("bucket:bucket_empty")
end
})
end
end
minetest.register_craftitem("bucket:bucket_empty", {
description = S("Empty Bucket"),
inventory_image = "bucket.png",
groups = {tool = 1},
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "object" then
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil)
return user:get_wielded_item()
elseif pointed_thing.type ~= "node" then
-- do nothing if it's neither object nor node
return
end
-- Check if pointing to a liquid source
local node = minetest.get_node(pointed_thing.under)
local liquiddef = bucket.liquids[node.name]
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:get_pos()
pos.y = math.floor(pos.y + 0.5)
minetest.add_item(pos, liquiddef.itemname)
end
-- set to return empty buckets minus 1
giving_back = "bucket:bucket_empty "..tostring(item_count-1)
end
-- force_renew requires a source neighbour
local source_neighbor = false
if liquiddef.force_renew then
source_neighbor =
minetest.find_node_near(pointed_thing.under, 1, liquiddef.source)
end
if not (source_neighbor and liquiddef.force_renew) then
minetest.add_node(pointed_thing.under, {name = "air"})
end
return ItemStack(giving_back)
else
-- non-liquid nodes will have their on_punch triggered
local node_def = minetest.registered_nodes[node.name]
if node_def then
node_def.on_punch(pointed_thing.under, node, user, pointed_thing)
end
return user:get_wielded_item()
end
end,
})
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png",
S("Water Bucket"),
{tool = 1, water_bucket = 1}
)
-- River water source is 'liquid_renewable = false' to avoid horizontal spread
-- of water sources in sloping rivers that can cause water to overflow
-- riverbanks and cause floods.
-- River water source is instead made renewable by the 'force renew' option
-- used here.
bucket.register_liquid(
"default:river_water_source",
"default:river_water_flowing",
"bucket:bucket_river_water",
"bucket_river_water.png",
S("River Water Bucket"),
{tool = 1, water_bucket = 1},
true
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png",
S("Lava Bucket"),
{tool = 1}
)
minetest.register_craft({
type = "fuel",
recipe = "bucket:bucket_lava",
burntime = 60,
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
})
-- Register buckets as dungeon loot
if minetest.global_exists("dungeon_loot") then
dungeon_loot.register({
{name = "bucket:bucket_empty", chance = 0.55},
-- water in deserts/ice or above ground, lava otherwise
{name = "bucket:bucket_water", chance = 0.45,
types = {"sandstone", "desert", "ice"}},
{name = "bucket:bucket_water", chance = 0.45, y = {0, 32768},
types = {"normal"}},
{name = "bucket:bucket_lava", chance = 0.45, y = {-32768, -1},
types = {"normal"}},
})
end

51
mods/bucket/license.txt Normal file
View File

@ -0,0 +1,51 @@
License of source code
----------------------
GNU Lesser General Public License, version 2.1
Copyright (C) 2011-2016 Kahrl <kahrl@gmx.net>
Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2011-2016 Various Minetest developers and contributors
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details:
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
Licenses of media (textures)
----------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2015-2016 ElementW
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

View File

@ -0,0 +1,5 @@
# textdomain: bucket
Empty Bucket=Leerer Eimer
Water Bucket=Wassereimer
River Water Bucket=Flusswassereimer
Lava Bucket=Lavaeimer

View File

@ -0,0 +1,5 @@
# textdomain: bucket
Empty Bucket=Cubo vacío
Water Bucket=Cubo con agua
River Water Bucket=Cubo con agua de río
Lava Bucket=Cubo con lava

View File

@ -0,0 +1,5 @@
# textdomain: bucket
Empty Bucket=Seau vide
Water Bucket=Seau d'eau
River Water Bucket=Seau d'eau de rivière
Lava Bucket=Seau de lave

View File

@ -0,0 +1,5 @@
# textdomain: bucket
Empty Bucket=Ember Kosong
Water Bucket=Ember Air
River Water Bucket=Ember Air Sungai
Lava Bucket=Ember Lava

Some files were not shown because too many files have changed in this diff Show More