mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 14:16:06 +02:00
Update minetestforfun_game, fix maptools
This commit is contained in:
42
minetestforfun_game/mods/fire/README.txt
Executable file → Normal file
42
minetestforfun_game/mods/fire/README.txt
Executable file → Normal file
@ -1,36 +1,28 @@
|
||||
Minetest Game mod: fire
|
||||
=======================
|
||||
See license.txt for license information.
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by Perttu Ahola (celeron55) <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
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.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
License of media (textures and sounds)
|
||||
Authors 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) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
|
||||
fire_small.ogg sampled from:
|
||||
http://www.freesound.org/people/dobroide/sounds/4211/
|
||||
|
||||
fire_large.ogg sampled from:
|
||||
http://www.freesound.org/people/Dynamicell/sounds/17548/
|
||||
Copyright (C) 2012 Perttu Ahola (celeron55) <celeron55@gmail.com> (CC BY-SA 3.0)
|
||||
|
||||
fire_basic_flame_animated.png:
|
||||
Muadtralk
|
||||
Muadtralk (CC BY-SA 3.0)
|
||||
|
||||
fire_flint_steel.png
|
||||
Gambit (WTFPL)
|
||||
Gambit (CC BY-SA 3.0)
|
||||
|
||||
fire_small.ogg sampled from:
|
||||
http://www.freesound.org/people/dobroide/sounds/4211/ (CC BY 3.0)
|
||||
|
||||
fire_large.ogg sampled from:
|
||||
http://www.freesound.org/people/Dynamicell/sounds/17548/ (CC BY 3.0)
|
||||
|
||||
fire_flint_and_steel.ogg
|
||||
https://www.freesound.org/people/Benboncan/sounds/66457/ (CC BY 3.0)
|
||||
|
1
minetestforfun_game/mods/fire/depends.txt
Normal file
1
minetestforfun_game/mods/fire/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
@ -28,14 +28,24 @@ minetest.register_node("fire:basic_flame", {
|
||||
sunlight_propagates = true,
|
||||
damage_per_second = 4,
|
||||
groups = {igniter = 2, dig_immediate = 3, not_in_creative_inventory = 1},
|
||||
on_timer = function(pos)
|
||||
local f = minetest.find_node_near(pos, 1, {"group:flammable"})
|
||||
if not f then
|
||||
minetest.remove_node(pos)
|
||||
return
|
||||
end
|
||||
-- restart timer
|
||||
return true
|
||||
end,
|
||||
drop = "",
|
||||
|
||||
on_construct = function(pos)
|
||||
minetest.after(0, fire.on_flame_add_at, pos)
|
||||
minetest.get_node_timer(pos):start(math.random(30, 60))
|
||||
minetest.after(0, fire.update_sounds_around, pos)
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
minetest.after(0, fire.on_flame_remove_at, pos)
|
||||
minetest.after(0, fire.update_sounds_around, pos)
|
||||
end,
|
||||
|
||||
on_blast = function()
|
||||
@ -70,26 +80,37 @@ minetest.register_node("fire:permanent_flame", {
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- Flint and steel
|
||||
|
||||
minetest.register_tool("fire:flint_and_steel", {
|
||||
description = "Flint and Steel",
|
||||
inventory_image = "fire_flint_steel.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local player_name = user:get_player_name()
|
||||
local pt = pointed_thing
|
||||
|
||||
if pt.type == "node" and minetest.get_node(pt.above).name == "air" then
|
||||
itemstack:add_wear(1000)
|
||||
minetest.sound_play(
|
||||
"fire_flint_and_steel",
|
||||
{pos = pt.above, gain = 0.6, max_hear_distance = 8}
|
||||
)
|
||||
itemstack:add_wear(1000)
|
||||
if pt.type == "node" then
|
||||
local node_under = minetest.get_node(pt.under).name
|
||||
|
||||
if minetest.get_item_group(node_under, "flammable") >= 1 then
|
||||
if not minetest.is_protected(pt.above, player_name) then
|
||||
minetest.set_node(pt.above, {name = "fire:basic_flame"})
|
||||
else
|
||||
minetest.chat_send_player(player_name, "This area is protected")
|
||||
end
|
||||
local nodedef = minetest.registered_nodes[node_under]
|
||||
if not nodedef then
|
||||
return
|
||||
end
|
||||
local player_name = user:get_player_name()
|
||||
if minetest.is_protected(pt.under, player_name) then
|
||||
minetest.chat_send_player(player_name, "This area is protected")
|
||||
return
|
||||
end
|
||||
if nodedef.on_ignite then
|
||||
nodedef.on_ignite(pt.under, user)
|
||||
elseif minetest.get_item_group(node_under, "flammable") >= 1
|
||||
and minetest.get_node(pt.above).name == "air" then
|
||||
minetest.set_node(pt.above, {name = "fire:basic_flame"})
|
||||
end
|
||||
end
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
return itemstack
|
||||
end
|
||||
@ -103,6 +124,25 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
-- Override coalblock to enable permanent flame above
|
||||
-- Coalblock is non-flammable to avoid unwanted basic_flame nodes
|
||||
|
||||
minetest.override_item("default:coalblock", {
|
||||
after_destruct = function(pos, oldnode)
|
||||
pos.y = pos.y + 1
|
||||
if minetest.get_node(pos).name == "fire:permanent_flame" then
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end,
|
||||
on_ignite = function(pos, igniter)
|
||||
local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
if minetest.get_node(flame_pos).name == "air" then
|
||||
minetest.set_node(flame_pos, {name = "fire:permanent_flame"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Get sound area of position
|
||||
|
||||
fire.D = 6 -- size of sound areas
|
||||
@ -169,118 +209,83 @@ function fire.update_sounds_around(pos)
|
||||
end
|
||||
|
||||
|
||||
-- Update fire sounds on flame node construct or destruct
|
||||
|
||||
function fire.on_flame_add_at(pos)
|
||||
fire.update_sounds_around(pos)
|
||||
end
|
||||
|
||||
|
||||
function fire.on_flame_remove_at(pos)
|
||||
fire.update_sounds_around(pos)
|
||||
end
|
||||
|
||||
|
||||
-- Return positions for flames around a burning node
|
||||
|
||||
function fire.find_pos_for_flame_around(pos)
|
||||
return minetest.find_node_near(pos, 1, {"air"})
|
||||
end
|
||||
|
||||
|
||||
-- Detect nearby extinguishing nodes
|
||||
|
||||
function fire.flame_should_extinguish(pos)
|
||||
return minetest.find_node_near(pos, 1, {"group:puts_out_fire"})
|
||||
end
|
||||
|
||||
|
||||
--[[ Extinguish all flames quickly with water, snow, ice
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Extinguish flame",
|
||||
nodenames = {"fire:basic_flame", "fire:permanent_flame"},
|
||||
neighbors = {"group:puts_out_fire"},
|
||||
interval = 3,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
action = function(p0, node, _, _)
|
||||
minetest.remove_node(p0)
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.remove_node(pos)
|
||||
minetest.sound_play("fire_extinguish_flame",
|
||||
{pos = p0, max_hear_distance = 16, gain = 0.25})
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.25})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
]]-- Enable the following ABMs according to 'disable fire' setting
|
||||
-- Enable the following ABMs according to 'enable fire' setting
|
||||
|
||||
if minetest.setting_getbool("disable_fire") then
|
||||
local fire_enabled = minetest.setting_getbool("enable_fire")
|
||||
if fire_enabled == nil then
|
||||
-- New setting not specified, check for old setting.
|
||||
-- If old setting is also not specified, 'not nil' is true.
|
||||
fire_enabled = not minetest.setting_getbool("disable_fire")
|
||||
end
|
||||
|
||||
if not fire_enabled then
|
||||
|
||||
-- Remove basic flames only
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Remove disabled fire",
|
||||
nodenames = {"fire:basic_flame"},
|
||||
interval = 7,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
action = function(p0, node, _, _)
|
||||
minetest.remove_node(p0)
|
||||
end,
|
||||
action = minetest.remove_node,
|
||||
})
|
||||
|
||||
else
|
||||
|
||||
-- Extinguish flames quickly with water, snow, ice
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"fire:basic_flame"},
|
||||
neighbors = {"group:puts_out_fire"},
|
||||
interval = 3,
|
||||
chance = 2,
|
||||
action = function(p0, node, _, _)
|
||||
minetest.remove_node(p0)
|
||||
minetest.sound_play("fire_extinguish_flame",
|
||||
{pos = p0, max_hear_distance = 16, gain = 0.25})
|
||||
end,
|
||||
})
|
||||
else -- Fire enabled
|
||||
|
||||
-- Ignite neighboring nodes, add basic flames
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Ignite flame",
|
||||
nodenames = {"group:flammable"},
|
||||
neighbors = {"group:igniter"},
|
||||
interval = 7,
|
||||
chance = 12,
|
||||
catch_up = false,
|
||||
action = function(p0, node, _, _)
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
-- If there is water or stuff like that around node, don't ignite
|
||||
if fire.flame_should_extinguish(p0) then
|
||||
if minetest.find_node_near(pos, 1, {"group:puts_out_fire"}) then
|
||||
return
|
||||
end
|
||||
local p = fire.find_pos_for_flame_around(p0)
|
||||
local p = minetest.find_node_near(pos, 1, {"air"})
|
||||
if p then
|
||||
minetest.set_node(p, {name = "fire:basic_flame"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Remove basic flames and flammable nodes
|
||||
-- Remove flammable nodes
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Remove flammable nodes",
|
||||
nodenames = {"fire:basic_flame"},
|
||||
neighbors = "group:flammable",
|
||||
interval = 5,
|
||||
chance = 6,
|
||||
chance = 18,
|
||||
catch_up = false,
|
||||
action = function(p0, node, _, _)
|
||||
-- If there are no flammable nodes around flame, remove flame
|
||||
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
|
||||
if not p then
|
||||
minetest.remove_node(p0)
|
||||
return
|
||||
end
|
||||
if math.random(1, 4) == 1 then
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local p = minetest.find_node_near(pos, 1, {"group:flammable"})
|
||||
if p then
|
||||
-- remove flammable nodes around flame
|
||||
local node = minetest.get_node(p)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
local flammable_node = minetest.get_node(p)
|
||||
local def = minetest.registered_nodes[flammable_node.name]
|
||||
if def.on_burn then
|
||||
def.on_burn(p)
|
||||
else
|
||||
@ -296,7 +301,7 @@ end
|
||||
|
||||
-- Rarely ignite things from far
|
||||
|
||||
--[[ Currently disabled to reduce the chance of uncontrollable spreading
|
||||
-- Currently disabled to reduce the chance of uncontrollable spreading
|
||||
fires that disrupt servers. Also for less lua processing load.
|
||||
|
||||
minetest.register_abm({
|
||||
@ -304,13 +309,13 @@ minetest.register_abm({
|
||||
neighbors = {"air"},
|
||||
interval = 5,
|
||||
chance = 10,
|
||||
action = function(p0, node, _, _)
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local reg = minetest.registered_nodes[node.name]
|
||||
if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then
|
||||
return
|
||||
end
|
||||
local d = reg.groups.igniter
|
||||
local p = minetest.find_node_near(p0, d, {"group:flammable"})
|
||||
local p = minetest.find_node_near(pos, d, {"group:flammable"})
|
||||
if p then
|
||||
-- If there is water or stuff like that around flame, don't ignite
|
||||
if fire.flame_should_extinguish(p) then
|
||||
|
84
minetestforfun_game/mods/fire/license.txt
Normal file
84
minetestforfun_game/mods/fire/license.txt
Normal file
@ -0,0 +1,84 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2012-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2012-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 and sounds)
|
||||
---------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2012-2016 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
Copyright (C) 2012-2016 Muadtralk
|
||||
Copyright (C) 2013-2016 Gambit
|
||||
|
||||
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 3.0 Unported (CC BY 3.0)
|
||||
Copyright (C) 2005 dobroide
|
||||
Copyright (C) 2006 Dynamicell
|
||||
Copyright (C) 2009 Benboncan
|
||||
|
||||
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/
|
BIN
minetestforfun_game/mods/fire/sounds/fire_extinguish_flame.1.ogg
Normal file
BIN
minetestforfun_game/mods/fire/sounds/fire_extinguish_flame.1.ogg
Normal file
Binary file not shown.
BIN
minetestforfun_game/mods/fire/sounds/fire_extinguish_flame.2.ogg
Normal file
BIN
minetestforfun_game/mods/fire/sounds/fire_extinguish_flame.2.ogg
Normal file
Binary file not shown.
BIN
minetestforfun_game/mods/fire/sounds/fire_extinguish_flame.3.ogg
Normal file
BIN
minetestforfun_game/mods/fire/sounds/fire_extinguish_flame.3.ogg
Normal file
Binary file not shown.
BIN
minetestforfun_game/mods/fire/sounds/fire_flint_and_steel.ogg
Normal file
BIN
minetestforfun_game/mods/fire/sounds/fire_flint_and_steel.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user