Updated mods
|
@ -1,30 +1,26 @@
|
|||
Minetest Game mod: beds
|
||||
=======================
|
||||
by BlockMen (c) 2014-2015
|
||||
See license.txt for license information.
|
||||
|
||||
Version: 1.1.1
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by BlockMen (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
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.
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
BlockMen (CC BY-SA 3.0)
|
||||
|
||||
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
|
||||
You can also disable the night skip feature by setting "enable_bed_night_skip = false" in minetest.conf or by using
|
||||
the /set command ingame.
|
||||
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
|
||||
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 50% of the players are lying in bed and use this option.
|
||||
|
||||
|
||||
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.
|
||||
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.
|
||||
|
|
|
@ -16,7 +16,7 @@ local function destruct_bed(pos, n)
|
|||
if reverse then
|
||||
reverse = not reverse
|
||||
minetest.remove_node(other)
|
||||
nodeupdate(other)
|
||||
minetest.check_for_falling(other)
|
||||
else
|
||||
reverse = not reverse
|
||||
end
|
||||
|
@ -33,8 +33,8 @@ function beds.register_bed(name, def)
|
|||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
stack_max = 1,
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
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,
|
||||
|
@ -46,6 +46,14 @@ function beds.register_bed(name, def)
|
|||
|
||||
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:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
local pos
|
||||
if minetest.registered_items[minetest.get_node(under).name].buildable_to then
|
||||
pos = under
|
||||
|
@ -59,8 +67,8 @@ function beds.register_bed(name, def)
|
|||
return itemstack
|
||||
end
|
||||
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
if not def or not def.buildable_to then
|
||||
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
|
||||
|
||||
|
@ -81,7 +89,8 @@ function beds.register_bed(name, def)
|
|||
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
|
||||
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
|
@ -91,8 +100,9 @@ function beds.register_bed(name, def)
|
|||
destruct_bed(pos, 1)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
beds.on_rightclick(pos, clicker)
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
on_rotate = function(pos, node, user, mode, new_param2)
|
||||
|
@ -112,8 +122,8 @@ function beds.register_bed(name, def)
|
|||
end
|
||||
local newp = vector.add(pos, minetest.facedir_to_dir(new_param2))
|
||||
local node3 = minetest.get_node_or_nil(newp)
|
||||
local def = node3 and minetest.registered_nodes[node3.name]
|
||||
if not def or not def.buildable_to then
|
||||
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
|
||||
|
@ -136,8 +146,8 @@ function beds.register_bed(name, def)
|
|||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
pointable = false,
|
||||
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
|
||||
sounds = def.sounds or default.node_sound_wood_defaults(),
|
||||
drop = name .. "_bottom",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
|
|
|
@ -88,3 +88,17 @@ beds.register_bed("beds:bed", {
|
|||
|
||||
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,
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
local pi = math.pi
|
||||
local player_in_bed = 0
|
||||
local is_sp = minetest.is_singleplayer()
|
||||
local enable_respawn = minetest.setting_getbool("enable_bed_respawn")
|
||||
local enable_respawn = minetest.settings:get_bool("enable_bed_respawn")
|
||||
if enable_respawn == nil then
|
||||
enable_respawn = true
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ local function get_look_yaw(pos)
|
|||
end
|
||||
|
||||
local function is_night_skip_enabled()
|
||||
local enable_night_skip = minetest.setting_getbool("enable_bed_night_skip")
|
||||
local enable_night_skip = minetest.settings:get_bool("enable_bed_night_skip")
|
||||
if enable_night_skip == nil then
|
||||
enable_night_skip = true
|
||||
end
|
||||
|
@ -70,7 +70,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
|
||||
-- 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)
|
||||
player:set_look_horizontal(math.random(1, 180) / 100)
|
||||
default.player_attached[name] = false
|
||||
player:set_physics_override(1, 1, 1)
|
||||
hud_flags.wielditem = true
|
||||
|
@ -85,7 +85,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
|
|||
-- 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)
|
||||
player:set_look_horizontal(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)
|
||||
|
@ -100,7 +100,7 @@ end
|
|||
|
||||
local function update_formspecs(finished)
|
||||
local ges = #minetest.get_connected_players()
|
||||
local form_n = ""
|
||||
local form_n
|
||||
local is_majority = (ges / 2) < player_in_bed
|
||||
|
||||
if finished then
|
||||
|
@ -130,7 +130,6 @@ end
|
|||
|
||||
function beds.skip_night()
|
||||
minetest.set_timeofday(0.23)
|
||||
beds.set_spawns()
|
||||
end
|
||||
|
||||
function beds.on_rightclick(pos, player)
|
||||
|
@ -149,6 +148,7 @@ function beds.on_rightclick(pos, player)
|
|||
-- 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
|
||||
|
@ -173,23 +173,18 @@ 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
|
||||
-- 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] or nil
|
||||
local pos = beds.spawn[name]
|
||||
if pos then
|
||||
player:setpos(pos)
|
||||
return true
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
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
|
||||
|
||||
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/
|
|
@ -32,11 +32,11 @@ function beds.read_spawns()
|
|||
beds.save_spawns()
|
||||
os.rename(file, file .. ".backup")
|
||||
file = org_file
|
||||
else
|
||||
spawns = {}
|
||||
end
|
||||
end
|
||||
|
||||
beds.read_spawns()
|
||||
|
||||
function beds.save_spawns()
|
||||
if not beds.spawn then
|
||||
return
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
Minetest Game mod: boats
|
||||
========================
|
||||
by PilzAdam
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
WTFPL
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by PilzAdam (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
License of media (textures and sounds):
|
||||
---------------------------------------
|
||||
WTFPL
|
||||
|
||||
Authors of media files:
|
||||
-----------------------
|
||||
textures: Zeg9
|
||||
model: thetoon and Zeg9, modified by PavelS(SokolovPavel)
|
||||
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)
|
||||
|
|
|
@ -34,6 +34,8 @@ end
|
|||
|
||||
local boat = {
|
||||
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",
|
||||
|
@ -77,7 +79,7 @@ function boat.on_rightclick(self, clicker)
|
|||
minetest.after(0.2, function()
|
||||
default.player_set_animation(clicker, "sit" , 30)
|
||||
end)
|
||||
self.object:setyaw(clicker:get_look_yaw() - math.pi / 2)
|
||||
clicker:set_look_horizontal(self.object:getyaw())
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -107,18 +109,20 @@ function boat.on_punch(self, puncher)
|
|||
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(puncher:get_player_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:getpos(), leftover)
|
||||
end
|
||||
end
|
||||
-- delay remove to ensure player is detached
|
||||
minetest.after(0.1, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
local inv = puncher:get_inventory()
|
||||
if inv:room_for_item("main", "boats:boat") then
|
||||
inv:add_item("main", "boats:boat")
|
||||
else
|
||||
minetest.add_item(self.object:getpos(), "boats:boat")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -165,7 +169,7 @@ function boat.on_step(self, dtime)
|
|||
|
||||
local p = self.object:getpos()
|
||||
p.y = p.y - 0.5
|
||||
local new_velo = {x = 0, y = 0, z = 0}
|
||||
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]
|
||||
|
@ -219,19 +223,33 @@ minetest.register_craftitem("boats:boat", {
|
|||
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: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
|
||||
return itemstack
|
||||
end
|
||||
if not is_water(pointed_thing.under) then
|
||||
return
|
||||
return itemstack
|
||||
end
|
||||
pointed_thing.under.y = pointed_thing.under.y + 0.5
|
||||
minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||
if boat then
|
||||
boat:setyaw(placer:get_look_horizontal())
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
@ -245,3 +263,9 @@ minetest.register_craft({
|
|||
{"group:wood", "group:wood", "group:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "boats:boat",
|
||||
burntime = 20,
|
||||
})
|
||||
|
|
|
@ -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/
|
|
@ -1,17 +1,12 @@
|
|||
Minetest Game mod: bones
|
||||
========================
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2012 PilzAdam
|
||||
|
||||
WTFPL
|
||||
|
||||
License of media (textures and sounds)
|
||||
--------------------------------------
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
Authors of media files
|
||||
Authors of source code
|
||||
----------------------
|
||||
Bad_Command_
|
||||
Originally by PilzAdam (MIT)
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
All textures: paramat (CC BY-SA 3.0)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
-- Minetest 0.4 mod: bones
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
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
|
||||
|
@ -11,7 +9,7 @@ local function is_owner(pos, name)
|
|||
return false
|
||||
end
|
||||
|
||||
bones.bones_formspec =
|
||||
local bones_formspec =
|
||||
"size[8,9]" ..
|
||||
default.gui_bg ..
|
||||
default.gui_bg_img ..
|
||||
|
@ -23,13 +21,13 @@ bones.bones_formspec =
|
|||
"listring[current_player;main]" ..
|
||||
default.get_hotbar_bg(0,4.85)
|
||||
|
||||
local share_bones_time = tonumber(minetest.setting_get("share_bones_time")) or 1200
|
||||
local share_bones_time_early = tonumber(minetest.setting_get("share_bones_time_early")) or share_bones_time / 4
|
||||
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 = "Bones",
|
||||
tiles = {
|
||||
"bones_top.png",
|
||||
"bones_top.png^[transform2",
|
||||
"bones_bottom.png",
|
||||
"bones_side.png",
|
||||
"bones_side.png",
|
||||
|
@ -37,11 +35,8 @@ minetest.register_node("bones:bones", {
|
|||
"bones_front.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {dig_immediate=2},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_gravel_footstep", gain=0.5},
|
||||
dug = {name="default_gravel_footstep", gain=1.0},
|
||||
}),
|
||||
groups = {dig_immediate = 2},
|
||||
sounds = default.node_sound_gravel_defaults(),
|
||||
|
||||
can_dig = function(pos, player)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
|
@ -78,11 +73,11 @@ minetest.register_node("bones:bones", {
|
|||
end,
|
||||
|
||||
on_punch = function(pos, node, player)
|
||||
if(not is_owner(pos, player:get_player_name())) then
|
||||
if not is_owner(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
if(minetest.get_meta(pos):get_string("infotext") == "") then
|
||||
if minetest.get_meta(pos):get_string("infotext") == "" then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -90,7 +85,7 @@ minetest.register_node("bones:bones", {
|
|||
local player_inv = player:get_inventory()
|
||||
local has_space = true
|
||||
|
||||
for i=1,inv:get_size("main") do
|
||||
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)
|
||||
|
@ -116,7 +111,7 @@ minetest.register_node("bones:bones", {
|
|||
local meta = minetest.get_meta(pos)
|
||||
local time = meta:get_int("time") + elapsed
|
||||
if time >= share_bones_time then
|
||||
meta:set_string("infotext", meta:get_string("owner").."'s old bones")
|
||||
meta:set_string("infotext", meta:get_string("owner") .. "'s old bones")
|
||||
meta:set_string("owner", "")
|
||||
else
|
||||
meta:set_int("time", time)
|
||||
|
@ -131,13 +126,9 @@ 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 let the protection mod decide
|
||||
-- this is consistent with when a player could dig or not dig it
|
||||
-- unknown decoration would often be removed
|
||||
-- while unknown building materials in use would usually be left
|
||||
-- if the node is unknown, we return false
|
||||
if not node_definition then
|
||||
-- only replace nodes that are not protected
|
||||
return not minetest.is_protected(pos, player:get_player_name())
|
||||
return false
|
||||
end
|
||||
|
||||
-- allow replacing air and liquids
|
||||
|
@ -157,8 +148,27 @@ local function may_replace(pos, player)
|
|||
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:setvelocity({
|
||||
x = math.random(-10, 10) / 9,
|
||||
y = 5,
|
||||
z = math.random(-10, 10) / 9,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
|
||||
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
|
||||
|
||||
-- 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
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -168,60 +178,63 @@ minetest.register_on_dieplayer(function(player)
|
|||
return
|
||||
end
|
||||
|
||||
local pos = player:getpos()
|
||||
pos.x = math.floor(pos.x+0.5)
|
||||
pos.y = math.floor(pos.y+0.5)
|
||||
pos.z = math.floor(pos.z+0.5)
|
||||
local param2 = minetest.dir_to_facedir(player:get_look_dir())
|
||||
local pos = vector.round(player:getpos())
|
||||
local player_name = player:get_player_name()
|
||||
local player_inv = player:get_inventory()
|
||||
|
||||
if (not may_replace(pos, player)) then
|
||||
if (may_replace({x=pos.x, y=pos.y+1, z=pos.z}, player)) then
|
||||
-- drop one node above if there's space
|
||||
-- this should solve most cases of protection related deaths in which players dig straight down
|
||||
-- yet keeps the bones reachable
|
||||
pos.y = pos.y+1
|
||||
-- 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
|
||||
-- drop items instead of delete
|
||||
for i=1,player_inv:get_size("main") do
|
||||
minetest.add_item(pos, player_inv:get_stack("main", i))
|
||||
bones_mode = "drop"
|
||||
end
|
||||
for i=1,player_inv:get_size("craft") do
|
||||
minetest.add_item(pos, player_inv:get_stack("craft", i))
|
||||
end
|
||||
-- empty lists main and craft
|
||||
|
||||
if bones_mode == "drop" then
|
||||
|
||||
-- drop inventory items
|
||||
for i = 1, player_inv:get_size("main") do
|
||||
drop(pos, player_inv:get_stack("main", i))
|
||||
end
|
||||
player_inv:set_list("main", {})
|
||||
|
||||
-- drop crafting grid items
|
||||
for i = 1, player_inv:get_size("craft") do
|
||||
drop(pos, player_inv:get_stack("craft", i))
|
||||
end
|
||||
player_inv:set_list("craft", {})
|
||||
|
||||
drop(pos, ItemStack("bones:bones"))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
minetest.set_node(pos, {name="bones:bones", param2=param2})
|
||||
local param2 = minetest.dir_to_facedir(player:get_look_dir())
|
||||
minetest.set_node(pos, {name = "bones:bones", param2 = param2})
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_size("main", 8 * 4)
|
||||
inv:set_list("main", player_inv:get_list("main"))
|
||||
|
||||
for i=1,player_inv:get_size("craft") do
|
||||
for i = 1, player_inv:get_size("craft") do
|
||||
local stack = player_inv:get_stack("craft", i)
|
||||
if inv:room_for_item("main", stack) then
|
||||
inv:add_item("main", stack)
|
||||
else
|
||||
--drop if no space left
|
||||
minetest.add_item(pos, stack)
|
||||
drop(pos, stack)
|
||||
end
|
||||
end
|
||||
|
||||
player_inv:set_list("main", {})
|
||||
player_inv:set_list("craft", {})
|
||||
|
||||
meta:set_string("formspec", bones.bones_formspec)
|
||||
meta:set_string("formspec", bones_formspec)
|
||||
meta:set_string("owner", player_name)
|
||||
|
||||
if share_bones_time ~= 0 then
|
||||
meta:set_string("infotext", player_name.."'s fresh bones")
|
||||
meta:set_string("infotext", player_name .. "'s fresh bones")
|
||||
|
||||
if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then
|
||||
meta:set_int("time", 0)
|
||||
|
|
|
@ -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.
|
||||
|
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 740 B |
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 656 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 700 B |
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 662 B |
|
@ -1,26 +1,13 @@
|
|||
Minetest Game mod: bucket
|
||||
=========================
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
|
||||
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
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 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
License of media (textures and sounds)
|
||||
--------------------------------------
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
Authors of media files
|
||||
-----------------------
|
||||
Everything not listed in here:
|
||||
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Kahrl <kahrl@gmx.net> (LGPL 2.1)
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
ElementW (CC BY-SA 3.0)
|
||||
|
|
|
@ -36,12 +36,17 @@ end
|
|||
-- 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)
|
||||
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]
|
||||
|
||||
|
@ -52,6 +57,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
|||
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
|
||||
|
@ -59,47 +65,45 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
|||
end
|
||||
|
||||
local node = minetest.get_node_or_nil(pointed_thing.under)
|
||||
local ndef
|
||||
if node then
|
||||
ndef = minetest.registered_nodes[node.name]
|
||||
end
|
||||
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
|
||||
user and not user:get_player_control().sneak then
|
||||
return ndef.on_rightclick(
|
||||
pointed_thing.under,
|
||||
node, user,
|
||||
itemstack) or itemstack
|
||||
itemstack)
|
||||
end
|
||||
|
||||
local place_liquid = function(pos, node, source, flowing)
|
||||
if check_protection(pos,
|
||||
user and user:get_player_name() or "",
|
||||
"place "..source) then
|
||||
return
|
||||
end
|
||||
minetest.add_node(pos, {name=source})
|
||||
end
|
||||
local lpos
|
||||
|
||||
-- Check if pointing to a buildable node
|
||||
if ndef and ndef.buildable_to then
|
||||
-- buildable; replace the node
|
||||
place_liquid(pointed_thing.under, node,
|
||||
source, flowing)
|
||||
lpos = pointed_thing.under
|
||||
else
|
||||
-- not buildable to; place the liquid above
|
||||
-- check if the node above can be replaced
|
||||
local node = minetest.get_node_or_nil(pointed_thing.above)
|
||||
if node and minetest.registered_nodes[node.name].buildable_to then
|
||||
place_liquid(pointed_thing.above,
|
||||
node, source,
|
||||
flowing)
|
||||
else
|
||||
|
||||
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
|
||||
end
|
||||
return {name="bucket:bucket_empty"}
|
||||
|
||||
minetest.set_node(lpos, {name = source})
|
||||
return ItemStack("bucket:bucket_empty")
|
||||
end
|
||||
})
|
||||
end
|
||||
|
@ -111,8 +115,11 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
|||
stack_max = 99,
|
||||
liquids_pointable = true,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
if pointed_thing.type ~= "node" then
|
||||
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
|
||||
|
@ -142,7 +149,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
|||
else
|
||||
local pos = user:getpos()
|
||||
pos.y = math.floor(pos.y + 0.5)
|
||||
core.add_item(pos, liquiddef.itemname)
|
||||
minetest.add_item(pos, liquiddef.itemname)
|
||||
end
|
||||
|
||||
-- set to return empty buckets minus 1
|
||||
|
@ -150,9 +157,24 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
|||
|
||||
end
|
||||
|
||||
minetest.add_node(pointed_thing.under, {name="air"})
|
||||
-- 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,
|
||||
})
|
||||
|
@ -172,7 +194,8 @@ bucket.register_liquid(
|
|||
"bucket:bucket_river_water",
|
||||
"bucket_river_water.png",
|
||||
"River Water Bucket",
|
||||
{water_bucket = 1}
|
||||
{water_bucket = 1},
|
||||
true
|
||||
)
|
||||
|
||||
bucket.register_liquid(
|
||||
|
|
|
@ -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/
|
|
@ -0,0 +1,22 @@
|
|||
Carts (formerly boost_cart)
|
||||
==========================
|
||||
|
||||
Carts, based almost entirely on the mod boost_cart [1], which
|
||||
itself is based on (and fully compatible with) the carts mod [2].
|
||||
|
||||
The model was originally designed by stujones11 [3] (CC-0).
|
||||
|
||||
Cart textures are based on original work from PixelBOX (WTFPL).
|
||||
|
||||
|
||||
[1] https://github.com/SmallJoker/boost_cart/
|
||||
[2] https://github.com/PilzAdam/carts/
|
||||
[3] https://github.com/stujones11/railcart/
|
||||
|
||||
|
||||
Features
|
||||
----------
|
||||
- A fast cart for your railway or roller coaster (up to 7 m/s!)
|
||||
- Boost and brake rails
|
||||
- Rail junction switching with the 'right-left' walking keys
|
||||
- Handbrake with the 'back' key
|
|
@ -0,0 +1,403 @@
|
|||
local cart_entity = {
|
||||
physical = false, -- otherwise going uphill breaks
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
visual = "mesh",
|
||||
mesh = "carts_cart.b3d",
|
||||
visual_size = {x=1, y=1},
|
||||
textures = {"carts_cart.png"},
|
||||
|
||||
driver = nil,
|
||||
punched = false, -- used to re-send velocity and position
|
||||
velocity = {x=0, y=0, z=0}, -- only used on punch
|
||||
old_dir = {x=1, y=0, z=0}, -- random value to start the cart on punch
|
||||
old_pos = nil,
|
||||
old_switch = 0,
|
||||
railtype = nil,
|
||||
attached_items = {}
|
||||
}
|
||||
|
||||
function cart_entity:on_rightclick(clicker)
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
local player_name = clicker:get_player_name()
|
||||
if self.driver and player_name == self.driver then
|
||||
self.driver = nil
|
||||
carts:manage_attachment(clicker, nil)
|
||||
elseif not self.driver then
|
||||
self.driver = player_name
|
||||
carts:manage_attachment(clicker, self.object)
|
||||
end
|
||||
end
|
||||
|
||||
function cart_entity:on_activate(staticdata, dtime_s)
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
if string.sub(staticdata, 1, string.len("return")) ~= "return" then
|
||||
return
|
||||
end
|
||||
local data = minetest.deserialize(staticdata)
|
||||
if not data or type(data) ~= "table" then
|
||||
return
|
||||
end
|
||||
self.railtype = data.railtype
|
||||
if data.old_dir then
|
||||
self.old_dir = data.old_dir
|
||||
end
|
||||
if data.old_vel then
|
||||
self.old_vel = data.old_vel
|
||||
end
|
||||
end
|
||||
|
||||
function cart_entity:get_staticdata()
|
||||
return minetest.serialize({
|
||||
railtype = self.railtype,
|
||||
old_dir = self.old_dir,
|
||||
old_vel = self.old_vel
|
||||
})
|
||||
end
|
||||
|
||||
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
||||
local pos = self.object:getpos()
|
||||
if not self.railtype then
|
||||
local node = minetest.get_node(pos).name
|
||||
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
|
||||
end
|
||||
-- Punched by non-player
|
||||
if not puncher or not puncher:is_player() then
|
||||
local cart_dir = carts:get_rail_direction(pos, self.old_dir, nil, nil, self.railtype)
|
||||
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
|
||||
return
|
||||
end
|
||||
self.velocity = vector.multiply(cart_dir, 2)
|
||||
self.punched = true
|
||||
return
|
||||
end
|
||||
-- Player digs cart by sneak-punch
|
||||
if puncher:get_player_control().sneak then
|
||||
if self.sound_handle then
|
||||
minetest.sound_stop(self.sound_handle)
|
||||
end
|
||||
-- Detach driver and items
|
||||
if self.driver then
|
||||
if self.old_pos then
|
||||
self.object:setpos(self.old_pos)
|
||||
end
|
||||
local player = minetest.get_player_by_name(self.driver)
|
||||
carts:manage_attachment(player, nil)
|
||||
end
|
||||
for _,obj_ in ipairs(self.attached_items) do
|
||||
if obj_ then
|
||||
obj_:set_detach()
|
||||
end
|
||||
end
|
||||
-- Pick up cart
|
||||
local inv = puncher:get_inventory()
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(puncher:get_player_name()))
|
||||
or not inv:contains_item("main", "carts:cart") then
|
||||
local leftover = inv:add_item("main", "carts:cart")
|
||||
-- If no room in inventory add a replacement cart to the world
|
||||
if not leftover:is_empty() then
|
||||
minetest.add_item(self.object:getpos(), leftover)
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
-- Player punches cart to alter velocity
|
||||
local vel = self.object:getvelocity()
|
||||
if puncher:get_player_name() == self.driver then
|
||||
if math.abs(vel.x + vel.z) > carts.punch_speed_max then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local punch_dir = carts:velocity_to_dir(puncher:get_look_dir())
|
||||
punch_dir.y = 0
|
||||
local cart_dir = carts:get_rail_direction(pos, punch_dir, nil, nil, self.railtype)
|
||||
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
|
||||
return
|
||||
end
|
||||
|
||||
local punch_interval = 1
|
||||
if tool_capabilities and tool_capabilities.full_punch_interval then
|
||||
punch_interval = tool_capabilities.full_punch_interval
|
||||
end
|
||||
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)
|
||||
local f = 2 * (time_from_last_punch / punch_interval)
|
||||
|
||||
self.velocity = vector.multiply(cart_dir, f)
|
||||
self.old_dir = cart_dir
|
||||
self.punched = true
|
||||
end
|
||||
|
||||
local function rail_on_step_event(handler, obj, dtime)
|
||||
if handler then
|
||||
handler(obj, dtime)
|
||||
end
|
||||
end
|
||||
|
||||
-- sound refresh interval = 1.0sec
|
||||
local function rail_sound(self, dtime)
|
||||
if not self.sound_ttl then
|
||||
self.sound_ttl = 1.0
|
||||
return
|
||||
elseif self.sound_ttl > 0 then
|
||||
self.sound_ttl = self.sound_ttl - dtime
|
||||
return
|
||||
end
|
||||
self.sound_ttl = 1.0
|
||||
if self.sound_handle then
|
||||
local handle = self.sound_handle
|
||||
self.sound_handle = nil
|
||||
minetest.after(0.2, minetest.sound_stop, handle)
|
||||
end
|
||||
local vel = self.object:getvelocity()
|
||||
local speed = vector.length(vel)
|
||||
if speed > 0 then
|
||||
self.sound_handle = minetest.sound_play(
|
||||
"carts_cart_moving", {
|
||||
object = self.object,
|
||||
gain = (speed / carts.speed_max) / 2,
|
||||
loop = true,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local function get_railparams(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
return carts.railparams[node.name] or {}
|
||||
end
|
||||
|
||||
local function rail_on_step(self, dtime)
|
||||
local vel = self.object:getvelocity()
|
||||
if self.punched then
|
||||
vel = vector.add(vel, self.velocity)
|
||||
self.object:setvelocity(vel)
|
||||
self.old_dir.y = 0
|
||||
elseif vector.equals(vel, {x=0, y=0, z=0}) then
|
||||
return
|
||||
end
|
||||
|
||||
local pos = self.object:getpos()
|
||||
local update = {}
|
||||
|
||||
-- stop cart if velocity vector flips
|
||||
if self.old_vel and self.old_vel.y == 0 and
|
||||
(self.old_vel.x * vel.x < 0 or self.old_vel.z * vel.z < 0) then
|
||||
self.old_vel = {x = 0, y = 0, z = 0}
|
||||
self.old_pos = pos
|
||||
self.object:setvelocity(vector.new())
|
||||
self.object:setacceleration(vector.new())
|
||||
rail_on_step_event(get_railparams(pos).on_step, self, dtime)
|
||||
return
|
||||
end
|
||||
self.old_vel = vector.new(vel)
|
||||
|
||||
if self.old_pos and not self.punched then
|
||||
local flo_pos = vector.round(pos)
|
||||
local flo_old = vector.round(self.old_pos)
|
||||
if vector.equals(flo_pos, flo_old) then
|
||||
-- Do not check one node multiple times
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local ctrl, player
|
||||
|
||||
-- Get player controls
|
||||
if self.driver then
|
||||
player = minetest.get_player_by_name(self.driver)
|
||||
if player then
|
||||
ctrl = player:get_player_control()
|
||||
end
|
||||
end
|
||||
|
||||
if self.old_pos then
|
||||
-- Detection for "skipping" nodes
|
||||
local found_path = carts:pathfinder(
|
||||
pos, self.old_pos, self.old_dir, ctrl, self.old_switch, self.railtype
|
||||
)
|
||||
|
||||
if not found_path then
|
||||
-- No rail found: reset back to the expected position
|
||||
pos = vector.new(self.old_pos)
|
||||
update.pos = true
|
||||
end
|
||||
end
|
||||
|
||||
local cart_dir = carts:velocity_to_dir(vel)
|
||||
local railparams
|
||||
|
||||
-- dir: New moving direction of the cart
|
||||
-- switch_keys: Currently pressed L/R key, used to ignore the key on the next rail node
|
||||
local dir, switch_keys = carts:get_rail_direction(
|
||||
pos, cart_dir, ctrl, self.old_switch, self.railtype
|
||||
)
|
||||
|
||||
local new_acc = {x=0, y=0, z=0}
|
||||
if vector.equals(dir, {x=0, y=0, z=0}) then
|
||||
vel = {x = 0, y = 0, z = 0}
|
||||
pos = vector.round(pos)
|
||||
update.pos = true
|
||||
update.vel = true
|
||||
else
|
||||
-- Direction change detected
|
||||
if not vector.equals(dir, self.old_dir) then
|
||||
vel = vector.multiply(dir, math.abs(vel.x + vel.z))
|
||||
update.vel = true
|
||||
if dir.y ~= self.old_dir.y then
|
||||
pos = vector.round(pos)
|
||||
update.pos = true
|
||||
end
|
||||
end
|
||||
-- Center on the rail
|
||||
if dir.z ~= 0 and math.floor(pos.x + 0.5) ~= pos.x then
|
||||
pos.x = math.floor(pos.x + 0.5)
|
||||
update.pos = true
|
||||
end
|
||||
if dir.x ~= 0 and math.floor(pos.z + 0.5) ~= pos.z then
|
||||
pos.z = math.floor(pos.z + 0.5)
|
||||
update.pos = true
|
||||
end
|
||||
|
||||
-- Slow down or speed up..
|
||||
local acc = dir.y * -4.0
|
||||
|
||||
-- Get rail for corrected position
|
||||
railparams = get_railparams(pos)
|
||||
|
||||
-- no need to check for railparams == nil since we always make it exist.
|
||||
local speed_mod = railparams.acceleration
|
||||
if speed_mod and speed_mod ~= 0 then
|
||||
-- Try to make it similar to the original carts mod
|
||||
acc = acc + speed_mod
|
||||
else
|
||||
-- Handbrake or coast
|
||||
if ctrl and ctrl.down then
|
||||
acc = acc - 3
|
||||
else
|
||||
acc = acc - 0.4
|
||||
end
|
||||
end
|
||||
|
||||
new_acc = vector.multiply(dir, acc)
|
||||
end
|
||||
|
||||
-- Limits
|
||||
local max_vel = carts.speed_max
|
||||
for _, v in pairs({"x","y","z"}) do
|
||||
if math.abs(vel[v]) > max_vel then
|
||||
vel[v] = carts:get_sign(vel[v]) * max_vel
|
||||
new_acc[v] = 0
|
||||
update.vel = true
|
||||
end
|
||||
end
|
||||
|
||||
self.object:setacceleration(new_acc)
|
||||
self.old_pos = vector.new(pos)
|
||||
if not vector.equals(dir, {x=0, y=0, z=0}) then
|
||||
self.old_dir = vector.new(dir)
|
||||
end
|
||||
self.old_switch = switch_keys
|
||||
|
||||
if self.punched then
|
||||
-- Collect dropped items
|
||||
for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||
if not obj_:is_player() and
|
||||
obj_:get_luaentity() and
|
||||
not obj_:get_luaentity().physical_state and
|
||||
obj_:get_luaentity().name == "__builtin:item" then
|
||||
|
||||
obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||
self.attached_items[#self.attached_items + 1] = obj_
|
||||
end
|
||||
end
|
||||
self.punched = false
|
||||
update.vel = true
|
||||
end
|
||||
|
||||
railparams = railparams or get_railparams(pos)
|
||||
|
||||
if not (update.vel or update.pos) then
|
||||
rail_on_step_event(railparams.on_step, self, dtime)
|
||||
return
|
||||
end
|
||||
|
||||
local yaw = 0
|
||||
if self.old_dir.x < 0 then
|
||||
yaw = 0.5
|
||||
elseif self.old_dir.x > 0 then
|
||||
yaw = 1.5
|
||||
elseif self.old_dir.z < 0 then
|
||||
yaw = 1
|
||||
end
|
||||
self.object:setyaw(yaw * math.pi)
|
||||
|
||||
local anim = {x=0, y=0}
|
||||
if dir.y == -1 then
|
||||
anim = {x=1, y=1}
|
||||
elseif dir.y == 1 then
|
||||
anim = {x=2, y=2}
|
||||
end
|
||||
self.object:set_animation(anim, 1, 0)
|
||||
|
||||
self.object:setvelocity(vel)
|
||||
if update.pos then
|
||||
self.object:setpos(pos)
|
||||
end
|
||||
|
||||
-- call event handler
|
||||
rail_on_step_event(railparams.on_step, self, dtime)
|
||||
end
|
||||
|
||||
function cart_entity:on_step(dtime)
|
||||
rail_on_step(self, dtime)
|
||||
rail_sound(self, dtime)
|
||||
end
|
||||
|
||||
minetest.register_entity("carts:cart", cart_entity)
|
||||
|
||||
minetest.register_craftitem("carts:cart", {
|
||||
description = "Cart (Sneak+Click to pick up)",
|
||||
inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"),
|
||||
wield_image = "carts_cart_side.png",
|
||||
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:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
if not pointed_thing.type == "node" then
|
||||
return
|
||||
end
|
||||
if carts:is_rail(pointed_thing.under) then
|
||||
minetest.add_entity(pointed_thing.under, "carts:cart")
|
||||
elseif carts:is_rail(pointed_thing.above) then
|
||||
minetest.add_entity(pointed_thing.above, "carts:cart")
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
minetest.sound_play({name = "default_place_node_metal", gain = 0.5},
|
||||
{pos = pointed_thing.above})
|
||||
|
||||
if not (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(placer:get_player_name())) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:cart",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
},
|
||||
})
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,221 @@
|
|||
function carts:get_sign(z)
|
||||
if z == 0 then
|
||||
return 0
|
||||
else
|
||||
return z / math.abs(z)
|
||||
end
|
||||
end
|
||||
|
||||
function carts:manage_attachment(player, obj)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local status = obj ~= nil
|
||||
local player_name = player:get_player_name()
|
||||
if default.player_attached[player_name] == status then
|
||||
return
|
||||
end
|
||||
default.player_attached[player_name] = status
|
||||
|
||||
if status then
|
||||
player:set_attach(obj, "", {x=0, y=6, z=0}, {x=0, y=0, z=0})
|
||||
player:set_eye_offset({x=0, y=-4, z=0},{x=0, y=-4, z=0})
|
||||
else
|
||||
player:set_detach()
|
||||
player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
|
||||
end
|
||||
end
|
||||
|
||||
function carts:velocity_to_dir(v)
|
||||
if math.abs(v.x) > math.abs(v.z) then
|
||||
return {x=carts:get_sign(v.x), y=carts:get_sign(v.y), z=0}
|
||||
else
|
||||
return {x=0, y=carts:get_sign(v.y), z=carts:get_sign(v.z)}
|
||||
end
|
||||
end
|
||||
|
||||
function carts:is_rail(pos, railtype)
|
||||
local node = minetest.get_node(pos).name
|
||||
if node == "ignore" then
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local emin, emax = vm:read_from_map(pos, pos)
|
||||
local area = VoxelArea:new{
|
||||
MinEdge = emin,
|
||||
MaxEdge = emax,
|
||||
}
|
||||
local data = vm:get_data()
|
||||
local vi = area:indexp(pos)
|
||||
node = minetest.get_name_from_content_id(data[vi])
|
||||
end
|
||||
if minetest.get_item_group(node, "rail") == 0 then
|
||||
return false
|
||||
end
|
||||
if not railtype then
|
||||
return true
|
||||
end
|
||||
return minetest.get_item_group(node, "connect_to_raillike") == railtype
|
||||
end
|
||||
|
||||
function carts:check_front_up_down(pos, dir_, check_up, railtype)
|
||||
local dir = vector.new(dir_)
|
||||
local cur
|
||||
|
||||
-- Front
|
||||
dir.y = 0
|
||||
cur = vector.add(pos, dir)
|
||||
if carts:is_rail(cur, railtype) then
|
||||
return dir
|
||||
end
|
||||
-- Up
|
||||
if check_up then
|
||||
dir.y = 1
|
||||
cur = vector.add(pos, dir)
|
||||
if carts:is_rail(cur, railtype) then
|
||||
return dir
|
||||
end
|
||||
end
|
||||
-- Down
|
||||
dir.y = -1
|
||||
cur = vector.add(pos, dir)
|
||||
if carts:is_rail(cur, railtype) then
|
||||
return dir
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
|
||||
local pos = vector.round(pos_)
|
||||
local cur
|
||||
local left_check, right_check = true, true
|
||||
|
||||
-- Check left and right
|
||||
local left = {x=0, y=0, z=0}
|
||||
local right = {x=0, y=0, z=0}
|
||||
if dir.z ~= 0 and dir.x == 0 then
|
||||
left.x = -dir.z
|
||||
right.x = dir.z
|
||||
elseif dir.x ~= 0 and dir.z == 0 then
|
||||
left.z = dir.x
|
||||
right.z = -dir.x
|
||||
end
|
||||
|
||||
if ctrl then
|
||||
if old_switch == 1 then
|
||||
left_check = false
|
||||
elseif old_switch == 2 then
|
||||
right_check = false
|
||||
end
|
||||
if ctrl.left and left_check then
|
||||
cur = carts:check_front_up_down(pos, left, false, railtype)
|
||||
if cur then
|
||||
return cur, 1
|
||||
end
|
||||
left_check = false
|
||||
end
|
||||
if ctrl.right and right_check then
|
||||
cur = carts:check_front_up_down(pos, right, false, railtype)
|
||||
if cur then
|
||||
return cur, 2
|
||||
end
|
||||
right_check = true
|
||||
end
|
||||
end
|
||||
|
||||
-- Normal
|
||||
cur = carts:check_front_up_down(pos, dir, true, railtype)
|
||||
if cur then
|
||||
return cur
|
||||
end
|
||||
|
||||
-- Left, if not already checked
|
||||
if left_check then
|
||||
cur = carts:check_front_up_down(pos, left, false, railtype)
|
||||
if cur then
|
||||
return cur
|
||||
end
|
||||
end
|
||||
|
||||
-- Right, if not already checked
|
||||
if right_check then
|
||||
cur = carts:check_front_up_down(pos, right, false, railtype)
|
||||
if cur then
|
||||
return cur
|
||||
end
|
||||
end
|
||||
|
||||
-- Backwards
|
||||
if not old_switch then
|
||||
cur = carts:check_front_up_down(pos, {
|
||||
x = -dir.x,
|
||||
y = dir.y,
|
||||
z = -dir.z
|
||||
}, true, railtype)
|
||||
if cur then
|
||||
return cur
|
||||
end
|
||||
end
|
||||
|
||||
return {x=0, y=0, z=0}
|
||||
end
|
||||
|
||||
function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype)
|
||||
local pos = vector.round(pos_)
|
||||
local pf_pos = vector.round(old_pos)
|
||||
local pf_dir = vector.new(old_dir)
|
||||
|
||||
for i = 1, 3 do
|
||||
if vector.equals(pf_pos, pos) then
|
||||
-- Success! Cart moved on correctly
|
||||
return true
|
||||
end
|
||||
|
||||
pf_dir, pf_switch = carts:get_rail_direction(pf_pos, pf_dir, ctrl, pf_switch, railtype)
|
||||
if vector.equals(pf_dir, {x=0, y=0, z=0}) then
|
||||
-- No way forwards
|
||||
return false
|
||||
end
|
||||
|
||||
pf_pos = vector.add(pf_pos, pf_dir)
|
||||
end
|
||||
-- Cart not found
|
||||
return false
|
||||
end
|
||||
|
||||
function carts:register_rail(name, def_overwrite, railparams)
|
||||
local def = {
|
||||
drawtype = "raillike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
|
||||
},
|
||||
sounds = default.node_sound_metal_defaults()
|
||||
}
|
||||
for k, v in pairs(def_overwrite) do
|
||||
def[k] = v
|
||||
end
|
||||
if not def.inventory_image then
|
||||
def.wield_image = def.tiles[1]
|
||||
def.inventory_image = def.tiles[1]
|
||||
end
|
||||
|
||||
if railparams then
|
||||
carts.railparams[name] = table.copy(railparams)
|
||||
end
|
||||
|
||||
minetest.register_node(name, def)
|
||||
end
|
||||
|
||||
function carts:get_rail_groups(additional_groups)
|
||||
-- Get the default rail groups and add more when a table is given
|
||||
local groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1}
|
||||
if type(additional_groups) == "table" then
|
||||
for k, v in pairs(additional_groups) do
|
||||
groups[k] = v
|
||||
end
|
||||
end
|
||||
return groups
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
carts = {}
|
||||
carts.modpath = minetest.get_modpath("carts")
|
||||
carts.railparams = {}
|
||||
|
||||
-- Maximal speed of the cart in m/s (min = -1)
|
||||
carts.speed_max = 7
|
||||
-- Set to -1 to disable punching the cart from inside (min = -1)
|
||||
carts.punch_speed_max = 5
|
||||
|
||||
|
||||
dofile(carts.modpath.."/functions.lua")
|
||||
dofile(carts.modpath.."/rails.lua")
|
||||
|
||||
-- Support for non-default games
|
||||
if not default.player_attached then
|
||||
default.player_attached = {}
|
||||
end
|
||||
|
||||
dofile(carts.modpath.."/cart_entity.lua")
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2014-2016 SmallJoker
|
||||
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
|
||||
-----------------
|
||||
|
||||
CC-0, see: https://creativecommons.org/share-your-work/public-domain/cc0/, except
|
||||
if other license is mentioned.
|
||||
|
||||
|
||||
Authors
|
||||
---------
|
||||
Originally from PixelBOX (Gambit):
|
||||
carts_cart_side.png
|
||||
carts_cart_top.png
|
||||
carts_cart_front.png*
|
||||
carts_cart.png*
|
||||
|
||||
sofar + stujones11:
|
||||
carts_cart.b3d and carts_cart.blend
|
||||
|
||||
hexafraction, modified by sofar
|
||||
carts_rail_*.png
|
||||
|
||||
http://www.freesound.org/people/YleArkisto/sounds/253159/ - YleArkisto - CC-BY-3.0
|
||||
carts_cart_moving.*.ogg
|
|
@ -0,0 +1,59 @@
|
|||
carts:register_rail("carts:rail", {
|
||||
description = "Rail",
|
||||
tiles = {
|
||||
"carts_rail_straight.png", "carts_rail_curved.png",
|
||||
"carts_rail_t_junction.png", "carts_rail_crossing.png"
|
||||
},
|
||||
inventory_image = "carts_rail_straight.png",
|
||||
wield_image = "carts_rail_straight.png",
|
||||
groups = carts:get_rail_groups(),
|
||||
}, {})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:rail 18",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_alias("default:rail", "carts:rail")
|
||||
|
||||
|
||||
carts:register_rail("carts:powerrail", {
|
||||
description = "Powered rail",
|
||||
tiles = {
|
||||
"carts_rail_straight_pwr.png", "carts_rail_curved_pwr.png",
|
||||
"carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png"
|
||||
},
|
||||
groups = carts:get_rail_groups(),
|
||||
}, {acceleration = 5})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:powerrail 18",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
carts:register_rail("carts:brakerail", {
|
||||
description = "Brake rail",
|
||||
tiles = {
|
||||
"carts_rail_straight_brk.png", "carts_rail_curved_brk.png",
|
||||
"carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png"
|
||||
},
|
||||
groups = carts:get_rail_groups(),
|
||||
}, {acceleration = -3})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "carts:brakerail 18",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
||||
}
|
||||
})
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 459 B |
After Width: | Height: | Size: 486 B |
After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 612 B |
After Width: | Height: | Size: 684 B |
After Width: | Height: | Size: 676 B |
After Width: | Height: | Size: 580 B |
After Width: | Height: | Size: 618 B |
After Width: | Height: | Size: 614 B |
After Width: | Height: | Size: 602 B |
After Width: | Height: | Size: 660 B |
After Width: | Height: | Size: 661 B |
After Width: | Height: | Size: 707 B |
After Width: | Height: | Size: 698 B |
After Width: | Height: | Size: 697 B |
|
@ -1,23 +1,12 @@
|
|||
Minetest Game mod: creative
|
||||
===========================
|
||||
See license.txt for license information.
|
||||
|
||||
Implements creative mode.
|
||||
|
||||
Switch on by using the "creative_mode" setting.
|
||||
|
||||
Registered items that
|
||||
- have a description, and
|
||||
- do not have the group not_in_creative_inventory
|
||||
are added to the creative inventory.
|
||||
|
||||
License of source code and media files:
|
||||
---------------------------------------
|
||||
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
Copyright (C) 2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
|
||||
|
||||
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.
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by Perttu Ahola (celeron55) <celeron55@gmail.com> (MIT)
|
||||
Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com> (MIT)
|
||||
|
||||
Author of media (textures)
|
||||
--------------------------
|
||||
Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com> (CC BY-SA 3.0)
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
default
|
||||
sfinv
|
||||
|
|
|
@ -1,225 +1,22 @@
|
|||
-- minetest/creative/init.lua
|
||||
|
||||
creative = {}
|
||||
local player_inventory = {}
|
||||
local creative_mode = minetest.setting_getbool("creative_mode")
|
||||
|
||||
-- Create detached creative inventory after loading all mods
|
||||
creative.init_creative_inventory = function(player)
|
||||
local player_name = player:get_player_name()
|
||||
player_inventory[player_name] = {}
|
||||
player_inventory[player_name].size = 0
|
||||
player_inventory[player_name].filter = ""
|
||||
player_inventory[player_name].start_i = 1
|
||||
player_inventory[player_name].tab_id = 2
|
||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
||||
|
||||
minetest.create_detached_inventory("creative_" .. player_name, {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
if creative_mode and not to_list == "main" then
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
return 0
|
||||
end,
|
||||
allow_take = function(inv, listname, index, stack, player)
|
||||
if creative_mode then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
end,
|
||||
on_take = function(inv, listname, index, stack, player)
|
||||
local player_name, stack_name = player:get_player_name(), stack:get_name()
|
||||
--print(player_name .. " takes item from creative inventory; listname = " .. listname .. ", index = " .. index .. ", stack = " .. dump(stack:to_table()))
|
||||
if stack then
|
||||
minetest.log("action", player_name .. " takes " .. stack_name .. " from creative inventory")
|
||||
--print("Stack name: " .. stack_name .. ", Stack count: " .. stack:get_count())
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
creative.update_creative_inventory(player_name)
|
||||
--print("creative inventory size: " .. player_inventory[player_name].size)
|
||||
function creative.is_enabled_for(name)
|
||||
return creative_mode_cache
|
||||
end
|
||||
|
||||
local function tab_category(tab_id)
|
||||
local id_category = {
|
||||
nil, -- Reserved for crafting tab.
|
||||
minetest.registered_items,
|
||||
minetest.registered_nodes,
|
||||
minetest.registered_tools,
|
||||
minetest.registered_craftitems
|
||||
}
|
||||
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
|
||||
|
||||
-- If index out of range, show default ("All") page.
|
||||
return id_category[tab_id] or id_category[2]
|
||||
end
|
||||
|
||||
function creative.update_creative_inventory(player_name)
|
||||
local creative_list = {}
|
||||
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
|
||||
local inv = player_inventory[player_name]
|
||||
|
||||
for name, def in pairs(tab_category(inv.tab_id)) do
|
||||
if not (def.groups.not_in_creative_inventory == 1) and
|
||||
def.description and def.description ~= "" and
|
||||
(def.name:find(inv.filter, 1, true) or
|
||||
def.description:lower():find(inv.filter, 1, true)) then
|
||||
creative_list[#creative_list+1] = name
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(creative_list)
|
||||
player_inv:set_size("main", #creative_list)
|
||||
player_inv:set_list("main", creative_list)
|
||||
inv.size = #creative_list
|
||||
end
|
||||
|
||||
-- Create the trash field
|
||||
local trash = minetest.create_detached_inventory("creative_trash", {
|
||||
-- Allow the stack to be placed and remove it in on_put()
|
||||
-- This allows the creative inventory to restore the stack
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
if creative_mode then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_put = function(inv, listname)
|
||||
inv:set_list(listname, {})
|
||||
end,
|
||||
})
|
||||
trash:set_size("main", 1)
|
||||
|
||||
creative.formspec_add = ""
|
||||
|
||||
creative.set_creative_formspec = function(player, start_i)
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
local pagenum = math.floor(start_i / (3*8) + 1)
|
||||
local pagemax = math.ceil(inv.size / (3*8))
|
||||
|
||||
player:set_inventory_formspec([[
|
||||
size[8,8.6]
|
||||
image[4.06,3.4;0.8,0.8;creative_trash_icon.png]
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
list[detached:creative_trash;main;4,3.3;1,1;]
|
||||
listring[]
|
||||
tablecolumns[color;text;color;text]
|
||||
tableoptions[background=#00000000;highlight=#00000000;border=false]
|
||||
button[5.4,3.2;0.8,0.9;creative_prev;<]
|
||||
button[7.25,3.2;0.8,0.9;creative_next;>]
|
||||
button[2.1,3.4;0.8,0.5;creative_search;?]
|
||||
button[2.75,3.4;0.8,0.5;creative_clear;X]
|
||||
tooltip[creative_search;Search]
|
||||
tooltip[creative_clear;Reset]
|
||||
listring[current_player;main]
|
||||
]] ..
|
||||
"field[0.3,3.5;2.2,1;creative_filter;;" .. inv.filter .. "]" ..
|
||||
"listring[detached:creative_" .. player_name .. ";main]" ..
|
||||
"tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;" .. tostring(inv.tab_id) .. ";true;false]" ..
|
||||
"list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
|
||||
"table[6.05,3.35;1.15,0.5;pagenum;#FFFF00," .. tostring(pagenum) .. ",#FFFFFF,/ " .. tostring(pagemax) .. "]" ..
|
||||
default.get_hotbar_bg(0,4.7) ..
|
||||
default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
.. creative.formspec_add
|
||||
)
|
||||
end
|
||||
|
||||
creative.set_crafting_formspec = function(player)
|
||||
player:set_inventory_formspec([[
|
||||
size[8,8.6]
|
||||
list[current_player;craft;2,0.75;3,3;]
|
||||
list[current_player;craftpreview;6,1.75;1,1;]
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
list[detached:creative_trash;main;0,2.75;1,1;]
|
||||
image[0.06,2.85;0.8,0.8;creative_trash_icon.png]
|
||||
image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270]
|
||||
tabheader[0,0;creative_tabs;Crafting,All,Nodes,Tools,Items;1;true;false]
|
||||
listring[current_player;main]
|
||||
listring[current_player;craft]
|
||||
]] ..
|
||||
default.get_hotbar_bg(0,4.7) ..
|
||||
default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
)
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
-- If in creative mode, modify player's inventory forms
|
||||
if not creative_mode then
|
||||
return
|
||||
end
|
||||
creative.init_creative_inventory(player)
|
||||
creative.set_creative_formspec(player, 0)
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "" or not creative_mode then
|
||||
return
|
||||
end
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
|
||||
if fields.quit then
|
||||
if inv.tab_id == 1 then
|
||||
creative.set_crafting_formspec(player)
|
||||
end
|
||||
elseif fields.creative_tabs then
|
||||
local tab = tonumber(fields.creative_tabs)
|
||||
inv.tab_id = tab
|
||||
|
||||
if tab == 1 then
|
||||
creative.set_crafting_formspec(player)
|
||||
else
|
||||
creative.update_creative_inventory(player_name)
|
||||
creative.set_creative_formspec(player, 0)
|
||||
end
|
||||
elseif fields.creative_clear then
|
||||
inv.filter = ""
|
||||
creative.update_creative_inventory(player_name)
|
||||
creative.set_creative_formspec(player, 0)
|
||||
elseif fields.creative_search then
|
||||
inv.filter = fields.creative_filter:lower()
|
||||
creative.update_creative_inventory(player_name)
|
||||
creative.set_creative_formspec(player, 0)
|
||||
else
|
||||
local formspec = player:get_inventory_formspec()
|
||||
local start_i = player_inventory[player_name].start_i or 0
|
||||
|
||||
if fields.creative_prev then
|
||||
start_i = start_i - 3*8
|
||||
if start_i < 0 then
|
||||
start_i = inv.size - (inv.size % (3*8))
|
||||
if inv.size == start_i then
|
||||
start_i = math.max(0, inv.size - (3*8))
|
||||
end
|
||||
end
|
||||
elseif fields.creative_next then
|
||||
start_i = start_i + 3*8
|
||||
if start_i >= inv.size then
|
||||
start_i = 0
|
||||
end
|
||||
end
|
||||
|
||||
player_inventory[player_name].start_i = start_i
|
||||
creative.set_creative_formspec(player, start_i)
|
||||
end
|
||||
end)
|
||||
|
||||
if creative_mode then
|
||||
local digtime = 0.5
|
||||
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 3}
|
||||
if creative_mode_cache then
|
||||
-- Dig time is modified according to difference (leveldiff) between tool
|
||||
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
|
||||
-- leveldiff and 1.
|
||||
-- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been
|
||||
-- increased such that nodes of differing levels have an insignificant
|
||||
-- effect on digtime.
|
||||
local digtime = 42
|
||||
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
|
||||
|
||||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
|
@ -239,23 +36,28 @@ if creative_mode then
|
|||
damage_groups = {fleshy = 10},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
return true
|
||||
end)
|
||||
-- Unlimited node placement
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
return creative.is_enabled_for(placer:get_player_name())
|
||||
end)
|
||||
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
-- Don't pick up if the item is already in the inventory
|
||||
local old_handle_node_drops = minetest.handle_node_drops
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
if not digger or not digger:is_player() then
|
||||
return
|
||||
end
|
||||
if not creative.is_enabled_for(digger:get_player_name()) then
|
||||
return old_handle_node_drops(pos, drops, digger)
|
||||
end
|
||||
local inv = digger:get_inventory()
|
||||
if inv then
|
||||
for _, item in ipairs(drops) do
|
||||
item = ItemStack(item):get_name()
|
||||
if not inv:contains_item("main", item) then
|
||||
if not inv:contains_item("main", item, true) then
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
local player_inventory = {}
|
||||
|
||||
function creative.init_creative_inventory(player)
|
||||
local player_name = player:get_player_name()
|
||||
player_inventory[player_name] = {
|
||||
size = 0,
|
||||
filter = "",
|
||||
start_i = 0
|
||||
}
|
||||
|
||||
minetest.create_detached_inventory("creative_" .. player_name, {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
||||
if not to_list == "main" then
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_put = function(inv, listname, index, stack, player2)
|
||||
return 0
|
||||
end,
|
||||
allow_take = function(inv, listname, index, stack, player2)
|
||||
return -1
|
||||
end,
|
||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player2)
|
||||
end,
|
||||
on_take = function(inv, listname, index, stack, player2)
|
||||
if stack and stack:get_count() > 0 then
|
||||
minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory")
|
||||
end
|
||||
end,
|
||||
}, player_name)
|
||||
|
||||
return player_inventory[player_name]
|
||||
end
|
||||
|
||||
function creative.update_creative_inventory(player_name, tab_content)
|
||||
local creative_list = {}
|
||||
local inv = player_inventory[player_name] or
|
||||
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
|
||||
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
|
||||
|
||||
for name, def in pairs(tab_content) do
|
||||
if not (def.groups.not_in_creative_inventory == 1) and
|
||||
def.description and def.description ~= "" and
|
||||
(def.name:find(inv.filter, 1, true) or
|
||||
def.description:lower():find(inv.filter, 1, true)) then
|
||||
creative_list[#creative_list+1] = name
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(creative_list)
|
||||
player_inv:set_size("main", #creative_list)
|
||||
player_inv:set_list("main", creative_list)
|
||||
inv.size = #creative_list
|
||||
end
|
||||
|
||||
-- Create the trash field
|
||||
local trash = minetest.create_detached_inventory("creative_trash", {
|
||||
-- Allow the stack to be placed and remove it in on_put()
|
||||
-- This allows the creative inventory to restore the stack
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
return stack:get_count()
|
||||
end,
|
||||
on_put = function(inv, listname)
|
||||
inv:set_list(listname, {})
|
||||
end,
|
||||
})
|
||||
trash:set_size("main", 1)
|
||||
|
||||
creative.formspec_add = ""
|
||||
|
||||
function creative.register_tab(name, title, items)
|
||||
sfinv.register_page("creative:" .. name, {
|
||||
title = title,
|
||||
is_in_nav = function(self, player, context)
|
||||
return creative.is_enabled_for(player:get_player_name())
|
||||
end,
|
||||
get = function(self, player, context)
|
||||
local player_name = player:get_player_name()
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
local inv = player_inventory[player_name]
|
||||
local start_i = inv.start_i or 0
|
||||
local pagenum = math.floor(start_i / (3*8) + 1)
|
||||
local pagemax = math.ceil(inv.size / (3*8))
|
||||
return sfinv.make_formspec(player, context,
|
||||
"label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" ..
|
||||
[[
|
||||
image[4.06,3.4;0.8,0.8;creative_trash_icon.png]
|
||||
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
list[detached:creative_trash;main;4,3.3;1,1;]
|
||||
listring[]
|
||||
button[5.4,3.2;0.8,0.9;creative_prev;<]
|
||||
button[7.25,3.2;0.8,0.9;creative_next;>]
|
||||
button[2.1,3.4;0.8,0.5;creative_search;?]
|
||||
button[2.75,3.4;0.8,0.5;creative_clear;X]
|
||||
tooltip[creative_search;Search]
|
||||
tooltip[creative_clear;Reset]
|
||||
listring[current_player;main]
|
||||
field_close_on_enter[creative_filter;false]
|
||||
]] ..
|
||||
"field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" ..
|
||||
"listring[detached:creative_" .. player_name .. ";main]" ..
|
||||
"list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
|
||||
default.get_hotbar_bg(0,4.7) ..
|
||||
default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||
.. creative.formspec_add, false)
|
||||
end,
|
||||
on_enter = function(self, player, context)
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
if inv then
|
||||
inv.start_i = 0
|
||||
end
|
||||
end,
|
||||
on_player_receive_fields = function(self, player, context, fields)
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
assert(inv)
|
||||
|
||||
if fields.creative_clear then
|
||||
inv.start_i = 0
|
||||
inv.filter = ""
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
elseif fields.creative_search or
|
||||
fields.key_enter_field == "creative_filter" then
|
||||
inv.start_i = 0
|
||||
inv.filter = fields.creative_filter:lower()
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
elseif not fields.quit then
|
||||
local start_i = inv.start_i or 0
|
||||
|
||||
if fields.creative_prev then
|
||||
start_i = start_i - 3*8
|
||||
if start_i < 0 then
|
||||
start_i = inv.size - (inv.size % (3*8))
|
||||
if inv.size == start_i then
|
||||
start_i = math.max(0, inv.size - (3*8))
|
||||
end
|
||||
end
|
||||
elseif fields.creative_next then
|
||||
start_i = start_i + 3*8
|
||||
if start_i >= inv.size then
|
||||
start_i = 0
|
||||
end
|
||||
end
|
||||
|
||||
inv.start_i = start_i
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
creative.update_creative_inventory(player:get_player_name(), minetest.registered_items)
|
||||
end)
|
||||
|
||||
creative.register_tab("all", "All", minetest.registered_items)
|
||||
creative.register_tab("nodes", "Nodes", minetest.registered_nodes)
|
||||
creative.register_tab("tools", "Tools", minetest.registered_tools)
|
||||
creative.register_tab("craftitems", "Items", minetest.registered_craftitems)
|
||||
|
||||
local old_homepage_name = sfinv.get_homepage_name
|
||||
function sfinv.get_homepage_name(player)
|
||||
if creative.is_enabled_for(player:get_player_name()) then
|
||||
return "creative:all"
|
||||
else
|
||||
return old_homepage_name(player)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,60 @@
|
|||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
|
||||
|
||||
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 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
|
||||
|
||||
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/
|
|
@ -1,62 +1,62 @@
|
|||
Minetest Game mod: doors
|
||||
========================
|
||||
version: 2.0
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2012 PilzAdam
|
||||
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
|
||||
Steel trapdoor added by sofar.
|
||||
Copyright (C) 2016 sofar@foo-projects.org
|
||||
Re-implemented most of the door algorithms, added meshes, UV wrapped texture
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by PilzAdam (MIT)
|
||||
|
||||
Modified by BlockMen (MIT): Added sounds, glass doors (glass, obsidian glass) and trapdoor.
|
||||
|
||||
Modified by sofar (sofar@foo-projects.org) (MIT):
|
||||
Added Steel trapdoor.
|
||||
Re-implemented most of the door algorithms, added meshes, UV wrapped texture.
|
||||
Added doors API to facilitate coding mods accessing and operating doors.
|
||||
Added Fence Gate model, code, and sounds
|
||||
Added Fence Gate model, code, and sounds.
|
||||
|
||||
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.
|
||||
Various Minetest developers and contributors (MIT)
|
||||
|
||||
License of textures
|
||||
--------------------------------------
|
||||
following Textures created by Fernando Zapata (CC BY-SA 3.0):
|
||||
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
Following textures created by Fernando Zapata (CC BY-SA 3.0):
|
||||
door_wood.png
|
||||
door_wood_a.png
|
||||
door_wood_a_r.png
|
||||
door_wood_b.png
|
||||
door_wood_b_r.png
|
||||
|
||||
following Textures created by BlockMen (WTFPL):
|
||||
Following textures created by BlockMen (CC BY-SA 3.0):
|
||||
door_trapdoor.png
|
||||
door_obsidian_glass_side.png
|
||||
|
||||
following textures created by celeron55 (CC BY-SA 3.0):
|
||||
Following textures created by celeron55 (CC BY-SA 3.0):
|
||||
door_glass_a.png
|
||||
door_glass_b.png
|
||||
|
||||
following Textures created by PenguinDad (CC BY-SA 4.0):
|
||||
Following textures created by PenguinDad (CC BY-SA 4.0):
|
||||
door_glass.png
|
||||
door_obsidian_glass.png
|
||||
|
||||
following textures created by sofar (CC-BY-SA-3.0)
|
||||
Following textures created by sofar (CC-BY-SA-3.0):
|
||||
doors_trapdoor_steel.png
|
||||
doors_trapdoor_steel_side.png
|
||||
door_trapdoor_side.png
|
||||
|
||||
|
||||
Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen: WTFPL
|
||||
Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen (CC BY-SA 3.0):
|
||||
door_obsidian_glass.png
|
||||
|
||||
Glass door textures by red-001 based on textures by celeron55: CC BY-SA 3.0
|
||||
Glass door textures by red-001 based on textures by celeron55 (CC BY-SA 3.0):
|
||||
door_glass.png
|
||||
All other textures (created by PilzAdam): WTFPL
|
||||
|
||||
All other textures (created by PilzAdam) (CC BY-SA 3.0):
|
||||
|
||||
Door textures were converted to the new texture map by sofar, paramat and
|
||||
red-001, under the same license as the originals.
|
||||
|
||||
Models:
|
||||
--------------------------------------
|
||||
|
||||
Authors of media (models)
|
||||
-------------------------
|
||||
Door 3d models by sofar (CC-BY-SA-3.0)
|
||||
- door_a.obj
|
||||
- door_b.obj
|
||||
|
@ -64,18 +64,21 @@ Fence gate models by sofar (CC-BY-SA-3.0)
|
|||
- fencegate_open.obj
|
||||
- fencegate_closed.obj
|
||||
|
||||
License of sounds
|
||||
--------------------------------------
|
||||
|
||||
Authors of media (sounds)
|
||||
-------------------------
|
||||
Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen
|
||||
door_open.ogg
|
||||
Closing-Sound created by bennstir (CC BY 3.0)
|
||||
door_close.ogg
|
||||
fencegate_open.ogg:
|
||||
http://www.freesound.org/people/mhtaylor67/sounds/126041/ - CC0
|
||||
http://www.freesound.org/people/mhtaylor67/sounds/126041/ - (CC0 1.0)
|
||||
fencegate_close.ogg:
|
||||
http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - CC-BY-3.0
|
||||
http://www.freesound.org/people/rivernile7/sounds/249573/ - CC-BY-3.0
|
||||
Steel door sounds (open & close (CC-BY-3.0) by HazMatt
|
||||
http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - (CC-BY-3.0)
|
||||
http://www.freesound.org/people/rivernile7/sounds/249573/ - (CC-BY-3.0)
|
||||
Steel door sounds open & close (CC-BY-3.0) by HazMatt
|
||||
- http://www.freesound.org/people/HazMattt/sounds/187283/
|
||||
doors_steel_door_open.ogg
|
||||
doors_steel_door_close.ogg
|
||||
doors_glass_door_open.ogg, doors_glass_door_close.ogg:
|
||||
https://www.freesound.org/people/SkeetMasterFunk69/sounds/235546/ (CC0 1.0)
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
|
||||
--[[
|
||||
|
||||
Copyright (C) 2012 PilzAdam
|
||||
modified by BlockMen (added sounds, glassdoors[glass, obsidian glass], trapdoor)
|
||||
Copyright (C) 2015 - Auke Kok <sofar@foo-projects.org>
|
||||
|
||||
--]]
|
||||
|
||||
-- our API object
|
||||
doors = {}
|
||||
|
||||
|
@ -15,9 +6,19 @@ local _doors = {}
|
|||
_doors.registered_doors = {}
|
||||
_doors.registered_trapdoors = {}
|
||||
|
||||
local function replace_old_owner_information(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("doors_owner")
|
||||
if owner and owner ~= "" then
|
||||
meta:set_string("owner", owner)
|
||||
meta:set_string("doors_owner", "")
|
||||
end
|
||||
end
|
||||
|
||||
-- returns an object to a door object or nil
|
||||
function doors.get(pos)
|
||||
if _doors.registered_doors[minetest.get_node(pos).name] then
|
||||
local node_name = minetest.get_node(pos).name
|
||||
if _doors.registered_doors[node_name] then
|
||||
-- A normal upright door
|
||||
return {
|
||||
pos = pos,
|
||||
|
@ -25,23 +26,23 @@ function doors.get(pos)
|
|||
if self:state() then
|
||||
return false
|
||||
end
|
||||
return _doors.door_toggle(self.pos, player)
|
||||
return _doors.door_toggle(self.pos, nil, player)
|
||||
end,
|
||||
close = function(self, player)
|
||||
if not self:state() then
|
||||
return false
|
||||
end
|
||||
return _doors.door_toggle(self.pos, player)
|
||||
return _doors.door_toggle(self.pos, nil, player)
|
||||
end,
|
||||
toggle = function(self, player)
|
||||
return _doors.door_toggle(self.pos, player)
|
||||
return _doors.door_toggle(self.pos, nil, player)
|
||||
end,
|
||||
state = function(self)
|
||||
local state = minetest.get_meta(self.pos):get_int("state")
|
||||
return state %2 == 1
|
||||
end
|
||||
}
|
||||
elseif _doors.registered_trapdoors[minetest.get_node(pos).name] then
|
||||
elseif _doors.registered_trapdoors[node_name] then
|
||||
-- A trapdoor
|
||||
return {
|
||||
pos = pos,
|
||||
|
@ -49,20 +50,19 @@ function doors.get(pos)
|
|||
if self:state() then
|
||||
return false
|
||||
end
|
||||
return _doors.trapdoor_toggle(self.pos, player)
|
||||
return _doors.trapdoor_toggle(self.pos, nil, player)
|
||||
end,
|
||||
close = function(self, player)
|
||||
if not self:state() then
|
||||
return false
|
||||
end
|
||||
return _doors.trapdoor_toggle(self.pos, player)
|
||||
return _doors.trapdoor_toggle(self.pos, nil, player)
|
||||
end,
|
||||
toggle = function(self, player)
|
||||
return _doors.trapdoor_toggle(self.pos, player)
|
||||
return _doors.trapdoor_toggle(self.pos, nil, player)
|
||||
end,
|
||||
state = function(self)
|
||||
local name = minetest.get_node(pos).name
|
||||
return name:sub(-5) == "_open"
|
||||
return minetest.get_node(self.pos).name:sub(-5) == "_open"
|
||||
end
|
||||
}
|
||||
else
|
||||
|
@ -91,7 +91,7 @@ minetest.register_node("doors:hidden", {
|
|||
on_blast = function() end,
|
||||
tiles = {"doors_blank.png"},
|
||||
-- 1px transparent block inside door hinge near node top.
|
||||
nodebox = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32},
|
||||
},
|
||||
|
@ -105,56 +105,55 @@ minetest.register_node("doors:hidden", {
|
|||
-- table used to aid door opening/closing
|
||||
local transform = {
|
||||
{
|
||||
{ v = "_a", param2 = 3 },
|
||||
{ v = "_a", param2 = 0 },
|
||||
{ v = "_a", param2 = 1 },
|
||||
{ v = "_a", param2 = 2 },
|
||||
{v = "_a", param2 = 3},
|
||||
{v = "_a", param2 = 0},
|
||||
{v = "_a", param2 = 1},
|
||||
{v = "_a", param2 = 2},
|
||||
},
|
||||
{
|
||||
{ v = "_b", param2 = 1 },
|
||||
{ v = "_b", param2 = 2 },
|
||||
{ v = "_b", param2 = 3 },
|
||||
{ v = "_b", param2 = 0 },
|
||||
{v = "_b", param2 = 1},
|
||||
{v = "_b", param2 = 2},
|
||||
{v = "_b", param2 = 3},
|
||||
{v = "_b", param2 = 0},
|
||||
},
|
||||
{
|
||||
{ v = "_b", param2 = 1 },
|
||||
{ v = "_b", param2 = 2 },
|
||||
{ v = "_b", param2 = 3 },
|
||||
{ v = "_b", param2 = 0 },
|
||||
{v = "_b", param2 = 1},
|
||||
{v = "_b", param2 = 2},
|
||||
{v = "_b", param2 = 3},
|
||||
{v = "_b", param2 = 0},
|
||||
},
|
||||
{
|
||||
{ v = "_a", param2 = 3 },
|
||||
{ v = "_a", param2 = 0 },
|
||||
{ v = "_a", param2 = 1 },
|
||||
{ v = "_a", param2 = 2 },
|
||||
{v = "_a", param2 = 3},
|
||||
{v = "_a", param2 = 0},
|
||||
{v = "_a", param2 = 1},
|
||||
{v = "_a", param2 = 2},
|
||||
},
|
||||
}
|
||||
|
||||
function _doors.door_toggle(pos, clicker)
|
||||
function _doors.door_toggle(pos, node, clicker)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local def = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
node = node or minetest.get_node(pos)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
local name = def.door.name
|
||||
|
||||
local state = meta:get_string("state")
|
||||
if state == "" then
|
||||
-- fix up lvm-placed right-hinged doors, default closed
|
||||
if minetest.get_node(pos).name:sub(-2) == "_b" then
|
||||
if node.name:sub(-2) == "_b" then
|
||||
state = 2
|
||||
else
|
||||
state = 0
|
||||
end
|
||||
else
|
||||
state = tonumber(state)
|
||||
end
|
||||
|
||||
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
|
||||
local owner = meta:get_string("doors_owner")
|
||||
if owner ~= "" then
|
||||
if clicker:get_player_name() ~= owner then
|
||||
replace_old_owner_information(pos)
|
||||
|
||||
if clicker and not default.can_interact_with_node(clicker, pos) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local old = state
|
||||
-- until Lua-5.2 we have no bitwise operators :(
|
||||
if state % 2 == 1 then
|
||||
state = state - 1
|
||||
|
@ -162,11 +161,13 @@ function _doors.door_toggle(pos, clicker)
|
|||
state = state + 1
|
||||
end
|
||||
|
||||
local dir = minetest.get_node(pos).param2
|
||||
local dir = node.param2
|
||||
if state % 2 == 0 then
|
||||
minetest.sound_play(def.door.sounds[1], {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.sound_play(def.door.sounds[1],
|
||||
{pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
else
|
||||
minetest.sound_play(def.door.sounds[2], {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.sound_play(def.door.sounds[2],
|
||||
{pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
end
|
||||
|
||||
minetest.swap_node(pos, {
|
||||
|
@ -179,21 +180,34 @@ function _doors.door_toggle(pos, clicker)
|
|||
end
|
||||
|
||||
|
||||
local function on_place_node(place_to, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||
local function on_place_node(place_to, newnode,
|
||||
placer, oldnode, itemstack, pointed_thing)
|
||||
-- Run script hook
|
||||
local _, callback
|
||||
for _, callback in ipairs(core.registered_on_placenodes) do
|
||||
for _, callback in ipairs(minetest.registered_on_placenodes) do
|
||||
-- Deepcopy pos, node and pointed_thing because callback can modify them
|
||||
local place_to_copy = {x = place_to.x, y = place_to.y, z = place_to.z}
|
||||
local newnode_copy = {name = newnode.name, param1 = newnode.param1, param2 = newnode.param2}
|
||||
local oldnode_copy = {name = oldnode.name, param1 = oldnode.param1, param2 = oldnode.param2}
|
||||
local newnode_copy =
|
||||
{name = newnode.name, param1 = newnode.param1, param2 = newnode.param2}
|
||||
local oldnode_copy =
|
||||
{name = oldnode.name, param1 = oldnode.param1, param2 = oldnode.param2}
|
||||
local pointed_thing_copy = {
|
||||
type = pointed_thing.type,
|
||||
above = vector.new(pointed_thing.above),
|
||||
under = vector.new(pointed_thing.under),
|
||||
ref = pointed_thing.ref,
|
||||
}
|
||||
callback(place_to_copy, newnode_copy, placer, oldnode_copy, itemstack, pointed_thing_copy)
|
||||
callback(place_to_copy, newnode_copy, placer,
|
||||
oldnode_copy, itemstack, pointed_thing_copy)
|
||||
end
|
||||
end
|
||||
|
||||
local function can_dig_door(pos, digger)
|
||||
replace_old_owner_information(pos)
|
||||
if default.can_interact_with_node(digger, pos) then
|
||||
return true
|
||||
else
|
||||
minetest.record_protection_violation(pos, digger:get_player_name())
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -212,8 +226,8 @@ function doors.register(name, def)
|
|||
local h = meta:get_int("right") + 1
|
||||
local p2 = node.param2
|
||||
local replace = {
|
||||
{ { type = "a", state = 0 }, { type = "a", state = 3 } },
|
||||
{ { type = "b", state = 1 }, { type = "b", state = 2 } }
|
||||
{{type = "a", state = 0}, {type = "a", state = 3}},
|
||||
{{type = "b", state = 1}, {type = "b", state = 2}}
|
||||
}
|
||||
local new = replace[l][h]
|
||||
-- retain infotext and doors_owner fields
|
||||
|
@ -240,9 +254,10 @@ function doors.register(name, def)
|
|||
minetest.register_craftitem(":" .. name, {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
groups = table.copy(def.groups),
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = nil
|
||||
local pos
|
||||
|
||||
if not pointed_thing.type == "node" then
|
||||
return itemstack
|
||||
|
@ -250,9 +265,10 @@ function doors.register(name, def)
|
|||
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local pdef = minetest.registered_nodes[node.name]
|
||||
if pdef and pdef.on_rightclick then
|
||||
if pdef and pdef.on_rightclick and
|
||||
not placer:get_player_control().sneak then
|
||||
return pdef.on_rightclick(pointed_thing.under,
|
||||
node, placer, itemstack)
|
||||
node, placer, itemstack, pointed_thing)
|
||||
end
|
||||
|
||||
if pdef and pdef.buildable_to then
|
||||
|
@ -266,8 +282,11 @@ function doors.register(name, def)
|
|||
end
|
||||
end
|
||||
|
||||
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||
if not minetest.registered_nodes[minetest.get_node(above).name].buildable_to then
|
||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local top_node = minetest.get_node_or_nil(above)
|
||||
local topdef = top_node and minetest.registered_nodes[top_node.name]
|
||||
|
||||
if not topdef or not topdef.buildable_to then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
@ -279,10 +298,10 @@ function doors.register(name, def)
|
|||
local dir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
|
||||
local ref = {
|
||||
{ x = -1, y = 0, z = 0 },
|
||||
{ x = 0, y = 0, z = 1 },
|
||||
{ x = 1, y = 0, z = 0 },
|
||||
{ x = 0, y = 0, z = -1 },
|
||||
{x = -1, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = 1},
|
||||
{x = 1, y = 0, z = 0},
|
||||
{x = 0, y = 0, z = -1},
|
||||
}
|
||||
|
||||
local aside = {
|
||||
|
@ -305,35 +324,31 @@ function doors.register(name, def)
|
|||
meta:set_int("state", state)
|
||||
|
||||
if def.protected then
|
||||
local pn = placer:get_player_name()
|
||||
meta:set_string("doors_owner", pn)
|
||||
meta:set_string("owner", pn)
|
||||
meta:set_string("infotext", "Owned by " .. pn)
|
||||
end
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
on_place_node(pos, minetest.get_node(pos), placer, node, itemstack, pointed_thing)
|
||||
minetest.sound_play(def.sounds.place, {pos = pos})
|
||||
|
||||
on_place_node(pos, minetest.get_node(pos),
|
||||
placer, node, itemstack, pointed_thing)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
def.inventory_image = nil
|
||||
|
||||
local can_dig = function(pos, digger)
|
||||
if not def.protected then
|
||||
return true
|
||||
end
|
||||
if minetest.check_player_privs(digger, "protection_bypass") then
|
||||
return true
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local name = ""
|
||||
if digger then
|
||||
name = digger:get_player_name()
|
||||
end
|
||||
return meta:get_string("doors_owner") == name
|
||||
if def.recipe then
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = def.recipe,
|
||||
})
|
||||
end
|
||||
def.recipe = nil
|
||||
|
||||
if not def.sounds then
|
||||
def.sounds = default.node_sound_wood_defaults()
|
||||
|
@ -355,22 +370,46 @@ function doors.register(name, def)
|
|||
sounds = { def.sound_close, def.sound_open },
|
||||
}
|
||||
|
||||
def.on_rightclick = function(pos, node, clicker)
|
||||
_doors.door_toggle(pos, clicker)
|
||||
def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
_doors.door_toggle(pos, node, clicker)
|
||||
return itemstack
|
||||
end
|
||||
def.after_dig_node = function(pos, node, meta, digger)
|
||||
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
nodeupdate({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
end
|
||||
def.can_dig = function(pos, player)
|
||||
return can_dig(pos, player)
|
||||
minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
end
|
||||
def.on_rotate = function(pos, node, user, mode, new_param2)
|
||||
return false
|
||||
end
|
||||
|
||||
if def.protected then
|
||||
def.can_dig = can_dig_door
|
||||
def.on_blast = function() end
|
||||
def.on_key_use = function(pos, player)
|
||||
local door = doors.get(pos)
|
||||
door:toggle(player)
|
||||
end
|
||||
def.on_skeleton_key_use = function(pos, player, newsecret)
|
||||
replace_old_owner_information(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
local pname = player:get_player_name()
|
||||
|
||||
-- verify placer is owner of lockable door
|
||||
if owner ~= pname then
|
||||
minetest.record_protection_violation(pos, pname)
|
||||
minetest.chat_send_player(pname, "You do not own this locked door.")
|
||||
return nil
|
||||
end
|
||||
|
||||
local secret = meta:get_string("key_lock_secret")
|
||||
if secret == "" then
|
||||
secret = newsecret
|
||||
meta:set_string("key_lock_secret", secret)
|
||||
end
|
||||
|
||||
return secret, "a locked door", owner
|
||||
end
|
||||
else
|
||||
def.on_blast = function(pos, intensity)
|
||||
minetest.remove_node(pos)
|
||||
|
@ -384,76 +423,21 @@ function doors.register(name, def)
|
|||
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
end
|
||||
|
||||
minetest.register_node(":" .. name .. "_a", {
|
||||
description = def.description,
|
||||
visual = "mesh",
|
||||
mesh = "door_a.obj",
|
||||
tiles = def.tiles,
|
||||
drawtype = "mesh",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
walkable = true,
|
||||
is_ground_content = false,
|
||||
buildable_to = false,
|
||||
drop = def.drop,
|
||||
groups = def.groups,
|
||||
sounds = def.sounds,
|
||||
door = def.door,
|
||||
on_rightclick = def.on_rightclick,
|
||||
after_dig_node = def.after_dig_node,
|
||||
can_dig = def.can_dig,
|
||||
on_rotate = def.on_rotate,
|
||||
on_blast = def.on_blast,
|
||||
on_destruct = def.on_destruct,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -1/2,-1/2,-1/2,1/2,3/2,-6/16}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = { -1/2,-1/2,-1/2,1/2,3/2,-6/16}
|
||||
},
|
||||
})
|
||||
def.drawtype = "mesh"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.sunlight_propagates = true
|
||||
def.walkable = true
|
||||
def.is_ground_content = false
|
||||
def.buildable_to = false
|
||||
def.selection_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}}
|
||||
def.collision_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}}
|
||||
|
||||
minetest.register_node(":" .. name .. "_b", {
|
||||
description = def.description,
|
||||
visual = "mesh",
|
||||
mesh = "door_b.obj",
|
||||
tiles = def.tiles,
|
||||
drawtype = "mesh",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
walkable = true,
|
||||
is_ground_content = false,
|
||||
buildable_to = false,
|
||||
drop = def.drop,
|
||||
groups = def.groups,
|
||||
sounds = def.sounds,
|
||||
door = def.door,
|
||||
on_rightclick = def.on_rightclick,
|
||||
after_dig_node = def.after_dig_node,
|
||||
can_dig = def.can_dig,
|
||||
on_rotate = def.on_rotate,
|
||||
on_blast = def.on_blast,
|
||||
on_destruct = def.on_destruct,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -1/2,-1/2,-1/2,1/2,3/2,-6/16}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = { -1/2,-1/2,-1/2,1/2,3/2,-6/16}
|
||||
},
|
||||
})
|
||||
def.mesh = "door_a.obj"
|
||||
minetest.register_node(":" .. name .. "_a", def)
|
||||
|
||||
if def.recipe then
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = def.recipe,
|
||||
})
|
||||
end
|
||||
def.mesh = "door_b.obj"
|
||||
minetest.register_node(":" .. name .. "_b", def)
|
||||
|
||||
_doors.registered_doors[name .. "_a"] = true
|
||||
_doors.registered_doors[name .. "_b"] = true
|
||||
|
@ -463,7 +447,7 @@ doors.register("door_wood", {
|
|||
tiles = {{ name = "doors_door_wood.png", backface_culling = true }},
|
||||
description = "Wooden Door",
|
||||
inventory_image = "doors_item_wood.png",
|
||||
groups = { snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 },
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"group:wood", "group:wood"},
|
||||
|
@ -472,11 +456,12 @@ doors.register("door_wood", {
|
|||
})
|
||||
|
||||
doors.register("door_steel", {
|
||||
tiles = {{ name = "doors_door_steel.png", backface_culling = true }},
|
||||
tiles = {{name = "doors_door_steel.png", backface_culling = true}},
|
||||
description = "Steel Door",
|
||||
inventory_image = "doors_item_steel.png",
|
||||
protected = true,
|
||||
groups = { snappy = 1, bendy = 2, cracky = 1, melty = 2, level = 2 },
|
||||
groups = {cracky = 1, level = 2},
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
sound_open = "doors_steel_door_open",
|
||||
sound_close = "doors_steel_door_close",
|
||||
recipe = {
|
||||
|
@ -487,11 +472,13 @@ doors.register("door_steel", {
|
|||
})
|
||||
|
||||
doors.register("door_glass", {
|
||||
tiles = { "doors_door_glass.png"},
|
||||
tiles = {"doors_door_glass.png"},
|
||||
description = "Glass Door",
|
||||
inventory_image = "doors_item_glass.png",
|
||||
groups = { snappy=1, cracky=1, oddly_breakable_by_hand=3 },
|
||||
groups = {cracky=3, oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sound_open = "doors_glass_door_open",
|
||||
sound_close = "doors_glass_door_close",
|
||||
recipe = {
|
||||
{"default:glass", "default:glass"},
|
||||
{"default:glass", "default:glass"},
|
||||
|
@ -500,11 +487,13 @@ doors.register("door_glass", {
|
|||
})
|
||||
|
||||
doors.register("door_obsidian_glass", {
|
||||
tiles = { "doors_door_obsidian_glass.png" },
|
||||
tiles = {"doors_door_obsidian_glass.png"},
|
||||
description = "Obsidian Glass Door",
|
||||
inventory_image = "doors_item_obsidian_glass.png",
|
||||
groups = { snappy=1, cracky=1, oddly_breakable_by_hand=3 },
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
sound_open = "doors_glass_door_open",
|
||||
sound_close = "doors_glass_door_close",
|
||||
recipe = {
|
||||
{"default:obsidian_glass", "default:obsidian_glass"},
|
||||
{"default:obsidian_glass", "default:obsidian_glass"},
|
||||
|
@ -538,44 +527,41 @@ end
|
|||
|
||||
----trapdoor----
|
||||
|
||||
function _doors.trapdoor_toggle(pos, clicker)
|
||||
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("doors_owner")
|
||||
if owner ~= "" then
|
||||
if clicker:get_player_name() ~= owner then
|
||||
function _doors.trapdoor_toggle(pos, node, clicker)
|
||||
node = node or minetest.get_node(pos)
|
||||
|
||||
replace_old_owner_information(pos)
|
||||
|
||||
if clicker and not default.can_interact_with_node(clicker, pos) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
|
||||
if string.sub(node.name, -5) == "_open" then
|
||||
minetest.sound_play(def.sound_close, {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.swap_node(pos, {name = string.sub(node.name, 1, string.len(node.name) - 5), param1 = node.param1, param2 = node.param2})
|
||||
minetest.sound_play(def.sound_close,
|
||||
{pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.swap_node(pos, {name = string.sub(node.name, 1,
|
||||
string.len(node.name) - 5), param1 = node.param1, param2 = node.param2})
|
||||
else
|
||||
minetest.sound_play(def.sound_open, {pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.swap_node(pos, {name = node.name .. "_open", param1 = node.param1, param2 = node.param2})
|
||||
minetest.sound_play(def.sound_open,
|
||||
{pos = pos, gain = 0.3, max_hear_distance = 10})
|
||||
minetest.swap_node(pos, {name = node.name .. "_open",
|
||||
param1 = node.param1, param2 = node.param2})
|
||||
end
|
||||
end
|
||||
|
||||
function doors.register_trapdoor(name, def)
|
||||
if not name:find(":") then
|
||||
name = "doors:" .. name
|
||||
end
|
||||
|
||||
local name_closed = name
|
||||
local name_opened = name.."_open"
|
||||
|
||||
local function check_player_priv(pos, player)
|
||||
if not def.protected or minetest.check_player_privs(player, "protection_bypass") then
|
||||
return true
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local pn = player:get_player_name()
|
||||
return meta:get_string("doors_owner") == pn
|
||||
end
|
||||
|
||||
def.on_rightclick = function(pos, node, clicker)
|
||||
_doors.trapdoor_toggle(pos, clicker)
|
||||
def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
_doors.trapdoor_toggle(pos, node, clicker)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Common trapdoor configuration
|
||||
|
@ -583,24 +569,48 @@ function doors.register_trapdoor(name, def)
|
|||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.is_ground_content = false
|
||||
def.can_dig = check_player_priv
|
||||
|
||||
if def.protected then
|
||||
def.can_dig = can_dig_door
|
||||
def.after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local pn = placer:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("doors_owner", pn)
|
||||
meta:set_string("owner", pn)
|
||||
meta:set_string("infotext", "Owned by "..pn)
|
||||
|
||||
return minetest.setting_getbool("creative_mode")
|
||||
return (creative and creative.is_enabled_for and creative.is_enabled_for(pn))
|
||||
end
|
||||
|
||||
def.on_blast = function() end
|
||||
def.on_key_use = function(pos, player)
|
||||
local door = doors.get(pos)
|
||||
door:toggle(player)
|
||||
end
|
||||
def.on_skeleton_key_use = function(pos, player, newsecret)
|
||||
replace_old_owner_information(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
local pname = player:get_player_name()
|
||||
|
||||
-- verify placer is owner of lockable door
|
||||
if owner ~= pname then
|
||||
minetest.record_protection_violation(pos, pname)
|
||||
minetest.chat_send_player(pname, "You do not own this trapdoor.")
|
||||
return nil
|
||||
end
|
||||
|
||||
local secret = meta:get_string("key_lock_secret")
|
||||
if secret == "" then
|
||||
secret = newsecret
|
||||
meta:set_string("key_lock_secret", secret)
|
||||
end
|
||||
|
||||
return secret, "a locked trapdoor", owner
|
||||
end
|
||||
else
|
||||
def.on_blast = function(pos, intensity)
|
||||
minetest.remove_node(pos)
|
||||
minetest.remove_node({ x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
return { name }
|
||||
return {name}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -627,8 +637,10 @@ function doors.register_trapdoor(name, def)
|
|||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
|
||||
}
|
||||
def_closed.tiles = { def.tile_front, def.tile_front, def.tile_side, def.tile_side,
|
||||
def.tile_side, def.tile_side }
|
||||
def_closed.tiles = {def.tile_front,
|
||||
def.tile_front .. '^[transformFY',
|
||||
def.tile_side, def.tile_side,
|
||||
def.tile_side, def.tile_side}
|
||||
|
||||
def_opened.node_box = {
|
||||
type = "fixed",
|
||||
|
@ -638,10 +650,11 @@ function doors.register_trapdoor(name, def)
|
|||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5}
|
||||
}
|
||||
def_opened.tiles = { def.tile_side, def.tile_side,
|
||||
def_opened.tiles = {def.tile_side, def.tile_side,
|
||||
def.tile_side .. '^[transform3',
|
||||
def.tile_side .. '^[transform1',
|
||||
def.tile_front, def.tile_front }
|
||||
def.tile_front .. '^[transform46',
|
||||
def.tile_front .. '^[transform6'}
|
||||
|
||||
def_opened.drop = name_closed
|
||||
def_opened.groups.not_in_creative_inventory = 1
|
||||
|
@ -659,7 +672,7 @@ doors.register_trapdoor("doors:trapdoor", {
|
|||
wield_image = "doors_trapdoor.png",
|
||||
tile_front = "doors_trapdoor.png",
|
||||
tile_side = "doors_trapdoor_side.png",
|
||||
groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=2, door=1},
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, door = 1},
|
||||
})
|
||||
|
||||
doors.register_trapdoor("doors:trapdoor_steel", {
|
||||
|
@ -669,9 +682,10 @@ doors.register_trapdoor("doors:trapdoor_steel", {
|
|||
tile_front = "doors_trapdoor_steel.png",
|
||||
tile_side = "doors_trapdoor_steel_side.png",
|
||||
protected = true,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
sound_open = "doors_steel_door_open",
|
||||
sound_close = "doors_steel_door_close",
|
||||
groups = {snappy=1, bendy=2, cracky=1, melty=2, level=2, door=1},
|
||||
groups = {cracky = 1, level = 2, door = 1},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -698,21 +712,21 @@ function doors.register_fencegate(name, def)
|
|||
local fence = {
|
||||
description = def.description,
|
||||
drawtype = "mesh",
|
||||
tiles = { def.texture },
|
||||
tiles = {def.texture},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
drop = name .. "_closed",
|
||||
connect_sides = { "left", "right" },
|
||||
connect_sides = {"left", "right"},
|
||||
groups = def.groups,
|
||||
sounds = def.sounds,
|
||||
on_rightclick = function(pos, clicker)
|
||||
local node = minetest.get_node(pos)
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2})
|
||||
minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3,
|
||||
max_hear_distance = 8})
|
||||
return itemstack
|
||||
end,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
|
@ -743,7 +757,7 @@ function doors.register_fencegate(name, def)
|
|||
fence_open.collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-1/2, -1/2, -1/4, -3/8, 1/2, 1/4},
|
||||
{-5/8, -3/8, -14/16, -3/8, 3/8, 0}},
|
||||
{-1/2, -3/8, -1/2, -3/8, 3/8, 0}},
|
||||
}
|
||||
|
||||
minetest.register_node(":" .. name .. "_closed", fence_closed)
|
||||
|
@ -773,7 +787,7 @@ doors.register_fencegate("doors:gate_acacia_wood", {
|
|||
})
|
||||
|
||||
doors.register_fencegate("doors:gate_junglewood", {
|
||||
description = "Junglewood Fence Gate",
|
||||
description = "Jungle Wood Fence Gate",
|
||||
texture = "default_junglewood.png",
|
||||
material = "default:junglewood",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
|
||||
|
@ -783,12 +797,57 @@ doors.register_fencegate("doors:gate_pine_wood", {
|
|||
description = "Pine Fence Gate",
|
||||
texture = "default_pine_wood.png",
|
||||
material = "default:pine_wood",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
|
||||
groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}
|
||||
})
|
||||
|
||||
doors.register_fencegate("doors:gate_aspen_wood", {
|
||||
description = "Aspen Fence Gate",
|
||||
texture = "default_aspen_wood.png",
|
||||
material = "default:aspen_wood",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}
|
||||
groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}
|
||||
})
|
||||
|
||||
|
||||
----fuels----
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "doors:trapdoor",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "doors:door_wood",
|
||||
burntime = 14,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "doors:gate_wood_closed",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "doors:gate_acacia_wood_closed",
|
||||
burntime = 8,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "doors:gate_junglewood_closed",
|
||||
burntime = 9,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "doors:gate_pine_wood_closed",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "doors:gate_aspen_wood_closed",
|
||||
burntime = 5,
|
||||
})
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2014-2016 BlockMen
|
||||
Copyright (C) 2015-2016 sofar (sofar@foo-projects.org)
|
||||
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, models and sounds)
|
||||
-----------------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2011-2016 Fernando Zapata
|
||||
Copyright (C) 2014-2016 celeron55
|
||||
Copyright (C) 2012-2016 PilzAdam
|
||||
Copyright (C) 2014-2016 BlockMen
|
||||
Copyright (C) 2015-2016 sofar
|
||||
Copyright (C) 2016 red-001
|
||||
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.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
-----------------------
|
||||
|
||||
Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||||
Copyright (C) 2014-2016 PenguinDad
|
||||
|
||||
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/4.0/
|
||||
|
||||
-----------------------
|
||||
|
||||
Attribution 3.0 Unported (CC BY 3.0)
|
||||
Copyright (C) 2014 CGEffex
|
||||
Copyright (C) 2014 bennstir
|
||||
Copyright (C) 2016 BarkersPinhead
|
||||
Copyright (C) 2016 rivernile7
|
||||
Copyright (C) 2016 HazMatt
|
||||
|
||||
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.
|
||||
|
||||
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/3.0/
|
||||
|
||||
-----------------------
|
||||
|
||||
CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
||||
mhtaylor67
|
||||
SkeetMasterFunk69
|
||||
|
||||
No Copyright
|
||||
|
||||
The person who associated a work with this deed has dedicated the work to the public
|
||||
domain by waiving all of his or her rights to the work worldwide under copyright law,
|
||||
including all related and neighboring rights, to the extent allowed by law.
|
||||
|
||||
You can copy, modify, distribute and perform the work, even for commercial purposes, all
|
||||
without asking permission. See Other Information below.
|
||||
|
||||
Other Information
|
||||
|
||||
In no way are the patent or trademark rights of any person affected by CC0, nor are the
|
||||
rights that other persons may have in the work or in how the work is used, such as
|
||||
publicity or privacy rights.
|
||||
Unless expressly stated otherwise, the person who associated a work with this deed makes
|
||||
no warranties about the work, and disclaims liability for all uses of the work, to the
|
||||
fullest extent permitted by applicable law.
|
||||
When using or citing the work, you should not imply endorsement by the author or the
|
||||
affirmer.
|
||||
|
||||
For more details:
|
||||
https://creativecommons.org/publicdomain/zero/1.0/
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 420 B |