Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated server mods as of September 2023 #145

Merged
merged 19 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "mods/water_life"]
path = mods/water_life
url = https://github.com/ronoaldo/water_life
[submodule "mods/markdown2formspec"]
path = mods/markdown2formspec
url = https://github.com/ronoaldo/markdown2formspec
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mercurio server build/management tool

INTERACTIVE=true
TEST_ARGS=--env-file /tmp/.env.test -f docker-compose.yml -f docker-compose.test.yml
TEST_ARGS=--env-file /tmp/.env.test -f docker-compose.yml -f docker-compose.auto.yml
TEST_ENV= -e MERCURIO_AUTO_SHUTDOWN=true -e NO_LOOP=true

all: build
Expand All @@ -21,7 +21,7 @@ volumes: .minetest/world .minetest/logs

submodules:
git submodule init
git submodule update
git submodule update --init --recursive

rm-submodule:
@if [ x"" = x"$(M)" ]; then \
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.test.yml → docker-compose.auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ services:
driver: "json-file"
volumes:
- /tmp/minetest/db:/var/lib/postgresql/data
deploy:
resources:
limits:
memory: 3G
game:
restart: "no"
logging:
Expand All @@ -18,3 +22,7 @@ services:
- "30000:30000/tcp"
volumes:
- /tmp/minetest/world:/var/lib/mercurio
deploy:
resources:
limits:
memory: 3G
7 changes: 5 additions & 2 deletions mercurio/admin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ minetest.register_chatcommand("server_metadata", {
local meta = minetest[param]

local txt = "minetest."..param.." values (type= ".. type(meta) .."):\n\n"

local buff = {}
if meta then
if type(meta) == "table" then
for k, v in pairs(meta) do
txt = txt .. "".. k ..": ".. to_json(v) .. " \n"
table.insert(buff, k ..": ".. to_json(v))
end
else
txt = txt .. to_json(meta)
table.insert(buff, to_json(meta))
end
else
txt = "Not found: " .. param
end
txt = txt .. table.concat(buff, "\n")

f = f .. minetest.formspec_escape(txt) .. "]"
minetest.show_formspec(name, "server_metadata", f)
Expand Down
38 changes: 37 additions & 1 deletion mercurio/beta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,40 @@ local function auto_grant_privs(player, last_login)
minetest.chat_send_player(name, "*** WARNING: This is a test server! All we do here will be reset!")
end

minetest.register_on_joinplayer(auto_grant_privs)
minetest.register_on_joinplayer(auto_grant_privs)

minetest.register_on_mods_loaded(function()
-- Create a log of registered nodes and item names
log_action("Saving registered names")

local buff = {}
local count = 0

for name, def in pairs(minetest.registered_nodes) do
table.insert(buff, "node=" .. name)
count = count+1
end

for name, def in pairs(minetest.registered_items) do
table.insert(buff, "item=" .. name)
count = count+1
end

local wp = minetest.get_worldpath()
local filename = wp .. "/mercurio_registered_names.txt"
table.sort(buff)
minetest.safe_file_write(filename, table.concat(buff, "\n"))

log_action(tostring(count) .. " registered names saved to " .. filename)

-- Auto-shutdown hook - for testing basic server startup/shutdown
local auto_shutdown = minetest.settings:get("mercurio_auto_shutdown") or "false"
log_action("mercurio_auto_shutdown => " .. auto_shutdown)
if auto_shutdown == "true" then
log_action("Auto shutdown is enabled. Turning server off after 15s.")
minetest.after(15, function()
log_action("Requesting shutdown...")
minetest.request_shutdown("", false, 1)
end)
end
end)
13 changes: 0 additions & 13 deletions mercurio/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,19 +234,6 @@ minetest.register_abm({
end,
})

-- Auto-shutdown hook - for testing basic server startup/shutdown
local auto_shutdown = minetest.settings:get("mercurio_auto_shutdown") or "false"
log_action("mercurio_auto_shutdown => " .. auto_shutdown)
if auto_shutdown == "true" then
minetest.register_on_mods_loaded(function()
log_action("Auto shutdown is enabled. Turning server off after 15s.")
minetest.after(15, function()
log_action("Requesting shutdown...")
minetest.request_shutdown("", false, 1)
end)
end)
end

-- Load beta server settings
local is_beta_server = minetest.settings:get("mercurio_beta_server")
if is_beta_server == "true" then
Expand Down
7 changes: 7 additions & 0 deletions mods/3d_armor/3d_armor/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,9 @@ end
armor.damage = function(self, player, index, stack, use)
local old_stack = ItemStack(stack)
local worn_armor = armor:get_weared_armor_elements(player)
if not worn_armor then
return
end
local armor_worn_cnt = 0
for k,v in pairs(worn_armor) do
armor_worn_cnt = armor_worn_cnt + 1
Expand Down Expand Up @@ -681,6 +684,10 @@ armor.equip = function(self, player, itemstack)
for i=1, armor_inv:get_size("armor") do
local stack = armor_inv:get_stack("armor", i)
if self:get_element(stack:get_name()) == armor_element then
--prevents equiping an armor that would unequip a cursed armor.
if minetest.get_item_group(stack:get_name(), "cursed") ~= 0 then
return itemstack
end
index = i
self:unequip(player, armor_element)
break
Expand Down
50 changes: 33 additions & 17 deletions mods/3d_armor/3d_armor/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ local function init_player_armor(initplayer)
if player:get_player_name() ~= name then
return 0
end
--cursed items cannot be unequiped by the player
local is_cursed = minetest.get_item_group(stack:get_name(), "cursed") ~= 0
if not minetest.is_creative_enabled(player) and is_cursed then
return 0
end
return stack:get_count()
end,
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
Expand Down Expand Up @@ -355,9 +360,12 @@ if armor.config.drop == true or armor.config.destroy == true then
for i=1, armor_inv:get_size("armor") do
local stack = armor_inv:get_stack("armor", i)
if stack:get_count() > 0 then
table.insert(drop, stack)
armor:run_callbacks("on_unequip", player, i, stack)
armor_inv:set_stack("armor", i, nil)
--soulbound armors remain equipped after death
if minetest.get_item_group(stack:get_name(), "soulbound") == 0 then
table.insert(drop, stack)
armor:run_callbacks("on_unequip", player, i, stack)
armor_inv:set_stack("armor", i, nil)
end
end
end
armor:save_armor_inventory(player)
Expand Down Expand Up @@ -393,8 +401,8 @@ if armor.config.drop == true or armor.config.destroy == true then
end)
end
end)
else -- reset un-dropped armor and it's effects
minetest.register_on_respawnplayer(function(player)
-- reset un-dropped armor and it's effects
armor:set_player_armor(player)
end)
end
Expand All @@ -414,21 +422,29 @@ if armor.config.punch_damage == true then
end

