Merge branch 'master' into guidelines

This commit is contained in:
Elias Fleckenstein 2021-11-03 20:04:08 +01:00
commit 643ded06da
No known key found for this signature in database
GPG key ID: 06927A5199D6C9B2
8 changed files with 762 additions and 677 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

View file

@ -417,8 +417,7 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
return
"style["..this_tab..";border=false;bgimg=;bgimg_pressed=]"..
"item_image_button[" .. boffset[this_tab] ..";1,1;"..tab_icon[this_tab]..";"..this_tab..";]"..
"image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]" ..
"image[" .. boffset[this_tab] .. ";1,1;crafting_creative_marker.png]"
"image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]"
end
local caption = ""
if name ~= "inv" and filtername[name] then

View file

@ -119,8 +119,7 @@ local patterns = {
name = N("@1 Thing Charge"),
type = "shapeless",
-- TODO: Replace with enchanted golden apple
{ e, "mcl_core:apple_gold", d },
{ e, "mcl_core:apple_gold_enchanted", d },
},
["rhombus"] = {
name = N("@1 Lozenge"),

View file

@ -4,6 +4,8 @@ minetest.register_on_leaveplayer(function(player)
hud_totem[player] = nil
end)
local particle_colors = {"98BF22", "C49E09", "337D0B", "B0B021", "1E9200"} -- TODO: real MC colors
-- Save the player from death when holding totem of undying in hand
mcl_damage.register_modifier(function(obj, damage, reason)
if obj:is_player() then
@ -32,6 +34,31 @@ mcl_damage.register_modifier(function(obj, damage, reason)
-- Effects
minetest.sound_play({name = "mcl_totems_totem", gain = 1}, {pos=ppos, max_hear_distance = 16}, true)
for i = 1, 4 do
for c = 1, #particle_colors do
minetest.add_particlespawner({
amount = math.floor(100 / (4 * #particle_colors)),
time = 1,
minpos = vector.offset(ppos, 0, -1, 0),
maxpos = vector.offset(ppos, 0, 1, 0),
minvel = vector.new(-1.5, 0, -1.5),
maxvel = vector.new(1.5, 1.5, 1.5),
minacc = vector.new(0, -0.1, 0),
maxacc = vector.new(0, -1, 0),
minexptime = 1,
maxexptime = 3,
minsize = 1,
maxsize = 2,
collisiondetection = true,
collision_removal = true,
object_collision = false,
vertical = false,
texture = "mcl_particles_totem" .. i .. ".png^[colorize:#" .. particle_colors[c],
glow = 10,
})
end
end
-- Big totem overlay
if not hud_totem[obj] then
hud_totem[obj] = obj:hud_add({

60
tools/analyze-packet-spam Executable file
View file

@ -0,0 +1,60 @@
#!/bin/sh -eu
# analyze-packet-spam show minetest client packet count per second
# Copyright © 2021 Nils Dagsson Moskopp (erlehmann)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# Dieses Programm hat das Ziel, die Medienkompetenz der Leser zu
# steigern. Gelegentlich packe ich sogar einen handfesten Buffer
# Overflow oder eine Format String Vulnerability zwischen die anderen
# Codezeilen und schreibe das auch nicht dran.
# This script takes a minetest log with at least INFO log level and
# outputs the MINETEST network protocol packet count per second.
# To collect such a log file of minetest running for 10 minutes, run:
# timeout 600 minetest --info >log.txt 2>&1 >/dev/null
# To get packet counts from that file, run:
# ./analyze-packet-spam <log.txt
TEMPFILE=$(mktemp /tmp/minetest.analyze-packet-spam.XXXXXXXX)
grep -F 'INFO[Main]: cmd' \
|while read DATE TIME _ _ PACKET_ID PACKET_NAME _ PACKET_COUNT; do
TIMESTAMP=$(date +%s --date "${DATE} ${TIME%:}")
PACKET_NAME=${PACKET_NAME#(}
PACKET_NAME=${PACKET_NAME%)}
VARIABLE=PACKET_COUNT_"${PACKET_NAME}"
eval "$( echo $VARIABLE=\$\(\( \${$VARIABLE:-0} + ${PACKET_COUNT} \)\) )"
printf '%s ' \
"${TIMESTAMP}" \
"${VARIABLE}"
eval echo \$${VARIABLE}
done >"${TEMPFILE}"
TIMESTAMP_START=$( <"${TEMPFILE}" head -n1 |cut -d' ' -f1 )
TIMESTAMP_END=$( <"${TEMPFILE}" tail -n1 |cut -d' ' -f1 )
DURATION=$(( 30 + ${TIMESTAMP_END} - ${TIMESTAMP_START} ))
PACKET_NAME_SEEN=''
<"${TEMPFILE}" tac \
|while read _ PACKET_NAME PACKET_COUNT; do
case "${PACKET_NAME_SEEN}" in
*"${PACKET_NAME}"*)
;;
*)
PACKET_COUNT_PER_SECOND=$(
printf '1k %s %s /p' "${PACKET_COUNT}" "${DURATION}" \
|dc
)
printf '%s\t%s\n' "${PACKET_COUNT_PER_SECOND}" "${PACKET_NAME}"
PACKET_NAME_SEEN="${PACKET_NAME_SEEN} ${PACKET_NAME}"
;;
esac
done
unlink "${TEMPFILE}"