Update no tnt
@ -50,8 +50,19 @@ if not minetest.get_modpath("ethereal") then
|
||||
ARMOR_MATERIALS.crystal = nil
|
||||
end
|
||||
|
||||
-- override hot nodes so they do not hurt player anywhere but mod
|
||||
if ARMOR_FIRE_PROTECT == true then
|
||||
for _, row in ipairs(ARMOR_FIRE_NODES) do
|
||||
if minetest.registered_nodes[row[1]] then
|
||||
minetest.override_item(row[1], {damage_per_second = 0})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local time = 0
|
||||
|
||||
armor = {
|
||||
timer = 0,
|
||||
player_hp = {},
|
||||
elements = {"head", "torso", "legs", "feet"},
|
||||
physics = {"jump","speed","gravity"},
|
||||
formspec = "size[8,8.5]image[2,0.75;2,4;armor_preview]"
|
||||
@ -222,8 +233,66 @@ armor.set_player_armor = function(self, player)
|
||||
end
|
||||
|
||||
armor.update_armor = function(self, player)
|
||||
-- Legacy support: Called when armor levels are changed
|
||||
-- Other mods can hook on to this function, see hud mod for example
|
||||
local name, player_inv, armor_inv, pos = armor:get_valid_player(player, "[update_armor]")
|
||||
if not name then
|
||||
return
|
||||
end
|
||||
local hp = player:get_hp() or 0
|
||||
if ARMOR_FIRE_PROTECT == true then
|
||||
pos.y = pos.y + 1.4 -- head level
|
||||
local node_head = minetest.get_node(pos).name
|
||||
pos.y = pos.y - 1.2 -- feet level
|
||||
local node_feet = minetest.get_node(pos).name
|
||||
-- is player inside a hot node?
|
||||
for _, row in ipairs(ARMOR_FIRE_NODES) do
|
||||
-- check for fire protection, if not enough then get hurt
|
||||
if row[1] == node_head or row[1] == node_feet then
|
||||
if hp > 0 and armor.def[name].fire < row[2] then
|
||||
hp = hp - row[3] * ARMOR_UPDATE_TIME
|
||||
player:set_hp(hp)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if hp <= 0 or hp == self.player_hp[name] then
|
||||
return
|
||||
end
|
||||
if self.player_hp[name] > hp then
|
||||
local heal_max = 0
|
||||
local state = 0
|
||||
local items = 0
|
||||
for i=1, 6 do
|
||||
local stack = player_inv:get_stack("armor", i)
|
||||
if stack:get_count() > 0 then
|
||||
local use = stack:get_definition().groups["armor_use"] or 0
|
||||
local heal = stack:get_definition().groups["armor_heal"] or 0
|
||||
local item = stack:get_name()
|
||||
stack:add_wear(use)
|
||||
armor_inv:set_stack("armor", i, stack)
|
||||
player_inv:set_stack("armor", i, stack)
|
||||
state = state + stack:get_wear()
|
||||
items = items + 1
|
||||
if stack:get_count() == 0 then
|
||||
local desc = minetest.registered_items[item].description
|
||||
if desc then
|
||||
minetest.chat_send_player(name, "Your "..desc.." got destroyed!")
|
||||
end
|
||||
self:set_player_armor(player)
|
||||
armor:update_inventory(player)
|
||||
end
|
||||
heal_max = heal_max + heal
|
||||
end
|
||||
end
|
||||
self.def[name].state = state
|
||||
self.def[name].count = items
|
||||
heal_max = heal_max * ARMOR_HEAL_MULTIPLIER
|
||||
if heal_max > math.random(100) then
|
||||
player:set_hp(self.player_hp[name])
|
||||
return
|
||||
end
|
||||
end
|
||||
self.player_hp[name] = hp
|
||||
end
|
||||
|
||||
armor.get_player_skin = function(self, name)
|
||||
@ -396,6 +465,8 @@ minetest.register_on_joinplayer(function(player)
|
||||
local stack = player_inv:get_stack("armor", i)
|
||||
armor_inv:set_stack("armor", i, stack)
|
||||
end
|
||||
|
||||
armor.player_hp[name] = 0
|
||||
armor.def[name] = {
|
||||
state = 0,
|
||||
count = 0,
|
||||
@ -420,7 +491,7 @@ minetest.register_on_joinplayer(function(player)
|
||||
elseif skin_mod == "simple_skins" then
|
||||
local skin = skins.skins[name]
|
||||
if skin then
|
||||
armor.textures[name].skin = skin..".png"
|
||||
armor.textures[name].skin = skin..".png"
|
||||
end
|
||||
elseif skin_mod == "u_skins" then
|
||||
local skin = u_skins.u_skins[name]
|
||||
@ -507,81 +578,13 @@ if ARMOR_DROP == true or ARMOR_DESTROY == true then
|
||||
end)
|
||||
end
|
||||
|
||||
minetest.register_on_player_hpchange(function(player, hp_change)
|
||||
local name, player_inv, armor_inv = armor:get_valid_player(player, "[on_hpchange]")
|
||||
if name and hp_change < 0 then
|
||||
local heal_max = 0
|
||||
local state = 0
|
||||
local items = 0
|
||||
for i=1, 6 do
|
||||
local stack = player_inv:get_stack("armor", i)
|
||||
if stack:get_count() > 0 then
|
||||
local use = stack:get_definition().groups["armor_use"] or 0
|
||||
local heal = stack:get_definition().groups["armor_heal"] or 0
|
||||
local item = stack:get_name()
|
||||
stack:add_wear(use)
|
||||
armor_inv:set_stack("armor", i, stack)
|
||||
player_inv:set_stack("armor", i, stack)
|
||||
state = state + stack:get_wear()
|
||||
items = items + 1
|
||||
if stack:get_count() == 0 then
|
||||
local desc = minetest.registered_items[item].description
|
||||
if desc then
|
||||
minetest.chat_send_player(name, "Your "..desc.." got destroyed!")
|
||||
end
|
||||
armor:set_player_armor(player)
|
||||
armor:update_inventory(player)
|
||||
end
|
||||
heal_max = heal_max + heal
|
||||
end
|
||||
minetest.register_globalstep(function(dtime)
|
||||
time = time + dtime
|
||||
if time > ARMOR_UPDATE_TIME then
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
armor:update_armor(player)
|
||||
end
|
||||
armor.def[name].state = state
|
||||
armor.def[name].count = items
|
||||
heal_max = heal_max * ARMOR_HEAL_MULTIPLIER
|
||||
if heal_max > math.random(100) then
|
||||
hp_change = 0
|
||||
end
|
||||
armor:update_armor(player)
|
||||
time = 0
|
||||
end
|
||||
return hp_change
|
||||
end, true)
|
||||
|
||||
-- Fire Protection, added by TenPlus1
|
||||
|
||||
if ARMOR_FIRE_PROTECT == true then
|
||||
-- override hot nodes so they do not hurt player anywhere but mod
|
||||
for _, row in ipairs(ARMOR_FIRE_NODES) do
|
||||
if minetest.registered_nodes[row[1]] then
|
||||
minetest.override_item(row[1], {damage_per_second = 0})
|
||||
end
|
||||
end
|
||||
minetest.register_globalstep(function(dtime)
|
||||
armor.timer = armor.timer + dtime
|
||||
if armor.timer > ARMOR_UPDATE_TIME then
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local pos = player:getpos()
|
||||
local hp = player:get_hp()
|
||||
if name and pos and hp then
|
||||
pos.y = pos.y + 1.4 -- head level
|
||||
local node_head = minetest.get_node(pos).name
|
||||
pos.y = pos.y - 1.2 -- feet level
|
||||
local node_feet = minetest.get_node(pos).name
|
||||
-- is player inside a hot node?
|
||||
for _, row in ipairs(ARMOR_FIRE_NODES) do
|
||||
-- check fire protection, if not enough then get hurt
|
||||
if row[1] == node_head or row[1] == node_feet then
|
||||
if hp > 0 and armor.def[name].fire < row[2] then
|
||||
hp = hp - row[3] * ARMOR_UPDATE_TIME
|
||||
player:set_hp(hp)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
armor.timer = 0
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
|
1
mods/TECCLEANER/modpack.txt
Normal file
@ -0,0 +1 @@
|
||||
|
152
mods/TECCLEANER/nodeswapper/alias.lua
Normal file
@ -0,0 +1,152 @@
|
||||
--Extreme Survival created by maikerumine
|
||||
-- Minetest 0.4.13 mod: "Extreme Survival"
|
||||
-- namespace: es
|
||||
--https://github.com/maikerumine
|
||||
|
||||
--License:
|
||||
--~~~~~~~~
|
||||
--Code:
|
||||
--(c) Copyright 2015 maikerumine; modified zlib-License
|
||||
--see "LICENSE.txt" for details.
|
||||
|
||||
--Media(if not stated differently):
|
||||
--(c) Copyright (2014-2015) maikerumine; CC-BY-SA 3.0
|
||||
|
||||
|
||||
|
||||
--Alias "old"--->"new"
|
||||
--THIS TO FIX MERU
|
||||
minetest.register_alias("meru:destone", "default:desert_stone")
|
||||
minetest.register_alias("meru:stone", "default:sandstone")
|
||||
|
||||
--THIS TO FIX TECHNIC
|
||||
minetest.register_alias("technic:diamond_drill_head", "default:glass")
|
||||
minetest.register_alias("technic:green_energy_crystal", "es:emeraldblock")
|
||||
minetest.register_alias("technic:blue_energy_crystal", "es:aikerumblock")
|
||||
minetest.register_alias("technic:red_energy_crystal", "es:rubyblock")
|
||||
minetest.register_alias("technic:fine_copper_wire", "default:copper_block")
|
||||
minetest.register_alias("technic:fine_gold_wire", "default:gold_block")
|
||||
minetest.register_alias("technic:fine_silver_wire", "default:steel_block")
|
||||
minetest.register_alias("technic:copper_coil", "default:copper_ingot")
|
||||
minetest.register_alias("technic:motor", "default:steel_block")
|
||||
minetest.register_alias("technic:lv_transformer", "default:copperblock")
|
||||
minetest.register_alias("technic:mv_transformer", "default:bronzeblock")
|
||||
minetest.register_alias("technic:hv_transformer", "default:goldblock")
|
||||
minetest.register_alias("technic:control_logic_unit", "default:meselamp")
|
||||
minetest.register_alias("technic:mixed_metal_ingot", "default:steel_block")
|
||||
minetest.register_alias("technic:carbon_cloth", "default:coalblock")
|
||||
minetest.register_alias("technic:machine_casing", "default:stone_with_iron")
|
||||
minetest.register_alias("technic:nothing", "default:glass")
|
||||
|
||||
minetest.register_alias("technic:hv_battery_box0", "default:diamondblock")
|
||||
minetest.register_alias("technic:hv_cable0", "default:mese")
|
||||
--minetest.register_alias("technic:forcefield_emitter_off", "default:glass")
|
||||
--minetest.register_alias("technic:forcefield_emitter_on", "default:glass")
|
||||
minetest.register_alias("technic:forcefield_emitter", "es:infiniumblock")
|
||||
minetest.register_alias("technic:forcefield", "default:stone_with_diamond")
|
||||
minetest.register_alias("technic:hv_generator", "es:aikerumblock")
|
||||
minetest.register_alias("technic:hv_nuclear_reactor_core", "es:infiniumblock")
|
||||
minetest.register_alias("technic:hv_nuclear_reactor_core_active", "es:infiniumblock")
|
||||
minetest.register_alias("technic:corium", "es:stone_with_emerald")
|
||||
minetest.register_alias("technic:corium_source", "default:water_source")
|
||||
minetest.register_alias("technic:corium_flowing", "default:water_flowing")
|
||||
minetest.register_alias("technic:bucket_corium", "bucket:bucket_water")
|
||||
minetest.register_alias("technic:chernobylite_block", "es:stone_with_emerald")
|
||||
minetest.register_alias("technic:quarry", "default:stone_with_diamond")
|
||||
minetest.register_alias("technic:solar_array_hv 1", "default:stone_with_diamond")
|
||||
|
||||
minetest.register_alias("technic:mv_alloy_furnace", "default:furnace")
|
||||
minetest.register_alias("technic:mv_battery_box0", "default:stone_with_iron")
|
||||
minetest.register_alias("technic:mv_cable0", "default:steel_block")
|
||||
minetest.register_alias("technic:mv_compressor", "default:stone_with_copper")
|
||||
minetest.register_alias("technic:mv_electric_furnace", "default:furnace")
|
||||
minetest.register_alias("technic:mv_extractor", "default:diamond_block")
|
||||
minetest.register_alias("technic:mv_generator", "default:mese")
|
||||
minetest.register_alias("technic:mv_grinder", "default:furnace")
|
||||
minetest.register_alias("technic:power_radiator", "default:glass")
|
||||
minetest.register_alias("technic:power_radiator 1", "default:glass")
|
||||
minetest.register_alias("technic:solar_array_mv 1", "default:meselamp")
|
||||
minetest.register_alias("technic:tool_workshop", "default:stone_with_copper")
|
||||
minetest.register_alias("technic:wind_mill", "default:steel_block")
|
||||
minetest.register_alias("technic:wind_mill_frame", "default:glass")
|
||||
|
||||
minetest.register_alias("technic:lv_alloy_furnace", "default:furnace")
|
||||
minetest.register_alias("technic:lv_battery_box0", "default:gold_block")
|
||||
minetest.register_alias("technic:lv_cable0", "default:copper_block")
|
||||
minetest.register_alias("technic:cnc", "default:goldblock")
|
||||
minetest.register_alias("technic:cnc_active", "default:goldblock")
|
||||
minetest.register_alias("technic:coal_alloy_furnace", "default:furnace")
|
||||
minetest.register_alias("technic:coal_alloy_furnace_active", "default:furnace")
|
||||
minetest.register_alias("technic:lv_compressor", "default:goldblock")
|
||||
minetest.register_alias("technic:lv_electric_furnace", "default:furnace")
|
||||
minetest.register_alias("technic:lv_extractor", "default:diamond_block")
|
||||
minetest.register_alias("technic:lv_generator", "default:stone_with_diamond")
|
||||
minetest.register_alias("technic:geothermal", "default:stone_with_diamond")
|
||||
minetest.register_alias("technic:geothermal_active", "default:stone_with_diamond")
|
||||
minetest.register_alias("technic:lv_grinder", "default:furnace")
|
||||
minetest.register_alias("technic:music_player", "default:goldblock")
|
||||
minetest.register_alias("technic:solar_array_lv 1", "default:meselamp")
|
||||
minetest.register_alias("technic:solar_panel", "default:meselamp")
|
||||
minetest.register_alias("technic:water_mill", "es:stone_with_aikerum")
|
||||
minetest.register_alias("technic:water_mill_active", "es:stone_with_aikerum")
|
||||
|
||||
minetest.register_alias("technic:mineral_uranium", "es:depleted_uranium")
|
||||
minetest.register_alias("technic:mineral_chromium", "es:stone_with_ruby")
|
||||
minetest.register_alias("technic:mineral_zinc", "es:stone_with_aikerum")
|
||||
minetest.register_alias("technic:granite", "es:granite")
|
||||
minetest.register_alias("technic:marble", "es:marble")
|
||||
minetest.register_alias("technic:marble_bricks", "es:marble_bricks")
|
||||
minetest.register_alias("technic:uranium_block", "es:boneblock")
|
||||
minetest.register_alias("technic:chromium_block", "es:boneblock")
|
||||
minetest.register_alias("technic:zinc_block", "es:messymese")
|
||||
minetest.register_alias("technic:wrought_iron_block", "default:copper_block")
|
||||
minetest.register_alias("technic:cast_iron_block", "default:steel_block")
|
||||
minetest.register_alias("technic:carbon_steel_block", "default:steel_block")
|
||||
minetest.register_alias("technic:stainless_steel_block", "default:steel_block")
|
||||
minetest.register_alias("technic:brass_block", "default:bronze_block")
|
||||
minetest.register_alias("technic:marble_bricks", "es:marble_bricks")
|
||||
|
||||
minetest.register_alias("technic:uranium", "es:depleted_uranium_lump")
|
||||
minetest.register_alias("technic:chromium_lump", "default:copper_lump")
|
||||
minetest.register_alias("technic:chromium_ingot", "default:copper_ingot")
|
||||
minetest.register_alias("technic:zinc_lump", "default:bronze_ingot")
|
||||
minetest.register_alias("technic:zinc_ingot", "default:bronze_lump")
|
||||
minetest.register_alias("technic:brass_ingot", "default:bronze_ingot")
|
||||
minetest.register_alias("technic:cast_iron_ingot", "default:steel_ingot")
|
||||
minetest.register_alias("technic:carbon_steel_ingot", "default:steel_ingot")
|
||||
minetest.register_alias("technic:stainless_steel_ingot", "default:steel_ingot")
|
||||
|
||||
minetest.register_alias("technic:concrete_post0", "default:stone_with_copper")
|
||||
minetest.register_alias("technic:concrete_post12", "default:stone_with_copper")
|
||||
minetest.register_alias("technic:concrete_post3", "default:stone_with_copper")
|
||||
minetest.register_alias("technic:concrete_post28", "default:stone_with_copper")
|
||||
minetest.register_alias("technic:concrete_post19", "default:stone_with_copper")
|
||||
minetest.register_alias("technic:concrete", "es:stone_with_infinium")
|
||||
minetest.register_alias("technic:concrete_post_platform", "es:stone_with_infinium")
|
||||
minetest.register_alias("technic:rebar", "es:rubyblock")
|
||||
minetest.register_alias("technic:blast_resistant_concrete", "es:rubyblock")
|
||||
|
||||
minetest.register_alias("technic:supply_converter", "es:rubyblock")
|
||||
minetest.register_alias("technic:switching_station", "es:aikerumblock")
|
||||
|
||||
minetest.register_alias("technic:rubber", "default:mese_crystal")
|
||||
minetest.register_alias("technic:doped_silicon_wafer", "default:mese_crystal")
|
||||
|
||||
|
||||
|
||||
minetest.register_alias("technic:doped_silicon_wafer", "default:mese_crystal")
|
||||
minetest.register_alias("technic:doped_silicon_wafer", "default:mese_crystal")
|
||||
minetest.register_alias("technic:doped_silicon_wafer", "default:mese_crystal")
|
||||
minetest.register_alias("technic:doped_silicon_wafer", "default:mese_crystal")
|
||||
|
||||
|
||||
|
||||
--This to fix unneeded craftguide mod
|
||||
minetest.register_alias("craft_guide:sign_wall","default:torch")
|
||||
minetest.register_alias("craft_guide:lcd_pc","default:torch")
|
||||
--minetest.register_alias("quartz:quartz_ore","default:torch")
|
||||
|
||||
|
||||
|
||||
|
||||
|
25
mods/TECCLEANER/nodeswapper/init.lua
Normal file
@ -0,0 +1,25 @@
|
||||
--Node Swapper created by maikerumine
|
||||
-- Minetest 0.4.13 mod: "Node Swapper"
|
||||
-- namespace: nodeswapper
|
||||
--https://github.com/maikerumine
|
||||
|
||||
--License:
|
||||
--~~~~~~~~
|
||||
--Code:
|
||||
--(c) Copyright 2015 maikerumine; modified zlib-License
|
||||
--see "LICENSE.txt" for details.
|
||||
|
||||
--Media(if not stated differently):
|
||||
--(c) Copyright (2014-2015) maikerumine; CC-BY-SA 3.0
|
||||
|
||||
nodeswapper = {}
|
||||
--NOTE: THIS MOD CHANGES ALIAS FROM TECHNIC TO ELSE TO CLEAN MAP.
|
||||
|
||||
|
||||
local load_start = os.clock()
|
||||
local modpath = minetest.get_modpath("nodeswapper")
|
||||
nodeswapper.modpath = modpath
|
||||
|
||||
|
||||
-- Alias
|
||||
dofile(modpath.."/alias.lua")
|
BIN
mods/TECCLEANER/technic_worldgen.zip
Normal file
505
mods/chat2/LICENSE
Normal file
@ -0,0 +1,505 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
(This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.)
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
This library 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 library 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.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random
|
||||
Hacker.
|
||||
|
||||
{signature of Ty Coon}, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
7
mods/chat2/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# chat2
|
||||
Mod for Minetest game. Complements game built-in chat or replaces it.
|
||||
|
||||
Higlight some messages in different colors - nearby talk, PM messages, messages with your name in it, shouts(!).
|
||||
Also can show all regular chat messages (use "/chat2 *" command)
|
||||
Switch on/off (use "/chat2" command)
|
||||
Old messages dissapear after some time
|
1
mods/chat2/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
chat_anticurse?
|
355
mods/chat2/init.lua
Normal file
@ -0,0 +1,355 @@
|
||||
-- Minetest 0.4.12+ mod: chat2
|
||||
-- chat2 is mod for minetest game created by Andrey. It's purpose is to improve or replace game built in chat.
|
||||
-- + Higlight some messages in different colors - nearby talk, PM messages, messages with your name in it, shouts(!)
|
||||
-- + Also can show all regular chat messages (use "/chat2 *" command)
|
||||
-- + Switch on/off (use "/chat2" command)
|
||||
-- + Old messages dissapear after some time
|
||||
-- - Problems with unicode symbols on some clients
|
||||
|
||||
-- This mod is Free and Open Source Software, released under the LGPL 2.1 or later.
|
||||
-- I used this mod:https://github.com/vegasd/minetest-mods/blob/master/kmchat/init.lua as example for how to use hud api.
|
||||
|
||||
chat2 = {}
|
||||
chat2.speedlimit = {}
|
||||
chat2.lastmessagetimes = {} --minetest.get_gametime()
|
||||
chat2.users = {}
|
||||
chat2.additionalfilters = {} --additional words set by player, which need to be higligted
|
||||
chat2.firsthud = {} --to be able to use previously set huds
|
||||
chat2.messages_on_screen = 11
|
||||
chat2.chat_width = 100 --symbols
|
||||
chat2.position_x = 0.01
|
||||
chat2.position_y = 0.92
|
||||
chat2.line_distance = 15 --it depends on client, 15 is ok for where i have tested.
|
||||
|
||||
chat2.add_message = function(player, new_text, new_color)
|
||||
local temp_text
|
||||
local temp_color
|
||||
local hud
|
||||
local name = player:get_player_name()
|
||||
local firsthud = chat2.firsthud[name]
|
||||
if not player then
|
||||
minetest.log("action", "Player "..name.." - chat2 player error")
|
||||
end
|
||||
if (not chat2.firsthud[name]) or (not player:hud_get(chat2.firsthud[name]) ) then
|
||||
minetest.log("action", "Player "..name.." - chat2 no hud yet error")
|
||||
return
|
||||
end
|
||||
|
||||
for id = firsthud, (firsthud + chat2.messages_on_screen - 1) do
|
||||
hud = player:hud_get(id)
|
||||
if hud and hud.name == "chat2" then
|
||||
temp_text = hud.text
|
||||
temp_color = hud.number
|
||||
player:hud_change(id, "number", new_color)
|
||||
player:hud_change(id, "text", new_text)
|
||||
new_text = temp_text
|
||||
new_color = temp_color
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
chat2.send_message = function(player, message, color)
|
||||
local line1 = nil --allow message to span at most to three lines. more is not ok for public chat.
|
||||
local line2 = nil
|
||||
local line3 = nil
|
||||
local symbols = ''
|
||||
for i = 1, #message do
|
||||
if
|
||||
string.byte(message, i) == 32 and --is space symbol
|
||||
string.len(symbols) > (chat2.chat_width - 8) and --space have priority for breaking lines
|
||||
(
|
||||
not line1 or
|
||||
not line2 or
|
||||
not line3
|
||||
)
|
||||
then
|
||||
if not line1 then
|
||||
line1 = symbols
|
||||
symbols = ''
|
||||
elseif not line2 then
|
||||
line2 = symbols
|
||||
symbols = ''
|
||||
elseif not line3 then
|
||||
line3 = symbols
|
||||
symbols = ''
|
||||
end
|
||||
elseif
|
||||
(string.byte(message, i) < 128 or string.byte(message, i) >= 192) and --is ascii or first byte of unicode
|
||||
string.len(symbols) > (chat2.chat_width - 1) and
|
||||
(
|
||||
not line1 or
|
||||
not line2 or
|
||||
not line3
|
||||
)
|
||||
then
|
||||
if not line1 then
|
||||
line1 = symbols
|
||||
symbols = ''
|
||||
elseif not line2 then
|
||||
line2 = symbols
|
||||
symbols = ''
|
||||
elseif not line3 then
|
||||
line3 = symbols
|
||||
symbols = ''
|
||||
end
|
||||
elseif line1 and line2 and line3 then --stop when all three lines filled
|
||||
break
|
||||
end
|
||||
symbols = symbols..message:sub(i,i)
|
||||
end
|
||||
|
||||
if not line1 and symbols then --when message is shorten than line
|
||||
line1 = symbols
|
||||
elseif not line2 and symbols then --when message is shorten than line
|
||||
line2 = symbols
|
||||
elseif not line3 and symbols then --when message is shorten than line
|
||||
line3 = symbols
|
||||
end
|
||||
|
||||
if line1 then
|
||||
chat2.add_message(player, line1, color)
|
||||
end
|
||||
if line2 then
|
||||
chat2.add_message(player, line2, color)
|
||||
end
|
||||
if line3 then
|
||||
chat2.add_message(player, line3, color)
|
||||
end
|
||||
|
||||
if message ~= '' then
|
||||
chat2.lastmessagetimes[player:get_player_name()] = minetest.get_gametime()
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
minetest.after(2, function(player)
|
||||
local name = player:get_player_name()
|
||||
for i = 1, chat2.messages_on_screen do
|
||||
local hud_id = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
text = "",
|
||||
position = {x = chat2.position_x, y = chat2.position_y},
|
||||
name = "chat2",
|
||||
scale = {x=500, y=50},
|
||||
number = 0xCCCCCC,
|
||||
alignment = {x=1, y=0},
|
||||
offset = {x=0, y= -i * chat2.line_distance}
|
||||
})
|
||||
if not chat2.firsthud[name] then
|
||||
chat2.firsthud[name] = hud_id
|
||||
end
|
||||
end
|
||||
chat2.users[name] = 1
|
||||
chat2.send_message(player, 'chat2 activated! Use /chat2 command to switch it off/on. Use /chat2 * to see all chat here.', 0xDDAA55)
|
||||
chat2.lastmessagetimes[name] = minetest.get_gametime()
|
||||
end, player)
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
chat2.lastmessagetimes[name] = nil
|
||||
chat2.users[name] = nil
|
||||
chat2.firsthud[name] = nil
|
||||
end)
|
||||
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
|
||||
local fmt = nil
|
||||
local color = nil
|
||||
local submes = nil
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local players = minetest.get_connected_players()
|
||||
|
||||
if chat2.speedlimit[name]==nil then
|
||||
chat2.speedlimit[name] = true
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
if chat_anticurse then
|
||||
local uncensored = chat_anticurse.check_message(name, message)
|
||||
if uncensored == 2 or uncensored > 2 then
|
||||
return true
|
||||
elseif uncensored == 1 then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
submes = string.match(message, "^/(.+)")
|
||||
if submes then
|
||||
return
|
||||
end
|
||||
|
||||
submes = string.match(message, "^!(.+)")
|
||||
if submes then
|
||||
fmt = "<%s> %s"
|
||||
color = 0xFF0000
|
||||
minetest.log("action", "chat2 !:"..string.format(fmt, name, submes))
|
||||
end
|
||||
|
||||
local senderpos = player:getpos()
|
||||
for i = 1, #players do
|
||||
local fmt_p = fmt
|
||||
local color_p = color
|
||||
local submes_p = submes
|
||||
local name_p = players[i]:get_player_name()
|
||||
|
||||
--if not submes_p and chat2.users[name_p] and string.find(message, name_p, 1, true) ~= nil then
|
||||
if not submes_p and chat2.users[name_p] and string.find( string.lower(message), string.lower(name_p), 1, true) ~= nil then
|
||||
fmt_p = "<%s> %s"
|
||||
color_p = 0x00FF00
|
||||
submes_p = message
|
||||
end
|
||||
|
||||
if not submes_p and chat2.users[name_p] and chat2.additionalfilters[name_p] then
|
||||
local additionalfound = false
|
||||
for n = 1, #chat2.additionalfilters[name_p] do
|
||||
--if additionalfound or name == chat2.additionalfilters[name_p][n] or string.find(message, chat2.additionalfilters[name_p][n], 1, true) ~= nil then
|
||||
if additionalfound or name == chat2.additionalfilters[name_p][n] or string.find( string.lower(message), string.lower(chat2.additionalfilters[name_p][n]), 1, true) ~= nil then
|
||||
additionalfound = true
|
||||
end
|
||||
end
|
||||
if additionalfound then
|
||||
fmt_p = "<%s> %s"
|
||||
color_p = 0x55FF55
|
||||
submes_p = message
|
||||
end
|
||||
end
|
||||
|
||||
if not submes_p and chat2.users[name_p] and name_p ~= name then
|
||||
recieverpos = players[i]:getpos()
|
||||
if vector.distance(senderpos, recieverpos) < 12 then
|
||||
fmt_p = "<%s> %s"
|
||||
color_p = 0x88FFFF
|
||||
submes_p = message
|
||||
end
|
||||
end
|
||||
|
||||
if not submes_p and chat2.users[name_p] == 2 then
|
||||
fmt_p = "<%s> %s"
|
||||
color_p = 0xFFFFFF
|
||||
submes_p = message
|
||||
end
|
||||
|
||||
if submes_p and chat2.users[name_p] then
|
||||
chat2.send_message(players[i], string.format(fmt_p, name, submes_p), color_p)
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end)
|
||||
|
||||
if minetest.chatcommands["msg"] then
|
||||
local old_command = minetest.chatcommands["msg"].func
|
||||
minetest.chatcommands["msg"].func = function(name, param)
|
||||
local sendto, message = param:match("^(%S+)%s(.+)$")
|
||||
if sendto and message and chat2.users[sendto] then
|
||||
|
||||
if chat_anticurse then
|
||||
local uncensored = chat_anticurse.check_message(name, message)
|
||||
if uncensored == 2 or uncensored > 2 then
|
||||
return old_command(name, param)
|
||||
elseif uncensored == 1 then
|
||||
return old_command(name, param)
|
||||
end
|
||||
end
|
||||
|
||||
local player = minetest.get_player_by_name(sendto)
|
||||
local sender = minetest.get_player_by_name(name)
|
||||
if player and sender then
|
||||
chat2.send_message(player, string.format("<%s> %s", name, message), 0xFF00FF)
|
||||
chat2.send_message(sender, string.format("<%s> %s", name, message), 0xF000F0)
|
||||
minetest.log("action", "chat2 msg:"..string.format("<%s> %s", name, message))
|
||||
end
|
||||
|
||||
end
|
||||
return old_command(name, param)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("chat2", {
|
||||
params = "",
|
||||
description = "Turn chat2 off/on or add words to monitor or use /chat2 * to see all chat here",
|
||||
privs = {shout = true},
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "chat2: Player not found"
|
||||
end
|
||||
|
||||
if chat2.users[name] == nil and param and #param > 0 then
|
||||
minetest.chat_send_player(name, 'First, please turn chat2 on.')
|
||||
return
|
||||
end
|
||||
|
||||
if param == "*" then
|
||||
if chat2.users[name] == 1 then
|
||||
chat2.users[name] = 2
|
||||
minetest.chat_send_player(name, 'chat2 - receiving all')
|
||||
minetest.log("action", "chat2: receiving all "..name)
|
||||
else
|
||||
chat2.users[name] = 1
|
||||
minetest.chat_send_player(name, 'chat2 - receiving only special messages')
|
||||
minetest.log("action", "chat2: receiving only special messages "..name)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
--user add additional search strings
|
||||
if param and #param > 0 then
|
||||
local parameters = {}
|
||||
if chat2.additionalfilters[name] and #chat2.additionalfilters[name] > 0 and #chat2.additionalfilters[name] < 14 then
|
||||
parameters = chat2.additionalfilters[name]
|
||||
end
|
||||
for s in string.gmatch(param, "%g+") do
|
||||
parameters[#parameters+1] = s:sub(0, 20)
|
||||
end
|
||||
if #parameters > 0 and #parameters < 15 then
|
||||
chat2.additionalfilters[name] = parameters
|
||||
minetest.chat_send_player(name, 'chat2 parameters set')
|
||||
else
|
||||
chat2.additionalfilters[name] = nil
|
||||
minetest.chat_send_player(name, 'chat2 parameters removed(too mutch)')
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if chat2.users[name] ~= nil then
|
||||
for i = 1, chat2.messages_on_screen do
|
||||
chat2.send_message(player, '', 0x000000)
|
||||
end
|
||||
chat2.lastmessagetimes[name] = nil
|
||||
chat2.users[name] = nil
|
||||
else
|
||||
minetest.chat_send_player(name, 'chat2 activated! Use /chat2 command if you want to switch it off.')
|
||||
chat2.send_message(player, 'chat2 activated!', 0xDDAA55)
|
||||
chat2.lastmessagetimes[name] = minetest.get_gametime()
|
||||
chat2.users[name] = 1
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- every 3 seconds clean speedlimit
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime;
|
||||
if timer >= 3 then
|
||||
chat2.speedlimit = {}
|
||||
timer = 0
|
||||
|
||||
--clean chat
|
||||
local players = minetest.get_connected_players()
|
||||
for i = 1, #players do
|
||||
local name = players[i]:get_player_name()
|
||||
if
|
||||
chat2.lastmessagetimes[name] and
|
||||
(minetest.get_gametime() - chat2.lastmessagetimes[name]) > 90
|
||||
then
|
||||
chat2.send_message(players[i], '', 0x000000)
|
||||
if (minetest.get_gametime() - chat2.lastmessagetimes[name]) > (90 + chat2.messages_on_screen * 3) then
|
||||
chat2.lastmessagetimes[name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
505
mods/chat_anticurse/LICENSE
Normal file
@ -0,0 +1,505 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
(This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.)
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
This library 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 library 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.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random
|
||||
Hacker.
|
||||
|
||||
{signature of Ty Coon}, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
13
mods/chat_anticurse/README.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Minetest 0.4.10+ mod: chat_anticurse
|
||||
=========================
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Andrey's mod for minetest game
|
||||
|
||||
This mod is Free and Open Source Software, released under the LGPL 2.1 or later.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
Kick player out when he type curse word in chat or using /me or /msg command.
|
||||
Checks for some English and Russian curse words.
|
1
mods/chat_anticurse/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default?
|
131
mods/chat_anticurse/init.lua
Normal file
@ -0,0 +1,131 @@
|
||||
-- Minetest 0.4.10+ mod: chat_anticurse
|
||||
-- punish player for cursing by disconnecting them
|
||||
--
|
||||
-- Created in 2015 by Andrey.
|
||||
-- This mod is Free and Open Source Software, released under the LGPL 2.1 or later.
|
||||
--
|
||||
-- See README.txt for more information.
|
||||
|
||||
chat_anticurse = {}
|
||||
chat_anticurse.simplemask = {}
|
||||
-- some english and some russian curse words
|
||||
-- i don't want to keep these words as cleartext in code, so they are stored like this.
|
||||
local x1="a"
|
||||
local x2="i"
|
||||
local x3="u"
|
||||
local x4="e"
|
||||
local x5="o"
|
||||
local y1="y"
|
||||
local y2="и"
|
||||
local y3="о"
|
||||
local y4="е"
|
||||
local y5="я"
|
||||
|
||||
chat_anticurse.simplemask[1] = " "..x1.."s" .. "s "
|
||||
chat_anticurse.simplemask[2] = " d" .. ""..x2.."ck"
|
||||
chat_anticurse.simplemask[3] = " p"..x4.."n" .. "is"
|
||||
chat_anticurse.simplemask[4] = " p" .. ""..x3.."ssy"
|
||||
chat_anticurse.simplemask[5] = " h"..x5.."" .. "r".."ny "
|
||||
chat_anticurse.simplemask[6] = " b"..x2.."" .. "tch "
|
||||
chat_anticurse.simplemask[7] = " b"..x2.."" .. "tche"
|
||||
chat_anticurse.simplemask[8] = " s"..x4.."" .. "x"
|
||||
chat_anticurse.simplemask[9] = " "..y4.."б" .. "а"
|
||||
chat_anticurse.simplemask[10] = " бл"..y5.."" .. " "
|
||||
chat_anticurse.simplemask[11] = " ж" .. ""..y3.."п"
|
||||
chat_anticurse.simplemask[12] = " х" .. ""..y1.."й"
|
||||
chat_anticurse.simplemask[13] = " ч" .. "л"..y4.."н"
|
||||
chat_anticurse.simplemask[14] = " п"..y2.."" .. "зд"
|
||||
chat_anticurse.simplemask[15] = " в"..y3.."" .. "збуд"
|
||||
chat_anticurse.simplemask[16] = " в"..y3.."з" .. "б"..y1.."ж"
|
||||
chat_anticurse.simplemask[17] = " сп"..y4.."" .. "рм"
|
||||
chat_anticurse.simplemask[18] = " бл"..y5.."" .. "д"
|
||||
chat_anticurse.simplemask[19] = " бл"..y5.."" .. "ть"
|
||||
chat_anticurse.simplemask[20] = " с" .. ""..y4.."кс"
|
||||
chat_anticurse.simplemask[21] = " f" .. ""..x3.."ck"
|
||||
chat_anticurse.simplemask[22] = ""..x1.."rs"..x4.."h"..x5.."l"..x4..""
|
||||
chat_anticurse.simplemask[23] = " c"..x3.."nt "
|
||||
|
||||
|
||||
|
||||
chat_anticurse.check_message = function(name, message)
|
||||
local checkingmessage=string.lower( name.." "..message .." " )
|
||||
local uncensored = 0
|
||||
for i=1, #chat_anticurse.simplemask do
|
||||
if string.find(checkingmessage, chat_anticurse.simplemask[i], 1, true) ~=nil then
|
||||
uncensored = 2
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
--additional checks
|
||||
if
|
||||
string.find(checkingmessage, " c"..x3.."" .. "m ", 1, true) ~=nil and
|
||||
not (string.find(checkingmessage, " c"..x3.."" .. "m " .. "se", 1, true) ~=nil) and
|
||||
not (string.find(checkingmessage, " c"..x3.."" .. "m " .. "to", 1, true) ~=nil)
|
||||
then
|
||||
uncensored = 2
|
||||
end
|
||||
return uncensored
|
||||
end
|
||||
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
local uncensored = chat_anticurse.check_message(name, message)
|
||||
|
||||
if uncensored == 1 then
|
||||
minetest.kick_player(name, "Hey! Was there a bad word?")
|
||||
minetest.log("action", "Player "..name.." warned for cursing. Chat:"..message)
|
||||
return true
|
||||
end
|
||||
|
||||
if uncensored == 2 then
|
||||
minetest.kick_player(name, "Cursing or words, inappropriate to game server. Kids may be playing here!")
|
||||
minetest.chat_send_all("Player <"..name.."> warned for cursing" )
|
||||
minetest.log("action", "Player "..name.." warned for cursing. Chat:"..message)
|
||||
return true
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
if minetest.chatcommands["me"] then
|
||||
local old_command = minetest.chatcommands["me"].func
|
||||
minetest.chatcommands["me"].func = function(name, param)
|
||||
local uncensored = chat_anticurse.check_message(name, param)
|
||||
|
||||
if uncensored == 1 then
|
||||
minetest.kick_player(name, "Hey! Was there a bad word?")
|
||||
minetest.log("action", "Player "..name.." warned for cursing. Msg:"..param)
|
||||
return
|
||||
end
|
||||
|
||||
if uncensored == 2 then
|
||||
minetest.kick_player(name, "Cursing or words, inappropriate to game server. Kids may be playing here!")
|
||||
minetest.chat_send_all("Player <"..name.."> warned for cursing" )
|
||||
minetest.log("action", "Player "..name.." warned for cursing. Me:"..param)
|
||||
return
|
||||
end
|
||||
|
||||
return old_command(name, param)
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.chatcommands["msg"] then
|
||||
local old_command = minetest.chatcommands["msg"].func
|
||||
minetest.chatcommands["msg"].func = function(name, param)
|
||||
local uncensored = chat_anticurse.check_message(name, param)
|
||||
|
||||
if uncensored == 1 then
|
||||
minetest.kick_player(name, "Hey! Was there a bad word?")
|
||||
minetest.log("action", "Player "..name.." warned for cursing. Msg:"..param)
|
||||
return
|
||||
end
|
||||
|
||||
if uncensored == 2 then
|
||||
minetest.kick_player(name, "Cursing or words, inappropriate to game server. Kids may be playing here!")
|
||||
minetest.chat_send_all("Player <"..name.."> warned for cursing" )
|
||||
minetest.log("action", "Player "..name.." warned for cursing. Msg:"..param)
|
||||
return
|
||||
end
|
||||
|
||||
return old_command(name, param)
|
||||
end
|
||||
end
|
@ -77,4 +77,4 @@ stairs.register_stair_and_slab("Dirt", "default:dirt",
|
||||
{"default_dirt.png"},
|
||||
"Dirt Block Stair",
|
||||
"Dirt Block Slab",
|
||||
default.node_sound_stone_defaults())
|
||||
default.node_sound_stone_defaults())
|
||||
|
BIN
mods/es/textures/default_clay.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
mods/es/textures/default_mineral_copper.png
Normal file
After Width: | Height: | Size: 134 B |
BIN
mods/es/textures/farming_pumpkin_face_off.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
mods/es/textures/farming_pumpkin_face_on.png
Normal file
After Width: | Height: | Size: 269 B |
BIN
mods/es/textures/farming_pumpkin_side.png
Normal file
After Width: | Height: | Size: 231 B |
BIN
mods/es/textures/farming_pumpkin_slice.png
Normal file
After Width: | Height: | Size: 204 B |
BIN
mods/es/textures/farming_pumpkin_top.png
Normal file
After Width: | Height: | Size: 272 B |
@ -22,8 +22,8 @@ function bp:register_mob(name, def)
|
||||
on_die = def.on_die,
|
||||
jump_height = def.jump_height or 6,
|
||||
jump_chance = def.jump_chance or 0,
|
||||
--rotate = def.rotate or 0, -- 0=front, 1.5=side, 3.0=back, 4.5=side2
|
||||
rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2
|
||||
rotate = def.rotate or 0, -- 0=front, 1.5=side, 3.0=back, 4.5=side2
|
||||
--rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2
|
||||
lifetimer = def.lifetimer or 180,
|
||||
hp_min = def.hp_min or 9,
|
||||
hp_max = def.hp_max or 90,
|
||||
|
@ -1,10 +1,4 @@
|
||||
--BLOCO from Not so simple mobs: https://forum.minetest.net/viewtopic.php?f=11&t=11813
|
||||
--Created by: NPX team
|
||||
--License:
|
||||
-- Code: GPL v3
|
||||
-- Textures, models and sounds: CC BY-SA
|
||||
|
||||
bp:spawn_specific("esmobs:bloco", {"default:stone"}, {"default:stone"}, 0, 20, 30, 12000, 3, -31000, -20)
|
||||
--bp:spawn_specific("esmobs:bloco", {"default:stone"}, {"default:stone"}, 0, 20, 30, 12000, 3, -31000, -20)
|
||||
bp:register_mob("esmobs:bloco", {
|
||||
type = "monster",
|
||||
hp_max = 15,
|
||||
@ -55,7 +49,7 @@ bp:register_mob("esmobs:bloco", {
|
||||
}
|
||||
})
|
||||
|
||||
bp:spawn_specific("esmobs:blocod", {"default:dirt"}, {"default:dirt_with_grass"}, 3, 20, 30, 15000, 3, -31000, 20)
|
||||
--bp:spawn_specific("esmobs:blocod", {"default:dirt"}, {"default:dirt_with_grass"}, 3, 20, 30, 15000, 3, -31000, 20)
|
||||
bp:register_mob("esmobs:blocod", {
|
||||
type = "monster",
|
||||
hp_max = 15,
|
||||
|
@ -294,7 +294,7 @@ bp:register_mob("esmobs:oerkkii", {
|
||||
})
|
||||
|
||||
bp:register_spawn("esmobs:oerkkii", {"default:stone"}, 5, 0, 14000, 1, -10)
|
||||
bp:register_spawn("esmobs:oerkkii", "esmobs:cursed_stone", 4, -1, 2, 20, 500, -500)
|
||||
--bp:register_spawn("esmobs:oerkkii", "esmobs:cursed_stone", 4, -1, 2, 20, 500, -500)
|
||||
|
||||
minetest.register_node("esmobs:cursed_stone", {
|
||||
description = "Cursed stone",
|
||||
@ -408,4 +408,4 @@ bp:register_mob("esmobs:herobrines_bloody_ghost", {
|
||||
}
|
||||
})
|
||||
bp:register_spawn("esmobs:herobrines_bloody_ghost", {"default:stone","default:desert_sand"}, 6, -1, 12000, 1, 10)
|
||||
bp:register_spawn("esmobs:herobrines_bloody_ghost", "esmobs:cursed_stone", 4, -1, 2, 1, 500, -500)
|
||||
--bp:register_spawn("esmobs:herobrines_bloody_ghost", "esmobs:cursed_stone", 4, -1, 2, 1, 500, -500)
|
||||
|
2
mods/name_restrictions/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*~
|
||||
|
228
mods/name_restrictions/init.lua
Normal file
@ -0,0 +1,228 @@
|
||||
-- name_restrictions mod by ShadowNinja
|
||||
-- License: WTFPL
|
||||
|
||||
----------------------------
|
||||
-- Restriction exemptions --
|
||||
----------------------------
|
||||
-- For legitimate player names that are caught by the filters.
|
||||
|
||||
local exemptions = {}
|
||||
local temp = minetest.setting_get("name_restrictions.exemptions")
|
||||
temp = temp and temp:split() or {}
|
||||
for _, allowed_name in pairs(temp) do
|
||||
exemptions[allowed_name] = true
|
||||
end
|
||||
temp = nil
|
||||
-- Exempt server owner
|
||||
exemptions[minetest.setting_get("name")] = true
|
||||
exemptions["singleplayer"] = true
|
||||
|
||||
---------------------
|
||||
-- Simple matching --
|
||||
---------------------
|
||||
|
||||
local disallowed = {
|
||||
["^guest[0-9]+"] = "Guest accounts are disallowed on this server." ..
|
||||
" Please choose a proper name and try again.",
|
||||
--["[4a]dm[1il]n"] = "Misleading name." ..
|
||||
-- " Please choose a proper name and try again.",
|
||||
["[0o]wn[e3]r"] = "Misleading name." ..
|
||||
" Please choose a proper name and try again.",
|
||||
["^[0-9]+$"] = "All-numeric names are disallowed on this server." ..
|
||||
" Please choose a proper name and try again.",
|
||||
["[0-9].-[0-9].-[0-9].-[0-9].-[0-9].-[0-9]"] = "Too many numbers in your name (must be 5 at most)." ..
|
||||
" Please choose a proper name and try again.",
|
||||
}
|
||||
|
||||
minetest.register_on_prejoinplayer(function(name, ip)
|
||||
local lname = name:lower()
|
||||
for re, reason in pairs(disallowed) do
|
||||
if lname:find(re) then
|
||||
return reason
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
------------------------
|
||||
-- Case-insensitivity --
|
||||
------------------------
|
||||
|
||||
--[[minetest.register_on_prejoinplayer(function(name, ip)
|
||||
local lname = name:lower()
|
||||
for iname, data in pairs(minetest.auth_table) do
|
||||
if iname:lower() == lname and iname ~= name then
|
||||
return "Sorry, someone else is already using this"
|
||||
.." name. Please pick another name."
|
||||
.." Another posibility is that you used the"
|
||||
.." wrong case for your name."
|
||||
end
|
||||
end
|
||||
end)]]
|
||||
|
||||
-- Compatability, for old servers with conflicting players
|
||||
minetest.register_chatcommand("choosecase", {
|
||||
description = "Choose the casing that a player name should have",
|
||||
params = "<name>",
|
||||
privs = {server = true},
|
||||
func = function(name, params)
|
||||
local lname = params:lower()
|
||||
local worldpath = minetest.get_worldpath()
|
||||
for iname, data in pairs(minetest.auth_table) do
|
||||
if iname:lower() == lname and iname ~= params then
|
||||
minetest.auth_table[iname] = nil
|
||||
assert(not iname:find("[/\\]"))
|
||||
os.remove(worldpath .. "/players/" .. iname)
|
||||
end
|
||||
end
|
||||
return true, "Done."
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
------------------------
|
||||
-- Anti-impersonation --
|
||||
------------------------
|
||||
-- Prevents names that are too similar to annother player's name.
|
||||
|
||||
local similar_chars = {
|
||||
-- Only A-Z, a-z, 1-9, dash, and underscore are allowed in playernames
|
||||
"A4",
|
||||
"B8",
|
||||
"COco0",
|
||||
"Ee3",
|
||||
"Gg69",
|
||||
"ILil1",
|
||||
"S5",
|
||||
"Tt7",
|
||||
"Zz2",
|
||||
}
|
||||
|
||||
-- Map of characters to a regex of similar characters
|
||||
local char_map = {}
|
||||
for _, str in pairs(similar_chars) do
|
||||
for c in str:gmatch(".") do
|
||||
if not char_map[c] then
|
||||
char_map[c] = str
|
||||
else
|
||||
char_map[c] = char_map[c] .. str
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for c, str in pairs(char_map) do
|
||||
char_map[c] = "[" .. char_map[c] .."]"
|
||||
end
|
||||
|
||||
-- Characters to match for, containing all characters
|
||||
local all_chars = "["
|
||||
for _, str in pairs(similar_chars) do
|
||||
all_chars = all_chars .. str
|
||||
end
|
||||
all_chars = all_chars .. "]"
|
||||
|
||||
|
||||
--[[minetest.register_on_prejoinplayer(function(name, ip)
|
||||
if exemptions[name] then return end
|
||||
|
||||
-- Generate a regular expression to match all similar names
|
||||
local re = name:gsub(all_chars, char_map)
|
||||
re = "^[_-]*" .. re .. "[_-]*$"
|
||||
|
||||
for authName, _ in pairs(minetest.auth_table) do
|
||||
if authName ~= name and authName:match(re) then
|
||||
return "Your name is too similar to another player's name."
|
||||
end
|
||||
end
|
||||
end)]]
|
||||
|
||||
|
||||
|
||||
-----------------
|
||||
-- Name length --
|
||||
-----------------
|
||||
|
||||
local min_name_len = tonumber(minetest.setting_get("name_restrictions.minimum_name_length")) or 2
|
||||
local max_name_len = tonumber(minetest.setting_get("name_restrictions.maximum_name_length")) or 17
|
||||
|
||||
minetest.register_on_prejoinplayer(function(name, ip)
|
||||
if exemptions[name] then return end
|
||||
|
||||
if #name < min_name_len then
|
||||
return "Your player name is too short"
|
||||
.. " (" .. #name .. " characters, must be " .. min_name_len .. " characters at least)."
|
||||
.. " Please try a longer name."
|
||||
end
|
||||
|
||||
if #name > max_name_len then
|
||||
return "Your player name is too long"
|
||||
.. " (" .. #name .. " characters, must be " .. max_name_len .. " characters at most)."
|
||||
.. " Please try a shorter name."
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
----------------------
|
||||
-- Pronounceability --
|
||||
----------------------
|
||||
|
||||
-- Original implementation (in Python) by sfan5
|
||||
local function pronounceable(pronounceability, text)
|
||||
local pronounceable = 0
|
||||
local nonpronounceable = 0
|
||||
local cn = 0
|
||||
local lastc = ""
|
||||
for c in text:lower():gmatch(".") do
|
||||
if c:find("[aeiou0-9_-]") then
|
||||
if not c:find("[0-9]") then
|
||||
if cn > 2 then
|
||||
nonpronounceable = nonpronounceable + 1
|
||||
else
|
||||
pronounceable = pronounceable + 1
|
||||
end
|
||||
end
|
||||
cn = 0
|
||||
else
|
||||
if cn == 1 and lastc == c and lastc ~= 's' then
|
||||
nonpronounceable = nonpronounceable + 1
|
||||
cn = 0
|
||||
end
|
||||
if cn > 2 then
|
||||
nonpronounceable = nonpronounceable + 1
|
||||
cn = 0
|
||||
end
|
||||
if lastc:find("[aeiou]") then
|
||||
pronounceable = pronounceable + 1
|
||||
cn = 0
|
||||
end
|
||||
if not (c == "r" and lastc:find("[aipfom]")) and
|
||||
not (lastc == "c" and c == "h") then
|
||||
cn = cn + 1
|
||||
end
|
||||
end
|
||||
lastc = c
|
||||
end
|
||||
if cn > 0 then
|
||||
nonpronounceable = nonpronounceable + 1
|
||||
end
|
||||
return pronounceable * pronounceability >= nonpronounceable
|
||||
end
|
||||
|
||||
-- Pronounceability factor:
|
||||
-- nil = Checking disabled.
|
||||
-- 0 = Everything's unpronounceable.
|
||||
-- 0.5 = Strict checking.
|
||||
-- 1 = Normal checking.
|
||||
-- 2 = Relaxed checking.
|
||||
local pronounceability = tonumber(minetest.setting_get("name_restrictions.pronounceability"))
|
||||
if pronounceability then
|
||||
minetest.register_on_prejoinplayer(function(name, ip)
|
||||
if exemptions[name] then return end
|
||||
|
||||
if not pronounceable(pronounceability, name) then
|
||||
return "Your player name does not seem to be pronounceable."
|
||||
.." Please choose a more pronounceable name."
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
0
mods/names_per_ip/depends.txt
Normal file
119
mods/names_per_ip/init.lua
Normal file
@ -0,0 +1,119 @@
|
||||
minetest.register_privilege("whois", {
|
||||
description = "Allows player to see other player IPs"})
|
||||
|
||||
-- Created by Krock to stop mass-account-creators
|
||||
-- License: WTFPL
|
||||
|
||||
ipnames = {}
|
||||
ipnames.data = {}
|
||||
ipnames.tmp_data = {}
|
||||
ipnames.changes = false
|
||||
ipnames.save_interval = 120
|
||||
ipnames.save_time = 0
|
||||
ipnames.file = minetest.get_worldpath().."/ipnames.txt"
|
||||
|
||||
ipnames.name_per_ip_limit = tonumber(minetest.setting_get("max_names_per_ip")) or 4
|
||||
|
||||
-- Get accounts self:
|
||||
minetest.register_chatcommand("whois", {
|
||||
description = "Gets all players who have the same IP as the specified player",
|
||||
privs = {whois = true},
|
||||
func = function(name, param)
|
||||
if not ipnames.data[param] then
|
||||
minetest.chat_send_player(name, "The player \"" .. param .. "\" did not join yet.")
|
||||
return
|
||||
end
|
||||
|
||||
local ip = ipnames.data[param]
|
||||
local names = "";
|
||||
for k, v in pairs(ipnames.data) do
|
||||
if v == ip then
|
||||
if names ~= "" then
|
||||
names = names .. ", " .. k
|
||||
else
|
||||
names = names .. " " .. k
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.chat_send_player(name, "Players for IP address " .. ip .. ": " .. names)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Get IP if player tries to join, ban if there are too much names per IP:
|
||||
minetest.register_on_prejoinplayer(function(name, ip)
|
||||
-- Only stop new accounts:
|
||||
ipnames.tmp_data[name] = ip
|
||||
if not ipnames.data[name] then
|
||||
local count = 1
|
||||
local names = ""
|
||||
for k, v in pairs(ipnames.data) do
|
||||
if v == ip then
|
||||
count = count + 1
|
||||
names = names .. k .. ", "
|
||||
end
|
||||
end
|
||||
|
||||
if count <= ipnames.name_per_ip_limit and count > 1 then
|
||||
minetest.log("action", name .. " now has " .. count .. " accounts. Other accounts: " .. names)
|
||||
end
|
||||
|
||||
if count > ipnames.name_per_ip_limit then
|
||||
ipnames.tmp_data[name] = nil
|
||||
if tostring(ip) ~= "127.0.0.1" then
|
||||
return ("\nYou exceeded the limit of accounts (" .. ipnames.name_per_ip_limit ..
|
||||
").\nYou already have the following accounts:\n" .. names)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Save IP if player joined:
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
ipnames.data[name] = ipnames.tmp_data[name]
|
||||
ipnames.tmp_data[name] = nil
|
||||
ipnames.changes = true
|
||||
end)
|
||||
|
||||
function ipnames.load_data()
|
||||
local file = io.open(ipnames.file, "r")
|
||||
if not file then
|
||||
return
|
||||
end
|
||||
for line in file:lines() do
|
||||
if line ~= "" then
|
||||
local data = line:split("|")
|
||||
if #data >= 2 then
|
||||
ipnames.data[data[1]] = data[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
io.close(file)
|
||||
end
|
||||
|
||||
function ipnames.save_data()
|
||||
if not ipnames.changes then
|
||||
return
|
||||
end
|
||||
ipnames.changes = false
|
||||
local file = io.open(ipnames.file, "w")
|
||||
for i, v in pairs(ipnames.data) do
|
||||
if v ~= nil then
|
||||
file:write(i .. "|" .. v .. "\n")
|
||||
end
|
||||
end
|
||||
io.close(file)
|
||||
end
|
||||
|
||||
minetest.register_globalstep(function(t)
|
||||
ipnames.save_time = ipnames.save_time + t
|
||||
if ipnames.save_time < ipnames.save_interval then
|
||||
return
|
||||
end
|
||||
ipnames.save_time = 0
|
||||
ipnames.save_data()
|
||||
end)
|
||||
|
||||
minetest.register_on_shutdown(function() ipnames.save_data() end)
|
||||
|
||||
minetest.after(3, function() ipnames.load_data() end)
|
@ -923,4 +923,4 @@ local yp = {x = pos.x, y = pos.y + 8, z = pos.z}
|
||||
return
|
||||
end
|
||||
end
|
||||
})
|
||||
})
|
@ -1,5 +1,4 @@
|
||||
default
|
||||
dye
|
||||
tnt
|
||||
wool
|
||||
|
||||
|
@ -1,16 +1,4 @@
|
||||
--[[shooter:register_weapon("shooter:pistol", {
|
||||
description = "Pistol",
|
||||
inventory_image = "shooter_pistol.png",
|
||||
rounds = 200,
|
||||
spec = {
|
||||
range = 100,
|
||||
step = 20,
|
||||
tool_caps = {full_punch_interval=0.5, damage_groups={fleshy=2}},
|
||||
groups = {snappy=3, fleshy=3, oddly_breakable_by_hand=3},
|
||||
sound = "shooter_pistol",
|
||||
particle = "shooter_cap.png",
|
||||
},
|
||||
})]]
|
||||
|
||||
|
||||
shooter:register_weapon("shooter:rifle", {
|
||||
description = "Rifle",
|
||||
@ -25,49 +13,14 @@ shooter:register_weapon("shooter:rifle", {
|
||||
particle = "shooter_bullet.png",
|
||||
},
|
||||
})
|
||||
--[[
|
||||
shooter:register_weapon("shooter:shotgun", {
|
||||
description = "Shotgun",
|
||||
inventory_image = "shooter_shotgun.png",
|
||||
rounds = 50,
|
||||
spec = {
|
||||
range = 50,
|
||||
step = 15,
|
||||
tool_caps = {full_punch_interval=1.0, damage_groups={fleshy=10}},
|
||||
groups = {cracky=3, snappy=2, crumbly=2, choppy=2, fleshy=1, oddly_breakable_by_hand=1},
|
||||
sound = "shooter_shotgun",
|
||||
particle = "smoke_puff.png",
|
||||
},
|
||||
})
|
||||
|
||||
shooter:register_weapon("shooter:machine_gun", {
|
||||
description = "Sub Machine Gun",
|
||||
inventory_image = "shooter_smgun.png",
|
||||
rounds = 50,
|
||||
shots = 4,
|
||||
spec = {
|
||||
range = 100,
|
||||
step = 20,
|
||||
tool_caps = {full_punch_interval=0.125, damage_groups={fleshy=5}},
|
||||
groups = {snappy=3, fleshy=3, oddly_breakable_by_hand=3},
|
||||
sound = "shooter_pistol",
|
||||
particle = "shooter_cap.png",
|
||||
},
|
||||
})
|
||||
]]
|
||||
minetest.register_craftitem("shooter:ammo", {
|
||||
description = "Ammo pack",
|
||||
inventory_image = "shooter_ammo.png",
|
||||
})
|
||||
|
||||
if SHOOTER_ENABLE_CRAFTING == true then
|
||||
--[[ minetest.register_craft({
|
||||
output = "shooter:pistol 1 65535",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "default:mese_crystal"},
|
||||
},
|
||||
})]]
|
||||
|
||||
minetest.register_craft({
|
||||
output = "shooter:rifle 1 65535",
|
||||
recipe = {
|
||||
@ -76,22 +29,7 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
||||
{"", "default:mese_crystal", "default:bronze_ingot"},
|
||||
},
|
||||
})
|
||||
--[[ minetest.register_craft({
|
||||
output = "shooter:shotgun 1 65535",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "", ""},
|
||||
{"", "default:steel_ingot", ""},
|
||||
{"", "default:mese_crystal", "default:bronze_ingot"},
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "shooter:machine_gun 1 65535",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"", "default:bronze_ingot", "default:mese_crystal"},
|
||||
{"", "default:bronze_ingot", ""},
|
||||
},
|
||||
})]]
|
||||
|
||||
minetest.register_craft({
|
||||
output = "shooter:ammo",
|
||||
recipe = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- rnd : limit usage of spawn once per 15 min = 15*60 s = 900 s
|
||||
local spawn_limit = {};
|
||||
local spawn_limit_max = 900; -- how much time must elapse to be able to use spawn again
|
||||
local spawn_limit_max = 180; -- how much time must elapse to be able to use spawn again
|
||||
|
||||
|
||||
spawn_prison = {}
|
||||
|
@ -99,10 +99,10 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
dofile(minetest.get_modpath("throwing").."/arrow.lua")
|
||||
dofile(minetest.get_modpath("throwing").."/fire_arrow.lua")
|
||||
--dofile(minetest.get_modpath("throwing").."/fire_arrow.lua")
|
||||
dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua")
|
||||
dofile(minetest.get_modpath("throwing").."/dig_arrow.lua")
|
||||
dofile(minetest.get_modpath("throwing").."/build_arrow.lua")
|
||||
--dofile(minetest.get_modpath("throwing").."/dig_arrow.lua")
|
||||
--dofile(minetest.get_modpath("throwing").."/build_arrow.lua")
|
||||
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "throwing loaded")
|
||||
|