minetest.register_on_player_hpchange(function(player, hp_change, reason)
if player and reason.type ~= "drown" and reason.hunger == nil
and hp_change < 0 then
local name = player:get_player_name()
if name then
local heal = armor.def[name].heal
if heal >= math.random(100) then
hp_change = 0
end
-- check if armor damage was handled by fire or on_punchplayer
local time = last_punch_time[name] or 0
if time == 0 or time + 1 < minetest.get_gametime() then
armor:punch(player)
end
if not minetest.is_player(player) then
return hp_change
end

if reason.type == "drown" or reason.hunger or hp_change >= 0 then
return hp_change
end

local name = player:get_player_name()
local properties = player:get_properties()
local hp = player:get_hp()
if hp + hp_change < properties.hp_max then
local heal = armor.def[name].heal
if heal >= math.random(100) then
hp_change = 0
end
-- check if armor damage was handled by fire or on_punchplayer
local time = last_punch_time[name] or 0
if time == 0 or time + 1 < minetest.get_gametime() then
armor:punch(player)
end
end

return hp_change
end, true)

Expand Down
8 changes: 4 additions & 4 deletions mods/3d_armor/3d_armor/locale/3d_armor.de.tr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# textdomain: 3d_armor
Radiation=Strahlen
Radiation=Strahlung
Level=Stufe
Heal=Heilen
Heal=Heilung
Fire=Feuer
Your @1 is almost broken!=Deine @1 ist fast kaputt!
Your @1 got destroyed!=Deine @1 wurde zerstört!
Your @1 is almost broken!=@1 ist fast kaputt!
Your @1 got destroyed!=@1 wurde zerstört!
3 changes: 3 additions & 0 deletions mods/3d_armor/3d_armor_ip/locale/3d_armor_ip.de.tr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# textdomain: 3d_armor_ip
Back=Zurück
Armor=Rüstung
2 changes: 2 additions & 0 deletions mods/3d_armor/3d_armor_sfinv/locale/3d_armor_sfinv.de.tr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# textdomain: 3d_armor_sfinv
Armor=Rüstung
5 changes: 5 additions & 0 deletions mods/3d_armor/3d_armor_stand/locale/3d_armor_stand.de.tr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# textdomain: 3d_armor_stand
Armor Stand Top=Rüstungsständeroberseite
Armor Stand=Rüstungsständer
Locked Armor Stand=Abgeschlossener Rüstungsständer
Armor Stand (owned by @1)=Rüstungsständer (Eigentum von @1)
8 changes: 8 additions & 0 deletions mods/3d_armor/3d_armor_ui/locale/3d_armor_ui.de.tr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# textdomain: 3d_armor_ui
3D Armor=3D-Rüstung
Armor not initialized!=Rüstung ist nicht initialisiert!
Armor=Rüstung
Level=Stufe
Heal=Heilung
Fire=Feuer
Radiation=Strahlung
2 changes: 1 addition & 1 deletion mods/3d_armor/modpack.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name = 3d_armor
title = 3D Armor
description = Visible player armor & wielded items.
author = stu
release = 16954
release = 20427

4 changes: 2 additions & 2 deletions mods/3d_armor/shields/locale/shields.de.tr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# textdomain: shields
Admin Shield=Adminschild
Wooden Shield=Holzschild
Enhanced Wood Shield=verbessert Holzschild
Enhanced Wood Shield=Verstärkter Holzschild
Cactus Shield=Kaktusschild
Enhanced Cactus Shield=verbessert Kaktusschild
Enhanced Cactus Shield=Verstärkter Kaktusschild
Steel Shield=Stahlschild
Bronze Shield=Bronzeschild
Diamond Shield=Diamantschild
Expand Down
7 changes: 7 additions & 0 deletions mods/airutils/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Media Licence:

CC0-1.0 for all media
the "airutils_explode.ogg" comes from minetest game tnt mod


Loading
Loading