From fe21aa1f4a92f54df2ed0f240472ce9a42fe473c Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 3 Apr 2020 23:20:11 +0200 Subject: Utility script to help with Weblate commit import --- util/reorder_translation_commits.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 util/reorder_translation_commits.py (limited to 'util') diff --git a/util/reorder_translation_commits.py b/util/reorder_translation_commits.py new file mode 100755 index 000000000..465cf0b93 --- /dev/null +++ b/util/reorder_translation_commits.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +import sys +import subprocess + +ret = subprocess.run(["git", "config", "rebase.instructionFormat"], capture_output=True) +if ret.returncode != 0 or ret.stdout.decode('ascii').strip() != "(%an <%ae>) %s": + print("Git is using the wrong rebase instruction format, reconfigure it.") + exit(1) + +try: + f = open(".git/rebase-merge/git-rebase-todo", "r") +except: + print("Initiate the rebase first!") + exit(1) +lines = list(s.strip("\r\n") for s in f.readlines()) +f.close() + +for i in range(len(lines)): + line = lines[i] + if line.startswith("#") or " Translated using Weblate " not in line: continue + pos = line.rfind("(") + lang = line[pos:] + author = line[line.find("("):line.rfind(")", 0, pos)+1] + # try to grab the next commit by the same author for the same language + for j in range(i+1, len(lines)): + if lines[j].startswith("#") or not lines[j].endswith(lang): continue + if author in lines[j]: + lines.insert(i+1, "f " + lines.pop(j)[5:]) + break + +with open(".git/rebase-merge/git-rebase-todo", "w") as f: + f.write("\n".join(lines) + "\n") +print("You can now continue with the rebase.") -- cgit v1.2.3 From d6ad587ab82cdbd129cc1d4de654114c8b6174f4 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 8 Apr 2020 21:05:27 +0200 Subject: Travis: Build clang jobs with LuaJIT enabled for better coverage --- util/travis/common.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/travis/common.sh b/util/travis/common.sh index b186632e1..cf9ce020e 100644 --- a/util/travis/common.sh +++ b/util/travis/common.sh @@ -18,11 +18,17 @@ set_linux_compiler_env() { # Linux build only install_linux_deps() { - sudo apt-get update - sudo apt-get install libirrlicht-dev cmake libbz2-dev libpng-dev \ + local pkgs=(libirrlicht-dev cmake libbz2-dev libpng-dev \ libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \ libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \ - gettext libpq-dev postgresql-server-dev-all libleveldb-dev + gettext libpq-dev postgresql-server-dev-all libleveldb-dev) + # for better coverage, build some jobs with luajit + if [[ "$CC" == "clang"* && -z "$VALGRIND$FREETYPE" ]]; then + pkgs+=(libluajit-5.1-dev) + fi + + sudo apt-get update + sudo apt-get install -y --no-install-recommends ${pkgs[@]} } # Mac OSX build only -- cgit v1.2.3 From f648fb76aef96a1da608c64346fc65d4dd44caa8 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Fri, 10 Apr 2020 19:49:20 +0200 Subject: Drop genericobject.{cpp,h} (#9629) * Drop genericobject.{cpp,h} This file is not for generic object but for ActiveObject message passing. Put ownership of the various commands to the right objects and cleanup the related code. * Protect ServerActiveObject::m_messages_out * typo fix --- build/android/jni/Android.mk | 1 - src/CMakeLists.txt | 1 - src/activeobject.h | 16 ++ src/client/clientenvironment.cpp | 2 +- src/client/content_cao.cpp | 38 +++-- src/client/content_cao.h | 1 + src/content_sao.cpp | 266 ++++++++++++++++++++++++--------- src/content_sao.h | 19 +++ src/genericobject.cpp | 207 ------------------------- src/genericobject.h | 87 ----------- src/network/networkprotocol.h | 8 +- src/server.cpp | 7 +- src/serverenvironment.cpp | 5 +- src/serverobject.cpp | 31 ++++ src/serverobject.h | 16 +- util/travis/clang-format-whitelist.txt | 2 - 16 files changed, 300 insertions(+), 407 deletions(-) delete mode 100644 src/genericobject.cpp delete mode 100644 src/genericobject.h (limited to 'util') diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index 72b0daab6..a2f32440a 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -176,7 +176,6 @@ LOCAL_SRC_FILES := \ jni/src/environment.cpp \ jni/src/face_position_cache.cpp \ jni/src/filesys.cpp \ - jni/src/genericobject.cpp \ jni/src/gettext.cpp \ jni/src/gui/guiAnimatedImage.cpp \ jni/src/gui/guiBackgroundImage.cpp \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d579bb965..4b1d6d647 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -384,7 +384,6 @@ set(common_SRCS environment.cpp face_position_cache.cpp filesys.cpp - genericobject.cpp gettext.cpp httpfetch.cpp hud.cpp diff --git a/src/activeobject.h b/src/activeobject.h index 4a2de92cd..c83243f86 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -55,6 +55,22 @@ struct ActiveObjectMessage std::string datastring; }; +enum ActiveObjectCommand { + AO_CMD_SET_PROPERTIES, + AO_CMD_UPDATE_POSITION, + AO_CMD_SET_TEXTURE_MOD, + AO_CMD_SET_SPRITE, + AO_CMD_PUNCHED, + AO_CMD_UPDATE_ARMOR_GROUPS, + AO_CMD_SET_ANIMATION, + AO_CMD_SET_BONE_POSITION, + AO_CMD_ATTACH_TO, + AO_CMD_SET_PHYSICS_OVERRIDE, + AO_CMD_UPDATE_NAMETAG_ATTRIBUTES, + AO_CMD_SPAWN_INFANT, + AO_CMD_SET_ANIMATION_SPEED +}; + /* Parent class for ServerActiveObject and ClientActiveObject */ diff --git a/src/client/clientenvironment.cpp b/src/client/clientenvironment.cpp index 52d133781..6840f2db3 100644 --- a/src/client/clientenvironment.cpp +++ b/src/client/clientenvironment.cpp @@ -450,7 +450,7 @@ void ClientEnvironment::addActiveObject(u16 id, u8 type, // Object initialized: if ((obj = getActiveObject(new_id))) { // Final step is to update all children which are already known - // Data provided by GENERIC_CMD_SPAWN_INFANT + // Data provided by AO_CMD_SPAWN_INFANT const auto &children = obj->getAttachmentChildIds(); for (auto c_id : children) { if (auto *o = getActiveObject(c_id)) diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index 8509eccb5..798899f9a 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -304,7 +304,6 @@ void TestCAO::processMessage(const std::string &data) GenericCAO */ -#include "genericobject.h" #include "clientobject.h" GenericCAO::GenericCAO(Client *client, ClientEnvironment *env): @@ -1421,14 +1420,23 @@ void GenericCAO::updateAttachments() } } +void GenericCAO::readAOMessageProperties(std::istream &is) +{ + // Reset object properties first + m_prop = ObjectProperties(); + + // Then read the whole new stream + m_prop.deSerialize(is); +} + void GenericCAO::processMessage(const std::string &data) { //infostream<<"GenericCAO: Got message"<physics_override_sneak_glitch = sneak_glitch; player->physics_override_new_move = new_move; } - } else if (cmd == GENERIC_CMD_SET_ANIMATION) { + } else if (cmd == AO_CMD_SET_ANIMATION) { // TODO: change frames send as v2s32 value v2f range = readV2F32(is); if (!m_is_local_player) { @@ -1565,17 +1573,17 @@ void GenericCAO::processMessage(const std::string &data) updateAnimation(); } } - } else if (cmd == GENERIC_CMD_SET_ANIMATION_SPEED) { + } else if (cmd == AO_CMD_SET_ANIMATION_SPEED) { m_animation_speed = readF32(is); updateAnimationSpeed(); - } else if (cmd == GENERIC_CMD_SET_BONE_POSITION) { + } else if (cmd == AO_CMD_SET_BONE_POSITION) { std::string bone = deSerializeString(is); v3f position = readV3F32(is); v3f rotation = readV3F32(is); m_bone_position[bone] = core::vector2d(position, rotation); updateBonePosition(); - } else if (cmd == GENERIC_CMD_ATTACH_TO) { + } else if (cmd == AO_CMD_ATTACH_TO) { u16 parent_id = readS16(is); std::string bone = deSerializeString(is); v3f position = readV3F32(is); @@ -1586,7 +1594,7 @@ void GenericCAO::processMessage(const std::string &data) // localplayer itself can't be attached to localplayer if (!m_is_local_player) m_is_visible = !m_attached_to_local; - } else if (cmd == GENERIC_CMD_PUNCHED) { + } else if (cmd == AO_CMD_PUNCHED) { u16 result_hp = readU16(is); // Use this instead of the send damage to not interfere with prediction @@ -1624,7 +1632,7 @@ void GenericCAO::processMessage(const std::string &data) if (!m_is_player) clearChildAttachments(); } - } else if (cmd == GENERIC_CMD_UPDATE_ARMOR_GROUPS) { + } else if (cmd == AO_CMD_UPDATE_ARMOR_GROUPS) { m_armor_groups.clear(); int armor_groups_size = readU16(is); for(int i=0; inametag_pos = pos; } - } else if (cmd == GENERIC_CMD_SPAWN_INFANT) { + } else if (cmd == AO_CMD_SPAWN_INFANT) { u16 child_id = readU16(is); u8 type = readU8(is); // maybe this will be useful later (void)type; diff --git a/src/client/content_cao.h b/src/client/content_cao.h index 7c29cbf17..c53b81433 100644 --- a/src/client/content_cao.h +++ b/src/client/content_cao.h @@ -68,6 +68,7 @@ struct SmoothTranslatorWrappedv3f : SmoothTranslator class GenericCAO : public ClientActiveObject { private: + void readAOMessageProperties(std::istream &is); // Only set at initialization std::string m_name = ""; bool m_is_player = false; diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 680bf372a..be7674f52 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "remoteplayer.h" #include "server.h" #include "scripting_server.h" -#include "genericobject.h" #include "settings.h" #include #include @@ -289,6 +288,120 @@ void UnitSAO::notifyObjectPropertiesModified() m_properties_sent = false; } +std::string UnitSAO::generateUpdateAttachmentCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_ATTACH_TO); + // parameters + writeS16(os, m_attachment_parent_id); + os << serializeString(m_attachment_bone); + writeV3F32(os, m_attachment_position); + writeV3F32(os, m_attachment_rotation); + return os.str(); +} + +std::string UnitSAO::generateUpdateBonePositionCommand(const std::string &bone, + const v3f &position, const v3f &rotation) +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_BONE_POSITION); + // parameters + os << serializeString(bone); + writeV3F32(os, position); + writeV3F32(os, rotation); + return os.str(); +} + + +std::string UnitSAO::generateUpdateAnimationSpeedCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_ANIMATION_SPEED); + // parameters + writeF32(os, m_animation_speed); + return os.str(); +} + +std::string UnitSAO::generateUpdateAnimationCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_ANIMATION); + // parameters + writeV2F32(os, m_animation_range); + writeF32(os, m_animation_speed); + writeF32(os, m_animation_blend); + // these are sent inverted so we get true when the server sends nothing + writeU8(os, !m_animation_loop); + return os.str(); +} + + +std::string UnitSAO::generateUpdateArmorGroupsCommand() const +{ + std::ostringstream os(std::ios::binary); + writeU8(os, AO_CMD_UPDATE_ARMOR_GROUPS); + writeU16(os, m_armor_groups.size()); + for (const auto &armor_group : m_armor_groups) { + os<>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii){ - std::string str = gob_cmd_update_bone_position((*ii).first, + std::string str = generateUpdateBonePositionCommand((*ii).first, (*ii).second.X, (*ii).second.Y); // create message and add to list ActiveObjectMessage aom(getId(), true, str); @@ -538,7 +647,7 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) if (!m_attachment_sent) { m_attachment_sent = true; - std::string str = gob_cmd_update_attachment(m_attachment_parent_id, m_attachment_bone, m_attachment_position, m_attachment_rotation); + std::string str = generateUpdateAttachmentCommand(); // create message and add to list ActiveObjectMessage aom(getId(), true, str); m_messages_out.push(aom); @@ -560,16 +669,14 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version) std::ostringstream msg_os(std::ios::binary); msg_os << serializeLongString(getPropertyPacket()); // message 1 - msg_os << serializeLongString(gob_cmd_update_armor_groups(m_armor_groups)); // 2 - msg_os << serializeLongString(gob_cmd_update_animation( - m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop)); // 3 + msg_os << serializeLongString(generateUpdateArmorGroupsCommand()); // 2 + msg_os << serializeLongString(generateUpdateAnimationCommand()); // 3 for (std::unordered_map>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { - msg_os << serializeLongString(gob_cmd_update_bone_position((*ii).first, + msg_os << serializeLongString(generateUpdateBonePositionCommand((*ii).first, (*ii).second.X, (*ii).second.Y)); // m_bone_position.size } - msg_os << serializeLongString(gob_cmd_update_attachment(m_attachment_parent_id, - m_attachment_bone, m_attachment_position, m_attachment_rotation)); // 4 + msg_os << serializeLongString(generateUpdateAttachmentCommand()); // 4 int message_count = 4 + m_bone_position.size(); for (std::unordered_set::const_iterator ii = m_attachment_child_ids.begin(); (ii != m_attachment_child_ids.end()); ++ii) { @@ -577,12 +684,11 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version) message_count++; // TODO after a protocol bump: only send the object initialization data // to older clients (superfluous since this message exists) - msg_os << serializeLongString(gob_cmd_update_infant(*ii, obj->getSendType(), - obj->getClientInitializationData(protocol_version))); + msg_os << serializeLongString(obj->generateUpdateInfantCommand(*ii, protocol_version)); } } - msg_os << serializeLongString(gob_cmd_set_texture_mod(m_current_texture_modifier)); + msg_os << serializeLongString(generateSetTextureModCommand()); message_count++; writeU8(os, message_count); @@ -655,10 +761,8 @@ u16 LuaEntitySAO::punch(v3f dir, setHP((s32)getHP() - result.damage, PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, puncher)); - std::string str = gob_cmd_punched(getHP()); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + sendPunchCommand(); } } @@ -750,11 +854,9 @@ v3f LuaEntitySAO::getAcceleration() void LuaEntitySAO::setTextureMod(const std::string &mod) { - std::string str = gob_cmd_set_texture_mod(mod); m_current_texture_modifier = mod; // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, generateSetTextureModCommand()); } std::string LuaEntitySAO::getTextureMod() const @@ -762,18 +864,42 @@ std::string LuaEntitySAO::getTextureMod() const return m_current_texture_modifier; } + +std::string LuaEntitySAO::generateSetTextureModCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_TEXTURE_MOD); + // parameters + os << serializeString(m_current_texture_modifier); + return os.str(); +} + +std::string LuaEntitySAO::generateSetSpriteCommand(v2s16 p, u16 num_frames, + f32 framelength, bool select_horiz_by_yawpitch) +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_SPRITE); + // parameters + writeV2S16(os, p); + writeU16(os, num_frames); + writeF32(os, framelength); + writeU8(os, select_horiz_by_yawpitch); + return os.str(); +} + void LuaEntitySAO::setSprite(v2s16 p, int num_frames, float framelength, bool select_horiz_by_yawpitch) { - std::string str = gob_cmd_set_sprite( + std::string str = generateSetSpriteCommand( p, num_frames, framelength, select_horiz_by_yawpitch ); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, str); } std::string LuaEntitySAO::getName() @@ -783,7 +909,7 @@ std::string LuaEntitySAO::getName() std::string LuaEntitySAO::getPropertyPacket() { - return gob_cmd_set_properties(m_prop); + return generateSetPropertiesCommand(m_prop); } void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end) @@ -802,7 +928,7 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end) float update_interval = m_env->getSendRecommendedInterval(); - std::string str = gob_cmd_update_position( + std::string str = generateUpdatePositionCommand( m_base_position, m_velocity, m_acceleration, @@ -812,8 +938,7 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end) update_interval ); // create message and add to list - ActiveObjectMessage aom(getId(), false, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), false, str); } bool LuaEntitySAO::getCollisionBox(aabb3f *toset) const @@ -949,28 +1074,23 @@ std::string PlayerSAO::getClientInitializationData(u16 protocol_version) std::ostringstream msg_os(std::ios::binary); msg_os << serializeLongString(getPropertyPacket()); // message 1 - msg_os << serializeLongString(gob_cmd_update_armor_groups(m_armor_groups)); // 2 - msg_os << serializeLongString(gob_cmd_update_animation( - m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop)); // 3 + msg_os << serializeLongString(generateUpdateArmorGroupsCommand()); // 2 + msg_os << serializeLongString(generateUpdateAnimationCommand()); // 3 for (std::unordered_map>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { - msg_os << serializeLongString(gob_cmd_update_bone_position((*ii).first, + msg_os << serializeLongString(generateUpdateBonePositionCommand((*ii).first, (*ii).second.X, (*ii).second.Y)); // m_bone_position.size } - msg_os << serializeLongString(gob_cmd_update_attachment(m_attachment_parent_id, - m_attachment_bone, m_attachment_position, m_attachment_rotation)); // 4 - msg_os << serializeLongString(gob_cmd_update_physics_override(m_physics_override_speed, - m_physics_override_jump, m_physics_override_gravity, m_physics_override_sneak, - m_physics_override_sneak_glitch, m_physics_override_new_move)); // 5 - // (GENERIC_CMD_UPDATE_NAMETAG_ATTRIBUTES) : Deprecated, for backwards compatibility only. - msg_os << serializeLongString(gob_cmd_update_nametag_attributes(m_prop.nametag_color)); // 6 + msg_os << serializeLongString(generateUpdateAttachmentCommand()); // 4 + msg_os << serializeLongString(generateUpdatePhysicsOverrideCommand()); // 5 + // (AO_CMD_UPDATE_NAMETAG_ATTRIBUTES) : Deprecated, for backwards compatibility only. + msg_os << serializeLongString(generateUpdateNametagAttributesCommand(m_prop.nametag_color)); // 6 int message_count = 6 + m_bone_position.size(); for (std::unordered_set::const_iterator ii = m_attachment_child_ids.begin(); ii != m_attachment_child_ids.end(); ++ii) { if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) { message_count++; - msg_os << serializeLongString(gob_cmd_update_infant(*ii, obj->getSendType(), - obj->getClientInitializationData(protocol_version))); + msg_os << serializeLongString(obj->generateUpdateInfantCommand(*ii, protocol_version)); } } @@ -1116,7 +1236,7 @@ void PlayerSAO::step(float dtime, bool send_recommended) else pos = m_base_position; - std::string str = gob_cmd_update_position( + std::string str = generateUpdatePositionCommand( pos, v3f(0.0f, 0.0f, 0.0f), v3f(0.0f, 0.0f, 0.0f), @@ -1126,61 +1246,63 @@ void PlayerSAO::step(float dtime, bool send_recommended) update_interval ); // create message and add to list - ActiveObjectMessage aom(getId(), false, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), false, str); } if (!m_armor_groups_sent) { m_armor_groups_sent = true; - std::string str = gob_cmd_update_armor_groups( - m_armor_groups); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, generateUpdateArmorGroupsCommand()); } if (!m_physics_override_sent) { m_physics_override_sent = true; - std::string str = gob_cmd_update_physics_override(m_physics_override_speed, - m_physics_override_jump, m_physics_override_gravity, - m_physics_override_sneak, m_physics_override_sneak_glitch, - m_physics_override_new_move); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, generateUpdatePhysicsOverrideCommand()); } if (!m_animation_sent) { m_animation_sent = true; - std::string str = gob_cmd_update_animation( - m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, generateUpdateAnimationCommand()); } if (!m_bone_position_sent) { m_bone_position_sent = true; for (std::unordered_map>::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { - std::string str = gob_cmd_update_bone_position((*ii).first, + std::string str = generateUpdateBonePositionCommand((*ii).first, (*ii).second.X, (*ii).second.Y); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + m_messages_out.emplace(getId(), true, str); } } if (!m_attachment_sent) { m_attachment_sent = true; - std::string str = gob_cmd_update_attachment(m_attachment_parent_id, - m_attachment_bone, m_attachment_position, m_attachment_rotation); + std::string str = generateUpdateAttachmentCommand(); // create message and add to list ActiveObjectMessage aom(getId(), true, str); m_messages_out.push(aom); } } +std::string PlayerSAO::generateUpdatePhysicsOverrideCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_PHYSICS_OVERRIDE); + // parameters + writeF32(os, m_physics_override_speed); + writeF32(os, m_physics_override_jump); + writeF32(os, m_physics_override_gravity); + // these are sent inverted so we get true when the server sends nothing + writeU8(os, !m_physics_override_sneak); + writeU8(os, !m_physics_override_sneak_glitch); + writeU8(os, !m_physics_override_new_move); + return os.str(); +} + void PlayerSAO::setBasePosition(const v3f &position) { if (m_player && position != m_base_position) @@ -1284,10 +1406,8 @@ u16 PlayerSAO::punch(v3f dir, // No effect if PvP disabled or if immortal if (isImmortal() || !g_settings->getBool("enable_pvp")) { if (puncher->getType() == ACTIVEOBJECT_TYPE_PLAYER) { - std::string str = gob_cmd_punched(getHP()); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + sendPunchCommand(); return 0; } } @@ -1307,10 +1427,8 @@ u16 PlayerSAO::punch(v3f dir, PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, puncher)); } else { // override client prediction if (puncher->getType() == ACTIVEOBJECT_TYPE_PLAYER) { - std::string str = gob_cmd_punched(getHP()); // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); + sendPunchCommand(); } } @@ -1408,7 +1526,7 @@ void PlayerSAO::unlinkPlayerSessionAndSave() std::string PlayerSAO::getPropertyPacket() { m_prop.is_visible = (true); - return gob_cmd_set_properties(m_prop); + return generateSetPropertiesCommand(m_prop); } void PlayerSAO::setMaxSpeedOverride(const v3f &vel) diff --git a/src/content_sao.h b/src/content_sao.h index e9047daf0..e0304299a 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -67,6 +67,19 @@ public: ServerActiveObject *getParent() const; ObjectProperties* accessObjectProperties(); void notifyObjectPropertiesModified(); + + std::string generateUpdateAttachmentCommand() const; + std::string generateUpdateAnimationSpeedCommand() const; + std::string generateUpdateAnimationCommand() const; + std::string generateUpdateArmorGroupsCommand() const; + static std::string generateUpdatePositionCommand(const v3f &position, const v3f &velocity, + const v3f &acceleration, const v3f &rotation, bool do_interpolate, + bool is_movement_end, f32 update_interval); + std::string generateSetPropertiesCommand(const ObjectProperties &prop) const; + void sendPunchCommand(); + static std::string generateUpdateBonePositionCommand(const std::string &bone, + const v3f &position, const v3f &rotation); + protected: u16 m_hp = 1; @@ -98,6 +111,8 @@ protected: private: void onAttach(int parent_id); void onDetach(int parent_id); + + std::string generatePunchCommand(u16 result_hp) const; }; /* @@ -155,6 +170,9 @@ public: private: std::string getPropertyPacket(); void sendPosition(bool do_interpolate, bool is_movement_end); + std::string generateSetTextureModCommand() const; + static std::string generateSetSpriteCommand(v2s16 p, u16 num_frames, f32 framelength, + bool select_horiz_by_yawpitch); std::string m_init_name; std::string m_init_state; @@ -350,6 +368,7 @@ public: private: std::string getPropertyPacket(); void unlinkPlayerSessionAndSave(); + std::string generateUpdatePhysicsOverrideCommand() const; RemotePlayer *m_player = nullptr; session_t m_peer_id = 0; diff --git a/src/genericobject.cpp b/src/genericobject.cpp deleted file mode 100644 index 49d16001f..000000000 --- a/src/genericobject.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* -Minetest -Copyright (C) 2013 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "genericobject.h" -#include -#include "util/serialize.h" - -std::string gob_cmd_set_properties(const ObjectProperties &prop) -{ - std::ostringstream os(std::ios::binary); - writeU8(os, GENERIC_CMD_SET_PROPERTIES); - prop.serialize(os); - return os.str(); -} - -ObjectProperties gob_read_set_properties(std::istream &is) -{ - ObjectProperties prop; - prop.deSerialize(is); - return prop; -} - -std::string gob_cmd_update_position( - v3f position, - v3f velocity, - v3f acceleration, - v3f rotation, - bool do_interpolate, - bool is_movement_end, - f32 update_interval -){ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, GENERIC_CMD_UPDATE_POSITION); - // pos - writeV3F32(os, position); - // velocity - writeV3F32(os, velocity); - // acceleration - writeV3F32(os, acceleration); - // rotation - writeV3F32(os, rotation); - // do_interpolate - writeU8(os, do_interpolate); - // is_end_position (for interpolation) - writeU8(os, is_movement_end); - // update_interval (for interpolation) - writeF32(os, update_interval); - return os.str(); -} - -std::string gob_cmd_set_texture_mod(const std::string &mod) -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, GENERIC_CMD_SET_TEXTURE_MOD); - // parameters - os< - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#pragma once - -#include -#include "irrlichttypes_bloated.h" -#include -#include "itemgroup.h" - -enum GenericCMD { - GENERIC_CMD_SET_PROPERTIES, - GENERIC_CMD_UPDATE_POSITION, - GENERIC_CMD_SET_TEXTURE_MOD, - GENERIC_CMD_SET_SPRITE, - GENERIC_CMD_PUNCHED, - GENERIC_CMD_UPDATE_ARMOR_GROUPS, - GENERIC_CMD_SET_ANIMATION, - GENERIC_CMD_SET_BONE_POSITION, - GENERIC_CMD_ATTACH_TO, - GENERIC_CMD_SET_PHYSICS_OVERRIDE, - GENERIC_CMD_UPDATE_NAMETAG_ATTRIBUTES, - GENERIC_CMD_SPAWN_INFANT, - GENERIC_CMD_SET_ANIMATION_SPEED -}; - -#include "object_properties.h" -std::string gob_cmd_set_properties(const ObjectProperties &prop); -ObjectProperties gob_read_set_properties(std::istream &is); - -std::string gob_cmd_update_position( - v3f position, - v3f velocity, - v3f acceleration, - v3f rotation, - bool do_interpolate, - bool is_movement_end, - f32 update_interval -); - -std::string gob_cmd_set_texture_mod(const std::string &mod); - -std::string gob_cmd_set_sprite( - v2s16 p, - u16 num_frames, - f32 framelength, - bool select_horiz_by_yawpitch -); - -std::string gob_cmd_punched(u16 result_hp); - -std::string gob_cmd_update_armor_groups(const ItemGroupList &armor_groups); - -std::string gob_cmd_update_physics_override(float physics_override_speed, - float physics_override_jump, float physics_override_gravity, - bool sneak, bool sneak_glitch, bool new_move); - -std::string gob_cmd_update_animation(v2f frames, float frame_speed, float frame_blend, bool frame_loop); - -std::string gob_cmd_update_animation_speed(float frame_speed); - -std::string gob_cmd_update_bone_position(const std::string &bone, v3f position, - v3f rotation); - -std::string gob_cmd_update_attachment(int parent_id, const std::string &bone, - v3f position, v3f rotation); - -std::string gob_cmd_update_nametag_attributes(video::SColor color); - -std::string gob_cmd_update_infant(u16 id, u8 type, - const std::string &client_initialization_data); diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h index d3799868b..7223ce05c 100644 --- a/src/network/networkprotocol.h +++ b/src/network/networkprotocol.h @@ -70,8 +70,8 @@ with this program; if not, write to the Free Software Foundation, Inc., PROTOCOL_VERSION 14: Added transfer of player pressed keys to the server Added new messages for mesh and bone animation, as well as attachments - GENERIC_CMD_SET_ANIMATION - GENERIC_CMD_SET_BONE_POSITION + AO_CMD_SET_ANIMATION + AO_CMD_SET_BONE_POSITION GENERIC_CMD_SET_ATTACHMENT PROTOCOL_VERSION 15: Serialization format changes @@ -87,7 +87,7 @@ with this program; if not, write to the Free Software Foundation, Inc., damageGroups added to ToolCapabilities sound_place added to ItemDefinition PROTOCOL_VERSION 19: - GENERIC_CMD_SET_PHYSICS_OVERRIDE + AO_CMD_SET_PHYSICS_OVERRIDE PROTOCOL_VERSION 20: TOCLIENT_HUDADD TOCLIENT_HUDRM @@ -131,7 +131,7 @@ with this program; if not, write to the Free Software Foundation, Inc., Add TOCLIENT_HELLO for presenting server to client after client presentation Add TOCLIENT_AUTH_ACCEPT to accept connection from client - Rename GENERIC_CMD_SET_ATTACHMENT to GENERIC_CMD_ATTACH_TO + Rename GENERIC_CMD_SET_ATTACHMENT to AO_CMD_ATTACH_TO PROTOCOL_VERSION 26: Add TileDef tileable_horizontal, tileable_vertical flags PROTOCOL_VERSION 27: diff --git a/src/server.cpp b/src/server.cpp index 9eea45b31..062fe0798 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -35,7 +35,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #include "mapblock.h" #include "serverobject.h" -#include "genericobject.h" #include "settings.h" #include "profiler.h" #include "log.h" @@ -721,7 +720,7 @@ void Server::AsyncRunStep(bool initial_step) // Go through every message for (const ActiveObjectMessage &aom : *list) { // Send position updates to players who do not see the attachment - if (aom.datastring[0] == GENERIC_CMD_UPDATE_POSITION) { + if (aom.datastring[0] == AO_CMD_UPDATE_POSITION) { if (sao->getId() == player->getId()) continue; @@ -1819,9 +1818,7 @@ void Server::SendPlayerHP(session_t peer_id) m_script->player_event(playersao,"health_changed"); // Send to other clients - std::string str = gob_cmd_punched(playersao->getHP()); - ActiveObjectMessage aom(playersao->getId(), true, str); - playersao->m_messages_out.push(aom); + playersao->sendPunchCommand(); } void Server::SendPlayerBreath(PlayerSAO *sao) diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index 333d32ff5..2d3ee078e 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -1420,10 +1420,7 @@ void ServerEnvironment::step(float dtime) // Step object obj->step(dtime, send_recommended); // Read messages from object - while (!obj->m_messages_out.empty()) { - this->m_active_object_messages.push(obj->m_messages_out.front()); - obj->m_messages_out.pop(); - } + obj->dumpAOMessagesToQueue(m_active_object_messages); }; m_ao_manager.step(dtime, cb_state); } diff --git a/src/serverobject.cpp b/src/serverobject.cpp index 1ed33f66b..119a41b7b 100644 --- a/src/serverobject.cpp +++ b/src/serverobject.cpp @@ -81,3 +81,34 @@ bool ServerActiveObject::setWieldedItem(const ItemStack &item) { return false; } + +std::string ServerActiveObject::generateUpdateInfantCommand(u16 infant_id, u16 protocol_version) +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SPAWN_INFANT); + // parameters + writeU16(os, infant_id); + writeU8(os, getSendType()); + os << serializeLongString(getClientInitializationData(protocol_version)); + return os.str(); +} + +std::string ServerActiveObject::generateUpdateNametagAttributesCommand(const video::SColor &color) const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_UPDATE_NAMETAG_ATTRIBUTES); + // parameters + writeU8(os, 1); // version for forward compatibility + writeARGB8(os, color); + return os.str(); +} + +void ServerActiveObject::dumpAOMessagesToQueue(std::queue &queue) +{ + while (!m_messages_out.empty()) { + queue.push(m_messages_out.front()); + m_messages_out.pop(); + } +} \ No newline at end of file diff --git a/src/serverobject.h b/src/serverobject.h index 48689fcb4..2e013a6b6 100644 --- a/src/serverobject.h +++ b/src/serverobject.h @@ -113,7 +113,7 @@ public: The return value of this is passed to the client-side object when it is created */ - virtual std::string getClientInitializationData(u16 protocol_version){return "";} + virtual std::string getClientInitializationData(u16 protocol_version) {return "";} /* The return value of this is passed to the server-side object @@ -192,6 +192,10 @@ public: m_attached_particle_spawners.erase(id); } + std::string generateUpdateInfantCommand(u16 infant_id, u16 protocol_version); + std::string generateUpdateNametagAttributesCommand(const video::SColor &color) const; + + void dumpAOMessagesToQueue(std::queue &queue); /* Number of players which know about this object. Object won't be @@ -236,11 +240,6 @@ public: */ v3s16 m_static_block = v3s16(1337,1337,1337); - /* - Queue of messages to be sent to the client - */ - std::queue m_messages_out; - protected: virtual void onAttach(int parent_id) {} virtual void onDetach(int parent_id) {} @@ -255,6 +254,11 @@ protected: v3f m_base_position; std::unordered_set m_attached_particle_spawners; + /* + Queue of messages to be sent to the client + */ + std::queue m_messages_out; + private: // Used for creating objects based on type static std::map m_types; diff --git a/util/travis/clang-format-whitelist.txt b/util/travis/clang-format-whitelist.txt index 05b4a96c4..7b2fd8236 100644 --- a/util/travis/clang-format-whitelist.txt +++ b/util/travis/clang-format-whitelist.txt @@ -151,8 +151,6 @@ src/fontengine.h src/game.cpp src/gamedef.h src/game.h -src/genericobject.cpp -src/genericobject.h src/gettext.cpp src/gettext.h src/gui/guiAnimatedImage.cpp -- cgit v1.2.3 From 6d43736172f8459cb70219186ae003c56c389f2a Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Fri, 10 Apr 2020 21:25:42 +0200 Subject: Move serveractiveobject & unitsao Move serverobject.{cpp,h} to server/serveractiveobject.{cpp,h} Move UnitSAO class to dedicated files --- build/android/jni/Android.mk | 2 +- src/CMakeLists.txt | 1 - src/collision.cpp | 2 +- src/content_sao.cpp | 296 ------------------------------ src/content_sao.h | 92 +--------- src/emerge.cpp | 1 - src/environment.cpp | 1 - src/inventorymanager.cpp | 2 +- src/mapgen/mapgen_v6.cpp | 1 - src/script/common/c_content.cpp | 2 +- src/script/cpp_api/s_base.cpp | 2 +- src/script/lua_api/l_object.cpp | 2 +- src/server.cpp | 2 +- src/server/CMakeLists.txt | 2 + src/server/activeobjectmgr.h | 2 +- src/server/serveractiveobject.cpp | 114 ++++++++++++ src/server/serveractiveobject.h | 265 +++++++++++++++++++++++++++ src/server/unit_sao.cpp | 318 +++++++++++++++++++++++++++++++++ src/server/unit_sao.h | 113 ++++++++++++ src/serverobject.cpp | 114 ------------ src/serverobject.h | 265 --------------------------- util/travis/clang-format-whitelist.txt | 6 +- 22 files changed, 823 insertions(+), 782 deletions(-) create mode 100644 src/server/serveractiveobject.cpp create mode 100644 src/server/serveractiveobject.h create mode 100644 src/server/unit_sao.cpp create mode 100644 src/server/unit_sao.h delete mode 100644 src/serverobject.cpp delete mode 100644 src/serverobject.h (limited to 'util') diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index a2f32440a..32a16c174 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -259,7 +259,7 @@ LOCAL_SRC_FILES := \ jni/src/serverenvironment.cpp \ jni/src/serverlist.cpp \ jni/src/server/mods.cpp \ - jni/src/serverobject.cpp \ + jni/src/server/serveractiveobject.cpp \ jni/src/settings.cpp \ jni/src/staticobject.cpp \ jni/src/tileanimation.cpp \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4b1d6d647..faa117d41 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -421,7 +421,6 @@ set(common_SRCS server.cpp serverenvironment.cpp serverlist.cpp - serverobject.cpp settings.cpp staticobject.cpp terminal_chat_console.cpp diff --git a/src/collision.cpp b/src/collision.cpp index 0d37ea436..d9fbd3202 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/localplayer.h" #endif #include "serverenvironment.h" -#include "serverobject.h" +#include "server/serveractiveobject.h" #include "util/timetaker.h" #include "profiler.h" diff --git a/src/content_sao.cpp b/src/content_sao.cpp index be7674f52..0d387b53a 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -106,302 +106,6 @@ private: // Prototype (registers item for deserialization) TestSAO proto_TestSAO(NULL, v3f(0,0,0)); -/* - UnitSAO - */ - -UnitSAO::UnitSAO(ServerEnvironment *env, v3f pos): - ServerActiveObject(env, pos) -{ - // Initialize something to armor groups - m_armor_groups["fleshy"] = 100; -} - -ServerActiveObject *UnitSAO::getParent() const -{ - if (!m_attachment_parent_id) - return nullptr; - // Check if the parent still exists - ServerActiveObject *obj = m_env->getActiveObject(m_attachment_parent_id); - - return obj; -} - -void UnitSAO::setArmorGroups(const ItemGroupList &armor_groups) -{ - m_armor_groups = armor_groups; - m_armor_groups_sent = false; -} - -const ItemGroupList &UnitSAO::getArmorGroups() const -{ - return m_armor_groups; -} - -void UnitSAO::setAnimation(v2f frame_range, float frame_speed, float frame_blend, bool frame_loop) -{ - // store these so they can be updated to clients - m_animation_range = frame_range; - m_animation_speed = frame_speed; - m_animation_blend = frame_blend; - m_animation_loop = frame_loop; - m_animation_sent = false; -} - -void UnitSAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend, bool *frame_loop) -{ - *frame_range = m_animation_range; - *frame_speed = m_animation_speed; - *frame_blend = m_animation_blend; - *frame_loop = m_animation_loop; -} - -void UnitSAO::setAnimationSpeed(float frame_speed) -{ - m_animation_speed = frame_speed; - m_animation_speed_sent = false; -} - -void UnitSAO::setBonePosition(const std::string &bone, v3f position, v3f rotation) -{ - // store these so they can be updated to clients - m_bone_position[bone] = core::vector2d(position, rotation); - m_bone_position_sent = false; -} - -void UnitSAO::getBonePosition(const std::string &bone, v3f *position, v3f *rotation) -{ - *position = m_bone_position[bone].X; - *rotation = m_bone_position[bone].Y; -} - -void UnitSAO::setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation) -{ - // Attachments need to be handled on both the server and client. - // If we just attach on the server, we can only copy the position of the parent. Attachments - // are still sent to clients at an interval so players might see them lagging, plus we can't - // read and attach to skeletal bones. - // If we just attach on the client, the server still sees the child at its original location. - // This breaks some things so we also give the server the most accurate representation - // even if players only see the client changes. - - int old_parent = m_attachment_parent_id; - m_attachment_parent_id = parent_id; - m_attachment_bone = bone; - m_attachment_position = position; - m_attachment_rotation = rotation; - m_attachment_sent = false; - - if (parent_id != old_parent) { - onDetach(old_parent); - onAttach(parent_id); - } -} - -void UnitSAO::getAttachment(int *parent_id, std::string *bone, v3f *position, - v3f *rotation) const -{ - *parent_id = m_attachment_parent_id; - *bone = m_attachment_bone; - *position = m_attachment_position; - *rotation = m_attachment_rotation; -} - -void UnitSAO::clearChildAttachments() -{ - for (int child_id : m_attachment_child_ids) { - // Child can be NULL if it was deleted earlier - if (ServerActiveObject *child = m_env->getActiveObject(child_id)) - child->setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0)); - } - m_attachment_child_ids.clear(); -} - -void UnitSAO::clearParentAttachment() -{ - ServerActiveObject *parent = nullptr; - if (m_attachment_parent_id) { - parent = m_env->getActiveObject(m_attachment_parent_id); - setAttachment(0, "", m_attachment_position, m_attachment_rotation); - } else { - setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0)); - } - // Do it - if (parent) - parent->removeAttachmentChild(m_id); -} - -void UnitSAO::addAttachmentChild(int child_id) -{ - m_attachment_child_ids.insert(child_id); -} - -void UnitSAO::removeAttachmentChild(int child_id) -{ - m_attachment_child_ids.erase(child_id); -} - -const std::unordered_set &UnitSAO::getAttachmentChildIds() const -{ - return m_attachment_child_ids; -} - -void UnitSAO::onAttach(int parent_id) -{ - if (!parent_id) - return; - - ServerActiveObject *parent = m_env->getActiveObject(parent_id); - - if (!parent || parent->isGone()) - return; // Do not try to notify soon gone parent - - if (parent->getType() == ACTIVEOBJECT_TYPE_LUAENTITY) { - // Call parent's on_attach field - m_env->getScriptIface()->luaentity_on_attach_child(parent_id, this); - } -} - -void UnitSAO::onDetach(int parent_id) -{ - if (!parent_id) - return; - - ServerActiveObject *parent = m_env->getActiveObject(parent_id); - if (getType() == ACTIVEOBJECT_TYPE_LUAENTITY) - m_env->getScriptIface()->luaentity_on_detach(m_id, parent); - - if (!parent || parent->isGone()) - return; // Do not try to notify soon gone parent - - if (parent->getType() == ACTIVEOBJECT_TYPE_LUAENTITY) - m_env->getScriptIface()->luaentity_on_detach_child(parent_id, this); -} - -ObjectProperties* UnitSAO::accessObjectProperties() -{ - return &m_prop; -} - -void UnitSAO::notifyObjectPropertiesModified() -{ - m_properties_sent = false; -} - -std::string UnitSAO::generateUpdateAttachmentCommand() const -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, AO_CMD_ATTACH_TO); - // parameters - writeS16(os, m_attachment_parent_id); - os << serializeString(m_attachment_bone); - writeV3F32(os, m_attachment_position); - writeV3F32(os, m_attachment_rotation); - return os.str(); -} - -std::string UnitSAO::generateUpdateBonePositionCommand(const std::string &bone, - const v3f &position, const v3f &rotation) -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, AO_CMD_SET_BONE_POSITION); - // parameters - os << serializeString(bone); - writeV3F32(os, position); - writeV3F32(os, rotation); - return os.str(); -} - - -std::string UnitSAO::generateUpdateAnimationSpeedCommand() const -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, AO_CMD_SET_ANIMATION_SPEED); - // parameters - writeF32(os, m_animation_speed); - return os.str(); -} - -std::string UnitSAO::generateUpdateAnimationCommand() const -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, AO_CMD_SET_ANIMATION); - // parameters - writeV2F32(os, m_animation_range); - writeF32(os, m_animation_speed); - writeF32(os, m_animation_blend); - // these are sent inverted so we get true when the server sends nothing - writeU8(os, !m_animation_loop); - return os.str(); -} - - -std::string UnitSAO::generateUpdateArmorGroupsCommand() const -{ - std::ostringstream os(std::ios::binary); - writeU8(os, AO_CMD_UPDATE_ARMOR_GROUPS); - writeU16(os, m_armor_groups.size()); - for (const auto &armor_group : m_armor_groups) { - os< &getAttachmentChildIds() const; - ServerActiveObject *getParent() const; - ObjectProperties* accessObjectProperties(); - void notifyObjectPropertiesModified(); - - std::string generateUpdateAttachmentCommand() const; - std::string generateUpdateAnimationSpeedCommand() const; - std::string generateUpdateAnimationCommand() const; - std::string generateUpdateArmorGroupsCommand() const; - static std::string generateUpdatePositionCommand(const v3f &position, const v3f &velocity, - const v3f &acceleration, const v3f &rotation, bool do_interpolate, - bool is_movement_end, f32 update_interval); - std::string generateSetPropertiesCommand(const ObjectProperties &prop) const; - void sendPunchCommand(); - static std::string generateUpdateBonePositionCommand(const std::string &bone, - const v3f &position, const v3f &rotation); - -protected: - u16 m_hp = 1; - - v3f m_rotation; - - bool m_properties_sent = true; - ObjectProperties m_prop; - - ItemGroupList m_armor_groups; - bool m_armor_groups_sent = false; - - v2f m_animation_range; - float m_animation_speed = 0.0f; - float m_animation_blend = 0.0f; - bool m_animation_loop = true; - bool m_animation_sent = false; - bool m_animation_speed_sent = false; - - // Stores position and rotation for each bone name - std::unordered_map> m_bone_position; - bool m_bone_position_sent = false; - - int m_attachment_parent_id = 0; - std::unordered_set m_attachment_child_ids; - std::string m_attachment_bone = ""; - v3f m_attachment_position; - v3f m_attachment_rotation; - bool m_attachment_sent = false; -private: - void onAttach(int parent_id); - void onDetach(int parent_id); - - std::string generatePunchCommand(u16 result_hp) const; -}; - /* LuaEntitySAO needs some internals exposed. */ diff --git a/src/emerge.cpp b/src/emerge.cpp index 4835c3fad..fe885447c 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -42,7 +42,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "profiler.h" #include "scripting_server.h" #include "server.h" -#include "serverobject.h" #include "settings.h" #include "voxel.h" diff --git a/src/environment.cpp b/src/environment.cpp index c997be3ff..6751f39e4 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "environment.h" #include "collision.h" #include "raycast.h" -#include "serverobject.h" #include "scripting_server.h" #include "server.h" #include "daynightratio.h" diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index 5a24f95a4..b6f464901 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "log.h" #include "serverenvironment.h" #include "scripting_server.h" -#include "serverobject.h" +#include "server/serveractiveobject.h" #include "settings.h" #include "craftdef.h" #include "rollback_interface.h" diff --git a/src/mapgen/mapgen_v6.cpp b/src/mapgen/mapgen_v6.cpp index 8a863c044..f473f725d 100644 --- a/src/mapgen/mapgen_v6.cpp +++ b/src/mapgen/mapgen_v6.cpp @@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "mapnode.h" #include "map.h" -//#include "serverobject.h" #include "content_sao.h" #include "nodedef.h" #include "voxelalgorithms.h" diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index accbb1a87..60f12052f 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "server.h" #include "log.h" #include "tool.h" -#include "serverobject.h" +#include "server/serveractiveobject.h" #include "porting.h" #include "mapgen/mg_schematic.h" #include "noise.h" diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp index f234a15d4..16c20eeae 100644 --- a/src/script/cpp_api/s_base.cpp +++ b/src/script/cpp_api/s_base.cpp @@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/s_security.h" #include "lua_api/l_object.h" #include "common/c_converter.h" -#include "serverobject.h" +#include "server/serveractiveobject.h" #include "filesys.h" #include "content/mods.h" #include "porting.h" diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 5cd978d73..1ea144a1c 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_content.h" #include "log.h" #include "tool.h" -#include "serverobject.h" +#include "server/serveractiveobject.h" #include "content_sao.h" #include "remoteplayer.h" #include "server.h" diff --git a/src/server.cpp b/src/server.cpp index 062fe0798..529466f6b 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -34,7 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "version.h" #include "filesys.h" #include "mapblock.h" -#include "serverobject.h" +#include "server/serveractiveobject.h" #include "settings.h" #include "profiler.h" #include "log.h" diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index e964c69ff..9fa5ed9fa 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -1,4 +1,6 @@ set(server_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/activeobjectmgr.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mods.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/serveractiveobject.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/unit_sao.cpp PARENT_SCOPE) diff --git a/src/server/activeobjectmgr.h b/src/server/activeobjectmgr.h index a502ac6ed..5fea1bea6 100644 --- a/src/server/activeobjectmgr.h +++ b/src/server/activeobjectmgr.h @@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include "../activeobjectmgr.h" -#include "serverobject.h" +#include "serveractiveobject.h" namespace server { diff --git a/src/server/serveractiveobject.cpp b/src/server/serveractiveobject.cpp new file mode 100644 index 000000000..3aa78c7d5 --- /dev/null +++ b/src/server/serveractiveobject.cpp @@ -0,0 +1,114 @@ +/* +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "serveractiveobject.h" +#include +#include "inventory.h" +#include "constants.h" // BS +#include "log.h" + +ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos): + ActiveObject(0), + m_env(env), + m_base_position(pos) +{ +} + +ServerActiveObject* ServerActiveObject::create(ActiveObjectType type, + ServerEnvironment *env, u16 id, v3f pos, + const std::string &data) +{ + // Find factory function + std::map::iterator n; + n = m_types.find(type); + if(n == m_types.end()) { + // These are 0.3 entity types, return without error. + if (ACTIVEOBJECT_TYPE_ITEM <= type && type <= ACTIVEOBJECT_TYPE_MOBV2) { + return NULL; + } + + // If factory is not found, just return. + warningstream<<"ServerActiveObject: No factory for type=" + <second; + ServerActiveObject *object = (*f)(env, pos, data); + return object; +} + +void ServerActiveObject::registerType(u16 type, Factory f) +{ + std::map::iterator n; + n = m_types.find(type); + if(n != m_types.end()) + return; + m_types[type] = f; +} + +float ServerActiveObject::getMinimumSavedMovement() +{ + return 2.0*BS; +} + +ItemStack ServerActiveObject::getWieldedItem(ItemStack *selected, ItemStack *hand) const +{ + *selected = ItemStack(); + if (hand) + *hand = ItemStack(); + + return ItemStack(); +} + +bool ServerActiveObject::setWieldedItem(const ItemStack &item) +{ + return false; +} + +std::string ServerActiveObject::generateUpdateInfantCommand(u16 infant_id, u16 protocol_version) +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SPAWN_INFANT); + // parameters + writeU16(os, infant_id); + writeU8(os, getSendType()); + os << serializeLongString(getClientInitializationData(protocol_version)); + return os.str(); +} + +std::string ServerActiveObject::generateUpdateNametagAttributesCommand(const video::SColor &color) const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_UPDATE_NAMETAG_ATTRIBUTES); + // parameters + writeU8(os, 1); // version for forward compatibility + writeARGB8(os, color); + return os.str(); +} + +void ServerActiveObject::dumpAOMessagesToQueue(std::queue &queue) +{ + while (!m_messages_out.empty()) { + queue.push(m_messages_out.front()); + m_messages_out.pop(); + } +} \ No newline at end of file diff --git a/src/server/serveractiveobject.h b/src/server/serveractiveobject.h new file mode 100644 index 000000000..2e013a6b6 --- /dev/null +++ b/src/server/serveractiveobject.h @@ -0,0 +1,265 @@ +/* +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once + +#include +#include "irrlichttypes_bloated.h" +#include "activeobject.h" +#include "inventorymanager.h" +#include "itemgroup.h" +#include "util/container.h" + +/* + +Some planning +------------- + +* Server environment adds an active object, which gets the id 1 +* The active object list is scanned for each client once in a while, + and it finds out what objects have been added that are not known + by the client yet. This scan is initiated by the Server class and + the result ends up directly to the server. +* A network packet is created with the info and sent to the client. +* Environment converts objects to static data and static data to + objects, based on how close players are to them. + +*/ + +class ServerEnvironment; +struct ItemStack; +struct ToolCapabilities; +struct ObjectProperties; +struct PlayerHPChangeReason; + +class ServerActiveObject : public ActiveObject +{ +public: + /* + NOTE: m_env can be NULL, but step() isn't called if it is. + Prototypes are used that way. + */ + ServerActiveObject(ServerEnvironment *env, v3f pos); + virtual ~ServerActiveObject() = default; + + virtual ActiveObjectType getSendType() const + { return getType(); } + + // Called after id has been set and has been inserted in environment + virtual void addedToEnvironment(u32 dtime_s){}; + // Called before removing from environment + virtual void removingFromEnvironment(){}; + // Returns true if object's deletion is the job of the + // environment + virtual bool environmentDeletes() const + { return true; } + + // Create a certain type of ServerActiveObject + static ServerActiveObject* create(ActiveObjectType type, + ServerEnvironment *env, u16 id, v3f pos, + const std::string &data); + + /* + Some simple getters/setters + */ + v3f getBasePosition() const { return m_base_position; } + void setBasePosition(v3f pos){ m_base_position = pos; } + ServerEnvironment* getEnv(){ return m_env; } + + /* + Some more dynamic interface + */ + + virtual void setPos(const v3f &pos) + { setBasePosition(pos); } + // continuous: if true, object does not stop immediately at pos + virtual void moveTo(v3f pos, bool continuous) + { setBasePosition(pos); } + // If object has moved less than this and data has not changed, + // saving to disk may be omitted + virtual float getMinimumSavedMovement(); + + virtual std::string getDescription(){return "SAO";} + + /* + Step object in time. + Messages added to messages are sent to client over network. + + send_recommended: + True at around 5-10 times a second, same for all objects. + This is used to let objects send most of the data at the + same time so that the data can be combined in a single + packet. + */ + virtual void step(float dtime, bool send_recommended){} + + /* + The return value of this is passed to the client-side object + when it is created + */ + virtual std::string getClientInitializationData(u16 protocol_version) {return "";} + + /* + The return value of this is passed to the server-side object + when it is created (converted from static to active - actually + the data is the static form) + */ + virtual void getStaticData(std::string *result) const + { + assert(isStaticAllowed()); + *result = ""; + } + /* + Return false in here to never save and instead remove object + on unload. getStaticData() will not be called in that case. + */ + virtual bool isStaticAllowed() const + {return true;} + + // Returns tool wear + virtual u16 punch(v3f dir, + const ToolCapabilities *toolcap = nullptr, + ServerActiveObject *puncher = nullptr, + float time_from_last_punch = 1000000.0f) + { return 0; } + virtual void rightClick(ServerActiveObject *clicker) + {} + virtual void setHP(s32 hp, const PlayerHPChangeReason &reason) + {} + virtual u16 getHP() const + { return 0; } + + virtual void setArmorGroups(const ItemGroupList &armor_groups) + {} + virtual const ItemGroupList &getArmorGroups() const + { static ItemGroupList rv; return rv; } + virtual void setPhysicsOverride(float physics_override_speed, float physics_override_jump, float physics_override_gravity) + {} + virtual void setAnimation(v2f frames, float frame_speed, float frame_blend, bool frame_loop) + {} + virtual void getAnimation(v2f *frames, float *frame_speed, float *frame_blend, bool *frame_loop) + {} + virtual void setAnimationSpeed(float frame_speed) + {} + virtual void setBonePosition(const std::string &bone, v3f position, v3f rotation) + {} + virtual void getBonePosition(const std::string &bone, v3f *position, v3f *lotation) + {} + virtual const std::unordered_set &getAttachmentChildIds() const + { static std::unordered_set rv; return rv; } + virtual ServerActiveObject *getParent() const { return nullptr; } + virtual ObjectProperties* accessObjectProperties() + { return NULL; } + virtual void notifyObjectPropertiesModified() + {} + + // Inventory and wielded item + virtual Inventory *getInventory() const + { return NULL; } + virtual InventoryLocation getInventoryLocation() const + { return InventoryLocation(); } + virtual void setInventoryModified() + {} + virtual std::string getWieldList() const + { return ""; } + virtual u16 getWieldIndex() const + { return 0; } + virtual ItemStack getWieldedItem(ItemStack *selected, + ItemStack *hand = nullptr) const; + virtual bool setWieldedItem(const ItemStack &item); + inline void attachParticleSpawner(u32 id) + { + m_attached_particle_spawners.insert(id); + } + inline void detachParticleSpawner(u32 id) + { + m_attached_particle_spawners.erase(id); + } + + std::string generateUpdateInfantCommand(u16 infant_id, u16 protocol_version); + std::string generateUpdateNametagAttributesCommand(const video::SColor &color) const; + + void dumpAOMessagesToQueue(std::queue &queue); + + /* + Number of players which know about this object. Object won't be + deleted until this is 0 to keep the id preserved for the right + object. + */ + u16 m_known_by_count = 0; + + /* + - Whether this object is to be removed when nobody knows about + it anymore. + - Removal is delayed to preserve the id for the time during which + it could be confused to some other object by some client. + - This is usually set to true by the step() method when the object wants + to be deleted but can be set by anything else too. + */ + bool m_pending_removal = false; + + /* + Same purpose as m_pending_removal but for deactivation. + deactvation = save static data in block, remove active object + + If this is set alongside with m_pending_removal, removal takes + priority. + */ + bool m_pending_deactivation = false; + + /* + A getter that unifies the above to answer the question: + "Can the environment still interact with this object?" + */ + inline bool isGone() const + { return m_pending_removal || m_pending_deactivation; } + + /* + Whether the object's static data has been stored to a block + */ + bool m_static_exists = false; + /* + The block from which the object was loaded from, and in which + a copy of the static data resides. + */ + v3s16 m_static_block = v3s16(1337,1337,1337); + +protected: + virtual void onAttach(int parent_id) {} + virtual void onDetach(int parent_id) {} + + // Used for creating objects based on type + typedef ServerActiveObject* (*Factory) + (ServerEnvironment *env, v3f pos, + const std::string &data); + static void registerType(u16 type, Factory f); + + ServerEnvironment *m_env; + v3f m_base_position; + std::unordered_set m_attached_particle_spawners; + + /* + Queue of messages to be sent to the client + */ + std::queue m_messages_out; + +private: + // Used for creating objects based on type + static std::map m_types; +}; diff --git a/src/server/unit_sao.cpp b/src/server/unit_sao.cpp new file mode 100644 index 000000000..66be67522 --- /dev/null +++ b/src/server/unit_sao.cpp @@ -0,0 +1,318 @@ +/* +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2013-2020 Minetest core developers & community + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "unit_sao.h" +#include "scripting_server.h" +#include "serverenvironment.h" + +/* + UnitSAO + */ + +UnitSAO::UnitSAO(ServerEnvironment *env, v3f pos): + ServerActiveObject(env, pos) +{ + // Initialize something to armor groups + m_armor_groups["fleshy"] = 100; +} + +ServerActiveObject *UnitSAO::getParent() const +{ + if (!m_attachment_parent_id) + return nullptr; + // Check if the parent still exists + ServerActiveObject *obj = m_env->getActiveObject(m_attachment_parent_id); + + return obj; +} + +void UnitSAO::setArmorGroups(const ItemGroupList &armor_groups) +{ + m_armor_groups = armor_groups; + m_armor_groups_sent = false; +} + +const ItemGroupList &UnitSAO::getArmorGroups() const +{ + return m_armor_groups; +} + +void UnitSAO::setAnimation(v2f frame_range, float frame_speed, float frame_blend, bool frame_loop) +{ + // store these so they can be updated to clients + m_animation_range = frame_range; + m_animation_speed = frame_speed; + m_animation_blend = frame_blend; + m_animation_loop = frame_loop; + m_animation_sent = false; +} + +void UnitSAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend, bool *frame_loop) +{ + *frame_range = m_animation_range; + *frame_speed = m_animation_speed; + *frame_blend = m_animation_blend; + *frame_loop = m_animation_loop; +} + +void UnitSAO::setAnimationSpeed(float frame_speed) +{ + m_animation_speed = frame_speed; + m_animation_speed_sent = false; +} + +void UnitSAO::setBonePosition(const std::string &bone, v3f position, v3f rotation) +{ + // store these so they can be updated to clients + m_bone_position[bone] = core::vector2d(position, rotation); + m_bone_position_sent = false; +} + +void UnitSAO::getBonePosition(const std::string &bone, v3f *position, v3f *rotation) +{ + *position = m_bone_position[bone].X; + *rotation = m_bone_position[bone].Y; +} + +void UnitSAO::setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation) +{ + // Attachments need to be handled on both the server and client. + // If we just attach on the server, we can only copy the position of the parent. Attachments + // are still sent to clients at an interval so players might see them lagging, plus we can't + // read and attach to skeletal bones. + // If we just attach on the client, the server still sees the child at its original location. + // This breaks some things so we also give the server the most accurate representation + // even if players only see the client changes. + + int old_parent = m_attachment_parent_id; + m_attachment_parent_id = parent_id; + m_attachment_bone = bone; + m_attachment_position = position; + m_attachment_rotation = rotation; + m_attachment_sent = false; + + if (parent_id != old_parent) { + onDetach(old_parent); + onAttach(parent_id); + } +} + +void UnitSAO::getAttachment(int *parent_id, std::string *bone, v3f *position, + v3f *rotation) const +{ + *parent_id = m_attachment_parent_id; + *bone = m_attachment_bone; + *position = m_attachment_position; + *rotation = m_attachment_rotation; +} + +void UnitSAO::clearChildAttachments() +{ + for (int child_id : m_attachment_child_ids) { + // Child can be NULL if it was deleted earlier + if (ServerActiveObject *child = m_env->getActiveObject(child_id)) + child->setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0)); + } + m_attachment_child_ids.clear(); +} + +void UnitSAO::clearParentAttachment() +{ + ServerActiveObject *parent = nullptr; + if (m_attachment_parent_id) { + parent = m_env->getActiveObject(m_attachment_parent_id); + setAttachment(0, "", m_attachment_position, m_attachment_rotation); + } else { + setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0)); + } + // Do it + if (parent) + parent->removeAttachmentChild(m_id); +} + +void UnitSAO::addAttachmentChild(int child_id) +{ + m_attachment_child_ids.insert(child_id); +} + +void UnitSAO::removeAttachmentChild(int child_id) +{ + m_attachment_child_ids.erase(child_id); +} + +const std::unordered_set &UnitSAO::getAttachmentChildIds() const +{ + return m_attachment_child_ids; +} + +void UnitSAO::onAttach(int parent_id) +{ + if (!parent_id) + return; + + ServerActiveObject *parent = m_env->getActiveObject(parent_id); + + if (!parent || parent->isGone()) + return; // Do not try to notify soon gone parent + + if (parent->getType() == ACTIVEOBJECT_TYPE_LUAENTITY) { + // Call parent's on_attach field + m_env->getScriptIface()->luaentity_on_attach_child(parent_id, this); + } +} + +void UnitSAO::onDetach(int parent_id) +{ + if (!parent_id) + return; + + ServerActiveObject *parent = m_env->getActiveObject(parent_id); + if (getType() == ACTIVEOBJECT_TYPE_LUAENTITY) + m_env->getScriptIface()->luaentity_on_detach(m_id, parent); + + if (!parent || parent->isGone()) + return; // Do not try to notify soon gone parent + + if (parent->getType() == ACTIVEOBJECT_TYPE_LUAENTITY) + m_env->getScriptIface()->luaentity_on_detach_child(parent_id, this); +} + +ObjectProperties* UnitSAO::accessObjectProperties() +{ + return &m_prop; +} + +void UnitSAO::notifyObjectPropertiesModified() +{ + m_properties_sent = false; +} + +std::string UnitSAO::generateUpdateAttachmentCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_ATTACH_TO); + // parameters + writeS16(os, m_attachment_parent_id); + os << serializeString(m_attachment_bone); + writeV3F32(os, m_attachment_position); + writeV3F32(os, m_attachment_rotation); + return os.str(); +} + +std::string UnitSAO::generateUpdateBonePositionCommand(const std::string &bone, + const v3f &position, const v3f &rotation) +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_BONE_POSITION); + // parameters + os << serializeString(bone); + writeV3F32(os, position); + writeV3F32(os, rotation); + return os.str(); +} + + +std::string UnitSAO::generateUpdateAnimationSpeedCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_ANIMATION_SPEED); + // parameters + writeF32(os, m_animation_speed); + return os.str(); +} + +std::string UnitSAO::generateUpdateAnimationCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_ANIMATION); + // parameters + writeV2F32(os, m_animation_range); + writeF32(os, m_animation_speed); + writeF32(os, m_animation_blend); + // these are sent inverted so we get true when the server sends nothing + writeU8(os, !m_animation_loop); + return os.str(); +} + + +std::string UnitSAO::generateUpdateArmorGroupsCommand() const +{ + std::ostringstream os(std::ios::binary); + writeU8(os, AO_CMD_UPDATE_ARMOR_GROUPS); + writeU16(os, m_armor_groups.size()); + for (const auto &armor_group : m_armor_groups) { + os< +Copyright (C) 2013-2020 Minetest core developers & community + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once + +#include "object_properties.h" +#include "serveractiveobject.h" + +class UnitSAO: public ServerActiveObject +{ +public: + UnitSAO(ServerEnvironment *env, v3f pos); + virtual ~UnitSAO() = default; + + void setRotation(v3f rotation) { m_rotation = rotation; } + const v3f &getRotation() const { return m_rotation; } + v3f getRadRotation() { return m_rotation * core::DEGTORAD; } + + // Deprecated + f32 getRadYawDep() const { return (m_rotation.Y + 90.) * core::DEGTORAD; } + + u16 getHP() const { return m_hp; } + // Use a function, if isDead can be defined by other conditions + bool isDead() const { return m_hp == 0; } + + inline bool isAttached() const + { return getParent(); } + + inline bool isImmortal() const + { return itemgroup_get(getArmorGroups(), "immortal"); } + + void setArmorGroups(const ItemGroupList &armor_groups); + const ItemGroupList &getArmorGroups() const; + void setAnimation(v2f frame_range, float frame_speed, float frame_blend, bool frame_loop); + void getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend, bool *frame_loop); + void setAnimationSpeed(float frame_speed); + void setBonePosition(const std::string &bone, v3f position, v3f rotation); + void getBonePosition(const std::string &bone, v3f *position, v3f *rotation); + void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation); + void getAttachment(int *parent_id, std::string *bone, v3f *position, + v3f *rotation) const; + void clearChildAttachments(); + void clearParentAttachment(); + void addAttachmentChild(int child_id); + void removeAttachmentChild(int child_id); + const std::unordered_set &getAttachmentChildIds() const; + ServerActiveObject *getParent() const; + ObjectProperties* accessObjectProperties(); + void notifyObjectPropertiesModified(); + + std::string generateUpdateAttachmentCommand() const; + std::string generateUpdateAnimationSpeedCommand() const; + std::string generateUpdateAnimationCommand() const; + std::string generateUpdateArmorGroupsCommand() const; + static std::string generateUpdatePositionCommand(const v3f &position, const v3f &velocity, + const v3f &acceleration, const v3f &rotation, bool do_interpolate, + bool is_movement_end, f32 update_interval); + std::string generateSetPropertiesCommand(const ObjectProperties &prop) const; + void sendPunchCommand(); + static std::string generateUpdateBonePositionCommand(const std::string &bone, + const v3f &position, const v3f &rotation); + +protected: + u16 m_hp = 1; + + v3f m_rotation; + + bool m_properties_sent = true; + ObjectProperties m_prop; + + ItemGroupList m_armor_groups; + bool m_armor_groups_sent = false; + + v2f m_animation_range; + float m_animation_speed = 0.0f; + float m_animation_blend = 0.0f; + bool m_animation_loop = true; + bool m_animation_sent = false; + bool m_animation_speed_sent = false; + + // Stores position and rotation for each bone name + std::unordered_map> m_bone_position; + bool m_bone_position_sent = false; + + int m_attachment_parent_id = 0; + std::unordered_set m_attachment_child_ids; + std::string m_attachment_bone = ""; + v3f m_attachment_position; + v3f m_attachment_rotation; + bool m_attachment_sent = false; +private: + void onAttach(int parent_id); + void onDetach(int parent_id); + + std::string generatePunchCommand(u16 result_hp) const; +}; diff --git a/src/serverobject.cpp b/src/serverobject.cpp deleted file mode 100644 index 119a41b7b..000000000 --- a/src/serverobject.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* -Minetest -Copyright (C) 2010-2013 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "serverobject.h" -#include -#include "inventory.h" -#include "constants.h" // BS -#include "log.h" - -ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos): - ActiveObject(0), - m_env(env), - m_base_position(pos) -{ -} - -ServerActiveObject* ServerActiveObject::create(ActiveObjectType type, - ServerEnvironment *env, u16 id, v3f pos, - const std::string &data) -{ - // Find factory function - std::map::iterator n; - n = m_types.find(type); - if(n == m_types.end()) { - // These are 0.3 entity types, return without error. - if (ACTIVEOBJECT_TYPE_ITEM <= type && type <= ACTIVEOBJECT_TYPE_MOBV2) { - return NULL; - } - - // If factory is not found, just return. - warningstream<<"ServerActiveObject: No factory for type=" - <second; - ServerActiveObject *object = (*f)(env, pos, data); - return object; -} - -void ServerActiveObject::registerType(u16 type, Factory f) -{ - std::map::iterator n; - n = m_types.find(type); - if(n != m_types.end()) - return; - m_types[type] = f; -} - -float ServerActiveObject::getMinimumSavedMovement() -{ - return 2.0*BS; -} - -ItemStack ServerActiveObject::getWieldedItem(ItemStack *selected, ItemStack *hand) const -{ - *selected = ItemStack(); - if (hand) - *hand = ItemStack(); - - return ItemStack(); -} - -bool ServerActiveObject::setWieldedItem(const ItemStack &item) -{ - return false; -} - -std::string ServerActiveObject::generateUpdateInfantCommand(u16 infant_id, u16 protocol_version) -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, AO_CMD_SPAWN_INFANT); - // parameters - writeU16(os, infant_id); - writeU8(os, getSendType()); - os << serializeLongString(getClientInitializationData(protocol_version)); - return os.str(); -} - -std::string ServerActiveObject::generateUpdateNametagAttributesCommand(const video::SColor &color) const -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, AO_CMD_UPDATE_NAMETAG_ATTRIBUTES); - // parameters - writeU8(os, 1); // version for forward compatibility - writeARGB8(os, color); - return os.str(); -} - -void ServerActiveObject::dumpAOMessagesToQueue(std::queue &queue) -{ - while (!m_messages_out.empty()) { - queue.push(m_messages_out.front()); - m_messages_out.pop(); - } -} \ No newline at end of file diff --git a/src/serverobject.h b/src/serverobject.h deleted file mode 100644 index 2e013a6b6..000000000 --- a/src/serverobject.h +++ /dev/null @@ -1,265 +0,0 @@ -/* -Minetest -Copyright (C) 2010-2013 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#pragma once - -#include -#include "irrlichttypes_bloated.h" -#include "activeobject.h" -#include "inventorymanager.h" -#include "itemgroup.h" -#include "util/container.h" - -/* - -Some planning -------------- - -* Server environment adds an active object, which gets the id 1 -* The active object list is scanned for each client once in a while, - and it finds out what objects have been added that are not known - by the client yet. This scan is initiated by the Server class and - the result ends up directly to the server. -* A network packet is created with the info and sent to the client. -* Environment converts objects to static data and static data to - objects, based on how close players are to them. - -*/ - -class ServerEnvironment; -struct ItemStack; -struct ToolCapabilities; -struct ObjectProperties; -struct PlayerHPChangeReason; - -class ServerActiveObject : public ActiveObject -{ -public: - /* - NOTE: m_env can be NULL, but step() isn't called if it is. - Prototypes are used that way. - */ - ServerActiveObject(ServerEnvironment *env, v3f pos); - virtual ~ServerActiveObject() = default; - - virtual ActiveObjectType getSendType() const - { return getType(); } - - // Called after id has been set and has been inserted in environment - virtual void addedToEnvironment(u32 dtime_s){}; - // Called before removing from environment - virtual void removingFromEnvironment(){}; - // Returns true if object's deletion is the job of the - // environment - virtual bool environmentDeletes() const - { return true; } - - // Create a certain type of ServerActiveObject - static ServerActiveObject* create(ActiveObjectType type, - ServerEnvironment *env, u16 id, v3f pos, - const std::string &data); - - /* - Some simple getters/setters - */ - v3f getBasePosition() const { return m_base_position; } - void setBasePosition(v3f pos){ m_base_position = pos; } - ServerEnvironment* getEnv(){ return m_env; } - - /* - Some more dynamic interface - */ - - virtual void setPos(const v3f &pos) - { setBasePosition(pos); } - // continuous: if true, object does not stop immediately at pos - virtual void moveTo(v3f pos, bool continuous) - { setBasePosition(pos); } - // If object has moved less than this and data has not changed, - // saving to disk may be omitted - virtual float getMinimumSavedMovement(); - - virtual std::string getDescription(){return "SAO";} - - /* - Step object in time. - Messages added to messages are sent to client over network. - - send_recommended: - True at around 5-10 times a second, same for all objects. - This is used to let objects send most of the data at the - same time so that the data can be combined in a single - packet. - */ - virtual void step(float dtime, bool send_recommended){} - - /* - The return value of this is passed to the client-side object - when it is created - */ - virtual std::string getClientInitializationData(u16 protocol_version) {return "";} - - /* - The return value of this is passed to the server-side object - when it is created (converted from static to active - actually - the data is the static form) - */ - virtual void getStaticData(std::string *result) const - { - assert(isStaticAllowed()); - *result = ""; - } - /* - Return false in here to never save and instead remove object - on unload. getStaticData() will not be called in that case. - */ - virtual bool isStaticAllowed() const - {return true;} - - // Returns tool wear - virtual u16 punch(v3f dir, - const ToolCapabilities *toolcap = nullptr, - ServerActiveObject *puncher = nullptr, - float time_from_last_punch = 1000000.0f) - { return 0; } - virtual void rightClick(ServerActiveObject *clicker) - {} - virtual void setHP(s32 hp, const PlayerHPChangeReason &reason) - {} - virtual u16 getHP() const - { return 0; } - - virtual void setArmorGroups(const ItemGroupList &armor_groups) - {} - virtual const ItemGroupList &getArmorGroups() const - { static ItemGroupList rv; return rv; } - virtual void setPhysicsOverride(float physics_override_speed, float physics_override_jump, float physics_override_gravity) - {} - virtual void setAnimation(v2f frames, float frame_speed, float frame_blend, bool frame_loop) - {} - virtual void getAnimation(v2f *frames, float *frame_speed, float *frame_blend, bool *frame_loop) - {} - virtual void setAnimationSpeed(float frame_speed) - {} - virtual void setBonePosition(const std::string &bone, v3f position, v3f rotation) - {} - virtual void getBonePosition(const std::string &bone, v3f *position, v3f *lotation) - {} - virtual const std::unordered_set &getAttachmentChildIds() const - { static std::unordered_set rv; return rv; } - virtual ServerActiveObject *getParent() const { return nullptr; } - virtual ObjectProperties* accessObjectProperties() - { return NULL; } - virtual void notifyObjectPropertiesModified() - {} - - // Inventory and wielded item - virtual Inventory *getInventory() const - { return NULL; } - virtual InventoryLocation getInventoryLocation() const - { return InventoryLocation(); } - virtual void setInventoryModified() - {} - virtual std::string getWieldList() const - { return ""; } - virtual u16 getWieldIndex() const - { return 0; } - virtual ItemStack getWieldedItem(ItemStack *selected, - ItemStack *hand = nullptr) const; - virtual bool setWieldedItem(const ItemStack &item); - inline void attachParticleSpawner(u32 id) - { - m_attached_particle_spawners.insert(id); - } - inline void detachParticleSpawner(u32 id) - { - m_attached_particle_spawners.erase(id); - } - - std::string generateUpdateInfantCommand(u16 infant_id, u16 protocol_version); - std::string generateUpdateNametagAttributesCommand(const video::SColor &color) const; - - void dumpAOMessagesToQueue(std::queue &queue); - - /* - Number of players which know about this object. Object won't be - deleted until this is 0 to keep the id preserved for the right - object. - */ - u16 m_known_by_count = 0; - - /* - - Whether this object is to be removed when nobody knows about - it anymore. - - Removal is delayed to preserve the id for the time during which - it could be confused to some other object by some client. - - This is usually set to true by the step() method when the object wants - to be deleted but can be set by anything else too. - */ - bool m_pending_removal = false; - - /* - Same purpose as m_pending_removal but for deactivation. - deactvation = save static data in block, remove active object - - If this is set alongside with m_pending_removal, removal takes - priority. - */ - bool m_pending_deactivation = false; - - /* - A getter that unifies the above to answer the question: - "Can the environment still interact with this object?" - */ - inline bool isGone() const - { return m_pending_removal || m_pending_deactivation; } - - /* - Whether the object's static data has been stored to a block - */ - bool m_static_exists = false; - /* - The block from which the object was loaded from, and in which - a copy of the static data resides. - */ - v3s16 m_static_block = v3s16(1337,1337,1337); - -protected: - virtual void onAttach(int parent_id) {} - virtual void onDetach(int parent_id) {} - - // Used for creating objects based on type - typedef ServerActiveObject* (*Factory) - (ServerEnvironment *env, v3f pos, - const std::string &data); - static void registerType(u16 type, Factory f); - - ServerEnvironment *m_env; - v3f m_base_position; - std::unordered_set m_attached_particle_spawners; - - /* - Queue of messages to be sent to the client - */ - std::queue m_messages_out; - -private: - // Used for creating objects based on type - static std::map m_types; -}; diff --git a/util/travis/clang-format-whitelist.txt b/util/travis/clang-format-whitelist.txt index 7b2fd8236..816ec2c59 100644 --- a/util/travis/clang-format-whitelist.txt +++ b/util/travis/clang-format-whitelist.txt @@ -402,16 +402,14 @@ src/script/scripting_server.cpp src/script/scripting_server.h src/serialization.cpp src/serialization.h -src/serveractiveobjectmap.cpp -src/serveractiveobjectmap.h src/server.cpp src/serverenvironment.cpp src/serverenvironment.h src/server.h src/serverlist.cpp src/serverlist.h -src/serverobject.cpp -src/serverobject.h +src/server/serveractiveobject.cpp +src/server/serveractiveobject.h src/settings.cpp src/settings.h src/settings_translation_file.cpp -- cgit v1.2.3 From 5146086a64d5eeb480948d612a008a2ec81455d4 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Sat, 11 Apr 2020 11:22:15 +0200 Subject: Drop content_sao.{cpp,h} Move LuaEntitySAO to a new dedicated file Drop TestSAO (useless object) Drop the old static startup initialized SAO factory, which was pretty useless. This factory was using a std::map for 2 elements, now just use a simple condition owned by ServerEnvironment, which will be lightweight, that will also drop a one time useful test on each LuaEntitySAO creation. This should reduce server load on massive SAO creation --- build/android/jni/Android.mk | 4 +- src/CMakeLists.txt | 1 - src/clientiface.cpp | 2 +- src/content_sao.cpp | 681 --------------------------------- src/content_sao.h | 101 ----- src/mapgen/mapgen.cpp | 1 - src/mapgen/mapgen_carpathian.cpp | 1 - src/mapgen/mapgen_flat.cpp | 1 - src/mapgen/mapgen_fractal.cpp | 1 - src/mapgen/mapgen_v5.cpp | 1 - src/mapgen/mapgen_v6.cpp | 1 - src/mapgen/mapgen_v7.cpp | 1 - src/script/cpp_api/s_base.cpp | 1 - src/script/lua_api/l_env.cpp | 2 +- src/script/lua_api/l_item.cpp | 1 - src/script/lua_api/l_object.cpp | 2 +- src/server/CMakeLists.txt | 1 + src/server/luaentity_sao.cpp | 581 ++++++++++++++++++++++++++++ src/server/luaentity_sao.h | 93 +++++ src/server/player_sao.h | 83 ++-- src/server/serveractiveobject.cpp | 33 -- src/server/serveractiveobject.h | 10 - src/serverenvironment.cpp | 19 +- src/serverenvironment.h | 2 + src/staticobject.cpp | 2 +- src/unittest/test_player.cpp | 1 - util/travis/clang-format-whitelist.txt | 4 +- 27 files changed, 731 insertions(+), 900 deletions(-) delete mode 100644 src/content_sao.cpp delete mode 100644 src/content_sao.h create mode 100644 src/server/luaentity_sao.cpp create mode 100644 src/server/luaentity_sao.h (limited to 'util') diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index 32a16c174..fdbfba9bc 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -161,7 +161,6 @@ LOCAL_SRC_FILES := \ jni/src/content/mods.cpp \ jni/src/content_nodemeta.cpp \ jni/src/content/packages.cpp \ - jni/src/content_sao.cpp \ jni/src/content/subgames.cpp \ jni/src/convert_json.cpp \ jni/src/craftdef.cpp \ @@ -258,8 +257,11 @@ LOCAL_SRC_FILES := \ jni/src/server.cpp \ jni/src/serverenvironment.cpp \ jni/src/serverlist.cpp \ + jni/src/server/luaentity_sao.cpp \ jni/src/server/mods.cpp \ + jni/src/server/player_sao.cpp \ jni/src/server/serveractiveobject.cpp \ + jni/src/server/unit_sao.cpp \ jni/src/settings.cpp \ jni/src/staticobject.cpp \ jni/src/tileanimation.cpp \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index faa117d41..0ebbd628c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -375,7 +375,6 @@ set(common_SRCS collision.cpp content_mapnode.cpp content_nodemeta.cpp - content_sao.cpp convert_json.cpp craftdef.cpp debug.cpp diff --git a/src/clientiface.cpp b/src/clientiface.cpp index 17237f73e..4f954342a 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "clientiface.h" -#include "content_sao.h" #include "network/connection.h" #include "network/serveropcodes.h" #include "remoteplayer.h" @@ -28,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "serverenvironment.h" #include "map.h" #include "emerge.h" +#include "server/luaentity_sao.h" #include "server/player_sao.h" #include "log.h" #include "util/srp.h" diff --git a/src/content_sao.cpp b/src/content_sao.cpp deleted file mode 100644 index 7ec17aa82..000000000 --- a/src/content_sao.cpp +++ /dev/null @@ -1,681 +0,0 @@ -/* -Minetest -Copyright (C) 2010-2013 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include "content_sao.h" -#include "util/serialize.h" -#include "collision.h" -#include "environment.h" -#include "tool.h" // For ToolCapabilities -#include "gamedef.h" -#include "nodedef.h" -#include "remoteplayer.h" -#include "server.h" -#include "scripting_server.h" -#include "server/player_sao.h" -#include "settings.h" -#include -#include - -std::map ServerActiveObject::m_types; - -/* - TestSAO -*/ - -class TestSAO : public ServerActiveObject -{ -public: - TestSAO(ServerEnvironment *env, v3f pos): - ServerActiveObject(env, pos), - m_timer1(0), - m_age(0) - { - ServerActiveObject::registerType(getType(), create); - } - ActiveObjectType getType() const - { return ACTIVEOBJECT_TYPE_TEST; } - - static ServerActiveObject* create(ServerEnvironment *env, v3f pos, - const std::string &data) - { - return new TestSAO(env, pos); - } - - void step(float dtime, bool send_recommended) - { - m_age += dtime; - if(m_age > 10) - { - m_pending_removal = true; - return; - } - - m_base_position.Y += dtime * BS * 2; - if(m_base_position.Y > 8*BS) - m_base_position.Y = 2*BS; - - if (!send_recommended) - return; - - m_timer1 -= dtime; - if(m_timer1 < 0.0) - { - m_timer1 += 0.125; - - std::string data; - - data += itos(0); // 0 = position - data += " "; - data += itos(m_base_position.X); - data += " "; - data += itos(m_base_position.Y); - data += " "; - data += itos(m_base_position.Z); - - ActiveObjectMessage aom(getId(), false, data); - m_messages_out.push(aom); - } - } - - bool getCollisionBox(aabb3f *toset) const { return false; } - - virtual bool getSelectionBox(aabb3f *toset) const { return false; } - - bool collideWithObjects() const { return false; } - -private: - float m_timer1; - float m_age; -}; - -// Prototype (registers item for deserialization) -TestSAO proto_TestSAO(NULL, v3f(0,0,0)); - -/* - LuaEntitySAO -*/ - -// Prototype (registers item for deserialization) -LuaEntitySAO proto_LuaEntitySAO(NULL, v3f(0,0,0), "_prototype", ""); - -LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos, - const std::string &name, const std::string &state): - UnitSAO(env, pos), - m_init_name(name), - m_init_state(state) -{ - // Only register type if no environment supplied - if(env == NULL){ - ServerActiveObject::registerType(getType(), create); - return; - } -} - -LuaEntitySAO::~LuaEntitySAO() -{ - if(m_registered){ - m_env->getScriptIface()->luaentity_Remove(m_id); - } - - for (u32 attached_particle_spawner : m_attached_particle_spawners) { - m_env->deleteParticleSpawner(attached_particle_spawner, false); - } -} - -void LuaEntitySAO::addedToEnvironment(u32 dtime_s) -{ - ServerActiveObject::addedToEnvironment(dtime_s); - - // Create entity from name - m_registered = m_env->getScriptIface()-> - luaentity_Add(m_id, m_init_name.c_str()); - - if(m_registered){ - // Get properties - m_env->getScriptIface()-> - luaentity_GetProperties(m_id, this, &m_prop); - // Initialize HP from properties - m_hp = m_prop.hp_max; - // Activate entity, supplying serialized state - m_env->getScriptIface()-> - luaentity_Activate(m_id, m_init_state, dtime_s); - } else { - m_prop.infotext = m_init_name; - } -} - -ServerActiveObject* LuaEntitySAO::create(ServerEnvironment *env, v3f pos, - const std::string &data) -{ - std::string name; - std::string state; - u16 hp = 1; - v3f velocity; - v3f rotation; - - while (!data.empty()) { // breakable, run for one iteration - std::istringstream is(data, std::ios::binary); - // 'version' does not allow to incrementally extend the parameter list thus - // we need another variable to build on top of 'version=1'. Ugly hack but works™ - u8 version2 = 0; - u8 version = readU8(is); - - name = deSerializeString(is); - state = deSerializeLongString(is); - - if (version < 1) - break; - - hp = readU16(is); - velocity = readV3F1000(is); - // yaw must be yaw to be backwards-compatible - rotation.Y = readF1000(is); - - if (is.good()) // EOF for old formats - version2 = readU8(is); - - if (version2 < 1) // PROTOCOL_VERSION < 37 - break; - - // version2 >= 1 - rotation.X = readF1000(is); - rotation.Z = readF1000(is); - - // if (version2 < 2) - // break; - // - break; - } - // create object - infostream << "LuaEntitySAO::create(name=\"" << name << "\" state=\"" - << state << "\")" << std::endl; - LuaEntitySAO *sao = new LuaEntitySAO(env, pos, name, state); - sao->m_hp = hp; - sao->m_velocity = velocity; - sao->m_rotation = rotation; - return sao; -} - -void LuaEntitySAO::step(float dtime, bool send_recommended) -{ - if(!m_properties_sent) - { - m_properties_sent = true; - std::string str = getPropertyPacket(); - // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); - } - - // If attached, check that our parent is still there. If it isn't, detach. - if(m_attachment_parent_id && !isAttached()) - { - m_attachment_parent_id = 0; - m_attachment_bone = ""; - m_attachment_position = v3f(0,0,0); - m_attachment_rotation = v3f(0,0,0); - sendPosition(false, true); - } - - m_last_sent_position_timer += dtime; - - // Each frame, parent position is copied if the object is attached, otherwise it's calculated normally - // If the object gets detached this comes into effect automatically from the last known origin - if(isAttached()) - { - v3f pos = m_env->getActiveObject(m_attachment_parent_id)->getBasePosition(); - m_base_position = pos; - m_velocity = v3f(0,0,0); - m_acceleration = v3f(0,0,0); - } - else - { - if(m_prop.physical){ - aabb3f box = m_prop.collisionbox; - box.MinEdge *= BS; - box.MaxEdge *= BS; - collisionMoveResult moveresult; - f32 pos_max_d = BS*0.25; // Distance per iteration - v3f p_pos = m_base_position; - v3f p_velocity = m_velocity; - v3f p_acceleration = m_acceleration; - moveresult = collisionMoveSimple(m_env, m_env->getGameDef(), - pos_max_d, box, m_prop.stepheight, dtime, - &p_pos, &p_velocity, p_acceleration, - this, m_prop.collideWithObjects); - - // Apply results - m_base_position = p_pos; - m_velocity = p_velocity; - m_acceleration = p_acceleration; - } else { - m_base_position += dtime * m_velocity + 0.5 * dtime - * dtime * m_acceleration; - m_velocity += dtime * m_acceleration; - } - - if (m_prop.automatic_face_movement_dir && - (fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) { - float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI - + m_prop.automatic_face_movement_dir_offset; - float max_rotation_per_sec = - m_prop.automatic_face_movement_max_rotation_per_sec; - - if (max_rotation_per_sec > 0) { - m_rotation.Y = wrapDegrees_0_360(m_rotation.Y); - wrappedApproachShortest(m_rotation.Y, target_yaw, - dtime * max_rotation_per_sec, 360.f); - } else { - // Negative values of max_rotation_per_sec mean disabled. - m_rotation.Y = target_yaw; - } - } - } - - if(m_registered){ - m_env->getScriptIface()->luaentity_Step(m_id, dtime); - } - - if (!send_recommended) - return; - - if(!isAttached()) - { - // TODO: force send when acceleration changes enough? - float minchange = 0.2*BS; - if(m_last_sent_position_timer > 1.0){ - minchange = 0.01*BS; - } else if(m_last_sent_position_timer > 0.2){ - minchange = 0.05*BS; - } - float move_d = m_base_position.getDistanceFrom(m_last_sent_position); - move_d += m_last_sent_move_precision; - float vel_d = m_velocity.getDistanceFrom(m_last_sent_velocity); - if (move_d > minchange || vel_d > minchange || - std::fabs(m_rotation.X - m_last_sent_rotation.X) > 1.0f || - std::fabs(m_rotation.Y - m_last_sent_rotation.Y) > 1.0f || - std::fabs(m_rotation.Z - m_last_sent_rotation.Z) > 1.0f) { - - sendPosition(true, false); - } - } - - if (!m_armor_groups_sent) { - m_armor_groups_sent = true; - // create message and add to list - m_messages_out.emplace(getId(), true, generateUpdateArmorGroupsCommand()); - } - - if (!m_animation_sent) { - m_animation_sent = true; - std::string str = generateUpdateAnimationCommand(); - // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); - } - - if (!m_animation_speed_sent) { - m_animation_speed_sent = true; - std::string str = generateUpdateAnimationSpeedCommand(); - // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); - } - - if (!m_bone_position_sent) { - m_bone_position_sent = true; - for (std::unordered_map>::const_iterator - ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii){ - std::string str = generateUpdateBonePositionCommand((*ii).first, - (*ii).second.X, (*ii).second.Y); - // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); - } - } - - if (!m_attachment_sent) { - m_attachment_sent = true; - std::string str = generateUpdateAttachmentCommand(); - // create message and add to list - ActiveObjectMessage aom(getId(), true, str); - m_messages_out.push(aom); - } -} - -std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version) -{ - std::ostringstream os(std::ios::binary); - - // PROTOCOL_VERSION >= 37 - writeU8(os, 1); // version - os << serializeString(""); // name - writeU8(os, 0); // is_player - writeU16(os, getId()); //id - writeV3F32(os, m_base_position); - writeV3F32(os, m_rotation); - writeU16(os, m_hp); - - std::ostringstream msg_os(std::ios::binary); - msg_os << serializeLongString(getPropertyPacket()); // message 1 - msg_os << serializeLongString(generateUpdateArmorGroupsCommand()); // 2 - msg_os << serializeLongString(generateUpdateAnimationCommand()); // 3 - for (std::unordered_map>::const_iterator - ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { - msg_os << serializeLongString(generateUpdateBonePositionCommand((*ii).first, - (*ii).second.X, (*ii).second.Y)); // m_bone_position.size - } - msg_os << serializeLongString(generateUpdateAttachmentCommand()); // 4 - int message_count = 4 + m_bone_position.size(); - for (std::unordered_set::const_iterator ii = m_attachment_child_ids.begin(); - (ii != m_attachment_child_ids.end()); ++ii) { - if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) { - message_count++; - // TODO after a protocol bump: only send the object initialization data - // to older clients (superfluous since this message exists) - msg_os << serializeLongString(obj->generateUpdateInfantCommand(*ii, protocol_version)); - } - } - - msg_os << serializeLongString(generateSetTextureModCommand()); - message_count++; - - writeU8(os, message_count); - os.write(msg_os.str().c_str(), msg_os.str().size()); - - // return result - return os.str(); -} - -void LuaEntitySAO::getStaticData(std::string *result) const -{ - verbosestream<getScriptIface()-> - luaentity_GetStaticdata(m_id); - os<= 37 - - writeF1000(os, m_rotation.X); - writeF1000(os, m_rotation.Z); - - // - - *result = os.str(); -} - -u16 LuaEntitySAO::punch(v3f dir, - const ToolCapabilities *toolcap, - ServerActiveObject *puncher, - float time_from_last_punch) -{ - if (!m_registered) { - // Delete unknown LuaEntities when punched - m_pending_removal = true; - return 0; - } - - FATAL_ERROR_IF(!puncher, "Punch action called without SAO"); - - s32 old_hp = getHP(); - ItemStack selected_item, hand_item; - ItemStack tool_item = puncher->getWieldedItem(&selected_item, &hand_item); - - PunchDamageResult result = getPunchDamage( - m_armor_groups, - toolcap, - &tool_item, - time_from_last_punch); - - bool damage_handled = m_env->getScriptIface()->luaentity_Punch(m_id, puncher, - time_from_last_punch, toolcap, dir, result.did_punch ? result.damage : 0); - - if (!damage_handled) { - if (result.did_punch) { - setHP((s32)getHP() - result.damage, - PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, puncher)); - - // create message and add to list - sendPunchCommand(); - } - } - - if (getHP() == 0 && !isGone()) { - clearParentAttachment(); - clearChildAttachments(); - m_env->getScriptIface()->luaentity_on_death(m_id, puncher); - m_pending_removal = true; - } - - actionstream << puncher->getDescription() << " (id=" << puncher->getId() << - ", hp=" << puncher->getHP() << ") punched " << - getDescription() << " (id=" << m_id << ", hp=" << m_hp << - "), damage=" << (old_hp - (s32)getHP()) << - (damage_handled ? " (handled by Lua)" : "") << std::endl; - - // TODO: give Lua control over wear - return result.wear; -} - -void LuaEntitySAO::rightClick(ServerActiveObject *clicker) -{ - if (!m_registered) - return; - - m_env->getScriptIface()->luaentity_Rightclick(m_id, clicker); -} - -void LuaEntitySAO::setPos(const v3f &pos) -{ - if(isAttached()) - return; - m_base_position = pos; - sendPosition(false, true); -} - -void LuaEntitySAO::moveTo(v3f pos, bool continuous) -{ - if(isAttached()) - return; - m_base_position = pos; - if(!continuous) - sendPosition(true, true); -} - -float LuaEntitySAO::getMinimumSavedMovement() -{ - return 0.1 * BS; -} - -std::string LuaEntitySAO::getDescription() -{ - std::ostringstream oss; - oss << "LuaEntitySAO \"" << m_init_name << "\" "; - auto pos = floatToInt(m_base_position, BS); - oss << "at " << PP(pos); - return oss.str(); -} - -void LuaEntitySAO::setHP(s32 hp, const PlayerHPChangeReason &reason) -{ - m_hp = rangelim(hp, 0, U16_MAX); -} - -u16 LuaEntitySAO::getHP() const -{ - return m_hp; -} - -void LuaEntitySAO::setVelocity(v3f velocity) -{ - m_velocity = velocity; -} - -v3f LuaEntitySAO::getVelocity() -{ - return m_velocity; -} - -void LuaEntitySAO::setAcceleration(v3f acceleration) -{ - m_acceleration = acceleration; -} - -v3f LuaEntitySAO::getAcceleration() -{ - return m_acceleration; -} - -void LuaEntitySAO::setTextureMod(const std::string &mod) -{ - m_current_texture_modifier = mod; - // create message and add to list - m_messages_out.emplace(getId(), true, generateSetTextureModCommand()); -} - -std::string LuaEntitySAO::getTextureMod() const -{ - return m_current_texture_modifier; -} - - -std::string LuaEntitySAO::generateSetTextureModCommand() const -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, AO_CMD_SET_TEXTURE_MOD); - // parameters - os << serializeString(m_current_texture_modifier); - return os.str(); -} - -std::string LuaEntitySAO::generateSetSpriteCommand(v2s16 p, u16 num_frames, - f32 framelength, bool select_horiz_by_yawpitch) -{ - std::ostringstream os(std::ios::binary); - // command - writeU8(os, AO_CMD_SET_SPRITE); - // parameters - writeV2S16(os, p); - writeU16(os, num_frames); - writeF32(os, framelength); - writeU8(os, select_horiz_by_yawpitch); - return os.str(); -} - -void LuaEntitySAO::setSprite(v2s16 p, int num_frames, float framelength, - bool select_horiz_by_yawpitch) -{ - std::string str = generateSetSpriteCommand( - p, - num_frames, - framelength, - select_horiz_by_yawpitch - ); - // create message and add to list - m_messages_out.emplace(getId(), true, str); -} - -std::string LuaEntitySAO::getName() -{ - return m_init_name; -} - -std::string LuaEntitySAO::getPropertyPacket() -{ - return generateSetPropertiesCommand(m_prop); -} - -void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end) -{ - // If the object is attached client-side, don't waste bandwidth sending its position to clients - if(isAttached()) - return; - - m_last_sent_move_precision = m_base_position.getDistanceFrom( - m_last_sent_position); - m_last_sent_position_timer = 0; - m_last_sent_position = m_base_position; - m_last_sent_velocity = m_velocity; - //m_last_sent_acceleration = m_acceleration; - m_last_sent_rotation = m_rotation; - - float update_interval = m_env->getSendRecommendedInterval(); - - std::string str = generateUpdatePositionCommand( - m_base_position, - m_velocity, - m_acceleration, - m_rotation, - do_interpolate, - is_movement_end, - update_interval - ); - // create message and add to list - m_messages_out.emplace(getId(), false, str); -} - -bool LuaEntitySAO::getCollisionBox(aabb3f *toset) const -{ - if (m_prop.physical) - { - //update collision box - toset->MinEdge = m_prop.collisionbox.MinEdge * BS; - toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS; - - toset->MinEdge += m_base_position; - toset->MaxEdge += m_base_position; - - return true; - } - - return false; -} - -bool LuaEntitySAO::getSelectionBox(aabb3f *toset) const -{ - if (!m_prop.is_visible || !m_prop.pointable) { - return false; - } - - toset->MinEdge = m_prop.selectionbox.MinEdge * BS; - toset->MaxEdge = m_prop.selectionbox.MaxEdge * BS; - - return true; -} - -bool LuaEntitySAO::collideWithObjects() const -{ - return m_prop.collideWithObjects; -} diff --git a/src/content_sao.h b/src/content_sao.h deleted file mode 100644 index 5387fd108..000000000 --- a/src/content_sao.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -Minetest -Copyright (C) 2010-2013 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#pragma once - -#include "network/networkprotocol.h" -#include "util/numeric.h" -#include "server/unit_sao.h" -#include "itemgroup.h" -#include "constants.h" - -/* - LuaEntitySAO needs some internals exposed. -*/ - -class LuaEntitySAO : public UnitSAO -{ -public: - LuaEntitySAO(ServerEnvironment *env, v3f pos, - const std::string &name, const std::string &state); - ~LuaEntitySAO(); - ActiveObjectType getType() const - { return ACTIVEOBJECT_TYPE_LUAENTITY; } - ActiveObjectType getSendType() const - { return ACTIVEOBJECT_TYPE_GENERIC; } - virtual void addedToEnvironment(u32 dtime_s); - static ServerActiveObject* create(ServerEnvironment *env, v3f pos, - const std::string &data); - void step(float dtime, bool send_recommended); - std::string getClientInitializationData(u16 protocol_version); - bool isStaticAllowed() const - { return m_prop.static_save; } - void getStaticData(std::string *result) const; - u16 punch(v3f dir, - const ToolCapabilities *toolcap = nullptr, - ServerActiveObject *puncher = nullptr, - float time_from_last_punch = 1000000.0f); - void rightClick(ServerActiveObject *clicker); - void setPos(const v3f &pos); - void moveTo(v3f pos, bool continuous); - float getMinimumSavedMovement(); - std::string getDescription(); - void setHP(s32 hp, const PlayerHPChangeReason &reason); - u16 getHP() const; - - /* LuaEntitySAO-specific */ - void setVelocity(v3f velocity); - void addVelocity(v3f velocity) - { - m_velocity += velocity; - } - v3f getVelocity(); - void setAcceleration(v3f acceleration); - v3f getAcceleration(); - - void setTextureMod(const std::string &mod); - std::string getTextureMod() const; - void setSprite(v2s16 p, int num_frames, float framelength, - bool select_horiz_by_yawpitch); - std::string getName(); - bool getCollisionBox(aabb3f *toset) const; - bool getSelectionBox(aabb3f *toset) const; - bool collideWithObjects() const; -private: - std::string getPropertyPacket(); - void sendPosition(bool do_interpolate, bool is_movement_end); - std::string generateSetTextureModCommand() const; - static std::string generateSetSpriteCommand(v2s16 p, u16 num_frames, f32 framelength, - bool select_horiz_by_yawpitch); - - std::string m_init_name; - std::string m_init_state; - bool m_registered = false; - - v3f m_velocity; - v3f m_acceleration; - - v3f m_last_sent_position; - v3f m_last_sent_velocity; - v3f m_last_sent_rotation; - float m_last_sent_position_timer = 0.0f; - float m_last_sent_move_precision = 0.0f; - std::string m_current_texture_modifier = ""; -}; - diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 6c426ba41..0094608ec 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -28,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "mapnode.h" #include "map.h" -#include "content_sao.h" #include "nodedef.h" #include "emerge.h" #include "voxelalgorithms.h" diff --git a/src/mapgen/mapgen_carpathian.cpp b/src/mapgen/mapgen_carpathian.cpp index 0dc1d33be..bd7ae5e7c 100644 --- a/src/mapgen/mapgen_carpathian.cpp +++ b/src/mapgen/mapgen_carpathian.cpp @@ -26,7 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "mapnode.h" #include "map.h" -#include "content_sao.h" #include "nodedef.h" #include "voxelalgorithms.h" //#include "profiler.h" // For TimeTaker diff --git a/src/mapgen/mapgen_flat.cpp b/src/mapgen/mapgen_flat.cpp index 879435948..272964b51 100644 --- a/src/mapgen/mapgen_flat.cpp +++ b/src/mapgen/mapgen_flat.cpp @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "mapnode.h" #include "map.h" -#include "content_sao.h" #include "nodedef.h" #include "voxelalgorithms.h" //#include "profiler.h" // For TimeTaker diff --git a/src/mapgen/mapgen_fractal.cpp b/src/mapgen/mapgen_fractal.cpp index 96febb4f4..97f77d947 100644 --- a/src/mapgen/mapgen_fractal.cpp +++ b/src/mapgen/mapgen_fractal.cpp @@ -26,7 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "mapnode.h" #include "map.h" -#include "content_sao.h" #include "nodedef.h" #include "voxelalgorithms.h" //#include "profiler.h" // For TimeTaker diff --git a/src/mapgen/mapgen_v5.cpp b/src/mapgen/mapgen_v5.cpp index 447fe8c50..3bd7615c4 100644 --- a/src/mapgen/mapgen_v5.cpp +++ b/src/mapgen/mapgen_v5.cpp @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "mapnode.h" #include "map.h" -#include "content_sao.h" #include "nodedef.h" #include "voxelalgorithms.h" //#include "profiler.h" // For TimeTaker diff --git a/src/mapgen/mapgen_v6.cpp b/src/mapgen/mapgen_v6.cpp index f473f725d..da9ae1428 100644 --- a/src/mapgen/mapgen_v6.cpp +++ b/src/mapgen/mapgen_v6.cpp @@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "mapnode.h" #include "map.h" -#include "content_sao.h" #include "nodedef.h" #include "voxelalgorithms.h" //#include "profiler.h" // For TimeTaker diff --git a/src/mapgen/mapgen_v7.cpp b/src/mapgen/mapgen_v7.cpp index 325c4957a..82556cc4f 100644 --- a/src/mapgen/mapgen_v7.cpp +++ b/src/mapgen/mapgen_v7.cpp @@ -26,7 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapblock.h" #include "mapnode.h" #include "map.h" -#include "content_sao.h" #include "nodedef.h" #include "voxelalgorithms.h" //#include "profiler.h" // For TimeTaker diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp index 150baf77e..df07206d7 100644 --- a/src/script/cpp_api/s_base.cpp +++ b/src/script/cpp_api/s_base.cpp @@ -43,7 +43,6 @@ extern "C" { #include #include #include "script/common/c_content.h" -#include "content_sao.h" #include diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 438669feb..40e50e64a 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -33,12 +33,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "nodedef.h" #include "daynightratio.h" #include "util/pointedthing.h" -#include "content_sao.h" #include "mapgen/treegen.h" #include "emerge.h" #include "pathfinder.h" #include "face_position_cache.h" #include "remoteplayer.h" +#include "server/luaentity_sao.h" #include "server/player_sao.h" #ifndef SERVER #include "client/client.h" diff --git a/src/script/lua_api/l_item.cpp b/src/script/lua_api/l_item.cpp index ff77cba32..9f12d3ac7 100644 --- a/src/script/lua_api/l_item.cpp +++ b/src/script/lua_api/l_item.cpp @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "itemdef.h" #include "nodedef.h" #include "server.h" -#include "content_sao.h" #include "inventory.h" #include "log.h" diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 95c96235e..fa34260bf 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -27,11 +27,11 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_content.h" #include "log.h" #include "tool.h" -#include "content_sao.h" #include "remoteplayer.h" #include "server.h" #include "hud.h" #include "scripting_server.h" +#include "server/luaentity_sao.h" #include "server/player_sao.h" /* diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 26eaed5ac..4d94504f6 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -1,5 +1,6 @@ set(server_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/activeobjectmgr.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/luaentity_sao.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mods.cpp ${CMAKE_CURRENT_SOURCE_DIR}/player_sao.cpp ${CMAKE_CURRENT_SOURCE_DIR}/serveractiveobject.cpp diff --git a/src/server/luaentity_sao.cpp b/src/server/luaentity_sao.cpp new file mode 100644 index 000000000..125939241 --- /dev/null +++ b/src/server/luaentity_sao.cpp @@ -0,0 +1,581 @@ +/* +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2013-2020 Minetest core developers & community + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "luaentity_sao.h" +#include "collision.h" +#include "constants.h" +#include "player_sao.h" +#include "scripting_server.h" +#include "server.h" +#include "serverenvironment.h" + +LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos, const std::string &data) + : UnitSAO(env, pos) +{ + std::string name; + std::string state; + u16 hp = 1; + v3f velocity; + v3f rotation; + + while (!data.empty()) { // breakable, run for one iteration + std::istringstream is(data, std::ios::binary); + // 'version' does not allow to incrementally extend the parameter list thus + // we need another variable to build on top of 'version=1'. Ugly hack but works™ + u8 version2 = 0; + u8 version = readU8(is); + + name = deSerializeString(is); + state = deSerializeLongString(is); + + if (version < 1) + break; + + hp = readU16(is); + velocity = readV3F1000(is); + // yaw must be yaw to be backwards-compatible + rotation.Y = readF1000(is); + + if (is.good()) // EOF for old formats + version2 = readU8(is); + + if (version2 < 1) // PROTOCOL_VERSION < 37 + break; + + // version2 >= 1 + rotation.X = readF1000(is); + rotation.Z = readF1000(is); + + // if (version2 < 2) + // break; + // + break; + } + // create object + infostream << "LuaEntitySAO::create(name=\"" << name << "\" state=\"" + << state << "\")" << std::endl; + + m_init_name = name; + m_init_state = state; + m_hp = hp; + m_velocity = velocity; + m_rotation = rotation; +} + +LuaEntitySAO::~LuaEntitySAO() +{ + if(m_registered){ + m_env->getScriptIface()->luaentity_Remove(m_id); + } + + for (u32 attached_particle_spawner : m_attached_particle_spawners) { + m_env->deleteParticleSpawner(attached_particle_spawner, false); + } +} + +void LuaEntitySAO::addedToEnvironment(u32 dtime_s) +{ + ServerActiveObject::addedToEnvironment(dtime_s); + + // Create entity from name + m_registered = m_env->getScriptIface()-> + luaentity_Add(m_id, m_init_name.c_str()); + + if(m_registered){ + // Get properties + m_env->getScriptIface()-> + luaentity_GetProperties(m_id, this, &m_prop); + // Initialize HP from properties + m_hp = m_prop.hp_max; + // Activate entity, supplying serialized state + m_env->getScriptIface()-> + luaentity_Activate(m_id, m_init_state, dtime_s); + } else { + m_prop.infotext = m_init_name; + } +} + +void LuaEntitySAO::step(float dtime, bool send_recommended) +{ + if(!m_properties_sent) + { + m_properties_sent = true; + std::string str = getPropertyPacket(); + // create message and add to list + ActiveObjectMessage aom(getId(), true, str); + m_messages_out.push(aom); + } + + // If attached, check that our parent is still there. If it isn't, detach. + if(m_attachment_parent_id && !isAttached()) + { + m_attachment_parent_id = 0; + m_attachment_bone = ""; + m_attachment_position = v3f(0,0,0); + m_attachment_rotation = v3f(0,0,0); + sendPosition(false, true); + } + + m_last_sent_position_timer += dtime; + + // Each frame, parent position is copied if the object is attached, otherwise it's calculated normally + // If the object gets detached this comes into effect automatically from the last known origin + if(isAttached()) + { + v3f pos = m_env->getActiveObject(m_attachment_parent_id)->getBasePosition(); + m_base_position = pos; + m_velocity = v3f(0,0,0); + m_acceleration = v3f(0,0,0); + } + else + { + if(m_prop.physical){ + aabb3f box = m_prop.collisionbox; + box.MinEdge *= BS; + box.MaxEdge *= BS; + collisionMoveResult moveresult; + f32 pos_max_d = BS*0.25; // Distance per iteration + v3f p_pos = m_base_position; + v3f p_velocity = m_velocity; + v3f p_acceleration = m_acceleration; + moveresult = collisionMoveSimple(m_env, m_env->getGameDef(), + pos_max_d, box, m_prop.stepheight, dtime, + &p_pos, &p_velocity, p_acceleration, + this, m_prop.collideWithObjects); + + // Apply results + m_base_position = p_pos; + m_velocity = p_velocity; + m_acceleration = p_acceleration; + } else { + m_base_position += dtime * m_velocity + 0.5 * dtime + * dtime * m_acceleration; + m_velocity += dtime * m_acceleration; + } + + if (m_prop.automatic_face_movement_dir && + (fabs(m_velocity.Z) > 0.001 || fabs(m_velocity.X) > 0.001)) { + float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI + + m_prop.automatic_face_movement_dir_offset; + float max_rotation_per_sec = + m_prop.automatic_face_movement_max_rotation_per_sec; + + if (max_rotation_per_sec > 0) { + m_rotation.Y = wrapDegrees_0_360(m_rotation.Y); + wrappedApproachShortest(m_rotation.Y, target_yaw, + dtime * max_rotation_per_sec, 360.f); + } else { + // Negative values of max_rotation_per_sec mean disabled. + m_rotation.Y = target_yaw; + } + } + } + + if(m_registered){ + m_env->getScriptIface()->luaentity_Step(m_id, dtime); + } + + if (!send_recommended) + return; + + if(!isAttached()) + { + // TODO: force send when acceleration changes enough? + float minchange = 0.2*BS; + if(m_last_sent_position_timer > 1.0){ + minchange = 0.01*BS; + } else if(m_last_sent_position_timer > 0.2){ + minchange = 0.05*BS; + } + float move_d = m_base_position.getDistanceFrom(m_last_sent_position); + move_d += m_last_sent_move_precision; + float vel_d = m_velocity.getDistanceFrom(m_last_sent_velocity); + if (move_d > minchange || vel_d > minchange || + std::fabs(m_rotation.X - m_last_sent_rotation.X) > 1.0f || + std::fabs(m_rotation.Y - m_last_sent_rotation.Y) > 1.0f || + std::fabs(m_rotation.Z - m_last_sent_rotation.Z) > 1.0f) { + + sendPosition(true, false); + } + } + + if (!m_armor_groups_sent) { + m_armor_groups_sent = true; + // create message and add to list + m_messages_out.emplace(getId(), true, generateUpdateArmorGroupsCommand()); + } + + if (!m_animation_sent) { + m_animation_sent = true; + std::string str = generateUpdateAnimationCommand(); + // create message and add to list + ActiveObjectMessage aom(getId(), true, str); + m_messages_out.push(aom); + } + + if (!m_animation_speed_sent) { + m_animation_speed_sent = true; + std::string str = generateUpdateAnimationSpeedCommand(); + // create message and add to list + ActiveObjectMessage aom(getId(), true, str); + m_messages_out.push(aom); + } + + if (!m_bone_position_sent) { + m_bone_position_sent = true; + for (std::unordered_map>::const_iterator + ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii){ + std::string str = generateUpdateBonePositionCommand((*ii).first, + (*ii).second.X, (*ii).second.Y); + // create message and add to list + ActiveObjectMessage aom(getId(), true, str); + m_messages_out.push(aom); + } + } + + if (!m_attachment_sent) { + m_attachment_sent = true; + std::string str = generateUpdateAttachmentCommand(); + // create message and add to list + ActiveObjectMessage aom(getId(), true, str); + m_messages_out.push(aom); + } +} + +std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version) +{ + std::ostringstream os(std::ios::binary); + + // PROTOCOL_VERSION >= 37 + writeU8(os, 1); // version + os << serializeString(""); // name + writeU8(os, 0); // is_player + writeU16(os, getId()); //id + writeV3F32(os, m_base_position); + writeV3F32(os, m_rotation); + writeU16(os, m_hp); + + std::ostringstream msg_os(std::ios::binary); + msg_os << serializeLongString(getPropertyPacket()); // message 1 + msg_os << serializeLongString(generateUpdateArmorGroupsCommand()); // 2 + msg_os << serializeLongString(generateUpdateAnimationCommand()); // 3 + for (std::unordered_map>::const_iterator + ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii) { + msg_os << serializeLongString(generateUpdateBonePositionCommand((*ii).first, + (*ii).second.X, (*ii).second.Y)); // m_bone_position.size + } + msg_os << serializeLongString(generateUpdateAttachmentCommand()); // 4 + int message_count = 4 + m_bone_position.size(); + for (std::unordered_set::const_iterator ii = m_attachment_child_ids.begin(); + (ii != m_attachment_child_ids.end()); ++ii) { + if (ServerActiveObject *obj = m_env->getActiveObject(*ii)) { + message_count++; + // TODO after a protocol bump: only send the object initialization data + // to older clients (superfluous since this message exists) + msg_os << serializeLongString(obj->generateUpdateInfantCommand(*ii, protocol_version)); + } + } + + msg_os << serializeLongString(generateSetTextureModCommand()); + message_count++; + + writeU8(os, message_count); + os.write(msg_os.str().c_str(), msg_os.str().size()); + + // return result + return os.str(); +} + +void LuaEntitySAO::getStaticData(std::string *result) const +{ + verbosestream<getScriptIface()-> + luaentity_GetStaticdata(m_id); + os<= 37 + + writeF1000(os, m_rotation.X); + writeF1000(os, m_rotation.Z); + + // + + *result = os.str(); +} + +u16 LuaEntitySAO::punch(v3f dir, + const ToolCapabilities *toolcap, + ServerActiveObject *puncher, + float time_from_last_punch) +{ + if (!m_registered) { + // Delete unknown LuaEntities when punched + m_pending_removal = true; + return 0; + } + + FATAL_ERROR_IF(!puncher, "Punch action called without SAO"); + + s32 old_hp = getHP(); + ItemStack selected_item, hand_item; + ItemStack tool_item = puncher->getWieldedItem(&selected_item, &hand_item); + + PunchDamageResult result = getPunchDamage( + m_armor_groups, + toolcap, + &tool_item, + time_from_last_punch); + + bool damage_handled = m_env->getScriptIface()->luaentity_Punch(m_id, puncher, + time_from_last_punch, toolcap, dir, result.did_punch ? result.damage : 0); + + if (!damage_handled) { + if (result.did_punch) { + setHP((s32)getHP() - result.damage, + PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, puncher)); + + // create message and add to list + sendPunchCommand(); + } + } + + if (getHP() == 0 && !isGone()) { + clearParentAttachment(); + clearChildAttachments(); + m_env->getScriptIface()->luaentity_on_death(m_id, puncher); + m_pending_removal = true; + } + + actionstream << puncher->getDescription() << " (id=" << puncher->getId() << + ", hp=" << puncher->getHP() << ") punched " << + getDescription() << " (id=" << m_id << ", hp=" << m_hp << + "), damage=" << (old_hp - (s32)getHP()) << + (damage_handled ? " (handled by Lua)" : "") << std::endl; + + // TODO: give Lua control over wear + return result.wear; +} + +void LuaEntitySAO::rightClick(ServerActiveObject *clicker) +{ + if (!m_registered) + return; + + m_env->getScriptIface()->luaentity_Rightclick(m_id, clicker); +} + +void LuaEntitySAO::setPos(const v3f &pos) +{ + if(isAttached()) + return; + m_base_position = pos; + sendPosition(false, true); +} + +void LuaEntitySAO::moveTo(v3f pos, bool continuous) +{ + if(isAttached()) + return; + m_base_position = pos; + if(!continuous) + sendPosition(true, true); +} + +float LuaEntitySAO::getMinimumSavedMovement() +{ + return 0.1 * BS; +} + +std::string LuaEntitySAO::getDescription() +{ + std::ostringstream oss; + oss << "LuaEntitySAO \"" << m_init_name << "\" "; + auto pos = floatToInt(m_base_position, BS); + oss << "at " << PP(pos); + return oss.str(); +} + +void LuaEntitySAO::setHP(s32 hp, const PlayerHPChangeReason &reason) +{ + m_hp = rangelim(hp, 0, U16_MAX); +} + +u16 LuaEntitySAO::getHP() const +{ + return m_hp; +} + +void LuaEntitySAO::setVelocity(v3f velocity) +{ + m_velocity = velocity; +} + +v3f LuaEntitySAO::getVelocity() +{ + return m_velocity; +} + +void LuaEntitySAO::setAcceleration(v3f acceleration) +{ + m_acceleration = acceleration; +} + +v3f LuaEntitySAO::getAcceleration() +{ + return m_acceleration; +} + +void LuaEntitySAO::setTextureMod(const std::string &mod) +{ + m_current_texture_modifier = mod; + // create message and add to list + m_messages_out.emplace(getId(), true, generateSetTextureModCommand()); +} + +std::string LuaEntitySAO::getTextureMod() const +{ + return m_current_texture_modifier; +} + + +std::string LuaEntitySAO::generateSetTextureModCommand() const +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_TEXTURE_MOD); + // parameters + os << serializeString(m_current_texture_modifier); + return os.str(); +} + +std::string LuaEntitySAO::generateSetSpriteCommand(v2s16 p, u16 num_frames, + f32 framelength, bool select_horiz_by_yawpitch) +{ + std::ostringstream os(std::ios::binary); + // command + writeU8(os, AO_CMD_SET_SPRITE); + // parameters + writeV2S16(os, p); + writeU16(os, num_frames); + writeF32(os, framelength); + writeU8(os, select_horiz_by_yawpitch); + return os.str(); +} + +void LuaEntitySAO::setSprite(v2s16 p, int num_frames, float framelength, + bool select_horiz_by_yawpitch) +{ + std::string str = generateSetSpriteCommand( + p, + num_frames, + framelength, + select_horiz_by_yawpitch + ); + // create message and add to list + m_messages_out.emplace(getId(), true, str); +} + +std::string LuaEntitySAO::getName() +{ + return m_init_name; +} + +std::string LuaEntitySAO::getPropertyPacket() +{ + return generateSetPropertiesCommand(m_prop); +} + +void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end) +{ + // If the object is attached client-side, don't waste bandwidth sending its position to clients + if(isAttached()) + return; + + m_last_sent_move_precision = m_base_position.getDistanceFrom( + m_last_sent_position); + m_last_sent_position_timer = 0; + m_last_sent_position = m_base_position; + m_last_sent_velocity = m_velocity; + //m_last_sent_acceleration = m_acceleration; + m_last_sent_rotation = m_rotation; + + float update_interval = m_env->getSendRecommendedInterval(); + + std::string str = generateUpdatePositionCommand( + m_base_position, + m_velocity, + m_acceleration, + m_rotation, + do_interpolate, + is_movement_end, + update_interval + ); + // create message and add to list + m_messages_out.emplace(getId(), false, str); +} + +bool LuaEntitySAO::getCollisionBox(aabb3f *toset) const +{ + if (m_prop.physical) + { + //update collision box + toset->MinEdge = m_prop.collisionbox.MinEdge * BS; + toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS; + + toset->MinEdge += m_base_position; + toset->MaxEdge += m_base_position; + + return true; + } + + return false; +} + +bool LuaEntitySAO::getSelectionBox(aabb3f *toset) const +{ + if (!m_prop.is_visible || !m_prop.pointable) { + return false; + } + + toset->MinEdge = m_prop.selectionbox.MinEdge * BS; + toset->MaxEdge = m_prop.selectionbox.MaxEdge * BS; + + return true; +} + +bool LuaEntitySAO::collideWithObjects() const +{ + return m_prop.collideWithObjects; +} diff --git a/src/server/luaentity_sao.h b/src/server/luaentity_sao.h new file mode 100644 index 000000000..2520c8f5d --- /dev/null +++ b/src/server/luaentity_sao.h @@ -0,0 +1,93 @@ +/* +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2013-2020 Minetest core developers & community + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once + +#include "unit_sao.h" + +class LuaEntitySAO : public UnitSAO +{ +public: + LuaEntitySAO() = delete; + // Used by the environment to load SAO + LuaEntitySAO(ServerEnvironment *env, v3f pos, const std::string &data); + // Used by the Lua API + LuaEntitySAO(ServerEnvironment *env, v3f pos, const std::string &name, + const std::string &state) : + UnitSAO(env, pos), + m_init_name(name), m_init_state(state) + { + } + ~LuaEntitySAO(); + ActiveObjectType getType() const { return ACTIVEOBJECT_TYPE_LUAENTITY; } + ActiveObjectType getSendType() const { return ACTIVEOBJECT_TYPE_GENERIC; } + virtual void addedToEnvironment(u32 dtime_s); + void step(float dtime, bool send_recommended); + std::string getClientInitializationData(u16 protocol_version); + bool isStaticAllowed() const { return m_prop.static_save; } + void getStaticData(std::string *result) const; + u16 punch(v3f dir, const ToolCapabilities *toolcap = nullptr, + ServerActiveObject *puncher = nullptr, + float time_from_last_punch = 1000000.0f); + void rightClick(ServerActiveObject *clicker); + void setPos(const v3f &pos); + void moveTo(v3f pos, bool continuous); + float getMinimumSavedMovement(); + std::string getDescription(); + void setHP(s32 hp, const PlayerHPChangeReason &reason); + u16 getHP() const; + + /* LuaEntitySAO-specific */ + void setVelocity(v3f velocity); + void addVelocity(v3f velocity) { m_velocity += velocity; } + v3f getVelocity(); + void setAcceleration(v3f acceleration); + v3f getAcceleration(); + + void setTextureMod(const std::string &mod); + std::string getTextureMod() const; + void setSprite(v2s16 p, int num_frames, float framelength, + bool select_horiz_by_yawpitch); + std::string getName(); + bool getCollisionBox(aabb3f *toset) const; + bool getSelectionBox(aabb3f *toset) const; + bool collideWithObjects() const; + +private: + std::string getPropertyPacket(); + void sendPosition(bool do_interpolate, bool is_movement_end); + std::string generateSetTextureModCommand() const; + static std::string generateSetSpriteCommand(v2s16 p, u16 num_frames, + f32 framelength, bool select_horiz_by_yawpitch); + + std::string m_init_name; + std::string m_init_state; + bool m_registered = false; + + v3f m_velocity; + v3f m_acceleration; + + v3f m_last_sent_position; + v3f m_last_sent_velocity; + v3f m_last_sent_rotation; + float m_last_sent_position_timer = 0.0f; + float m_last_sent_move_precision = 0.0f; + std::string m_current_texture_modifier = ""; +}; diff --git a/src/server/player_sao.h b/src/server/player_sao.h index ce1cb1677..8571bd4f9 100644 --- a/src/server/player_sao.h +++ b/src/server/player_sao.h @@ -1,4 +1,3 @@ - /* Minetest Copyright (C) 2010-2013 celeron55, Perttu Ahola @@ -19,6 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#pragma once + #include "constants.h" #include "network/networkprotocol.h" #include "unit_sao.h" @@ -32,33 +33,31 @@ class LagPool { float m_pool = 15.0f; float m_max = 15.0f; + public: LagPool() = default; void setMax(float new_max) { m_max = new_max; - if(m_pool > new_max) + if (m_pool > new_max) m_pool = new_max; } void add(float dtime) { m_pool -= dtime; - if(m_pool < 0) + if (m_pool < 0) m_pool = 0; } - void empty() - { - m_pool = m_max; - } + void empty() { m_pool = m_max; } bool grab(float dtime) { - if(dtime <= 0) + if (dtime <= 0) return true; - if(m_pool + dtime > m_max) + if (m_pool + dtime > m_max) return false; m_pool += dtime; return true; @@ -73,10 +72,8 @@ public: PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t peer_id_, bool is_singleplayer); - ActiveObjectType getType() const - { return ACTIVEOBJECT_TYPE_PLAYER; } - ActiveObjectType getSendType() const - { return ACTIVEOBJECT_TYPE_GENERIC; } + ActiveObjectType getType() const { return ACTIVEOBJECT_TYPE_PLAYER; } + ActiveObjectType getSendType() const { return ACTIVEOBJECT_TYPE_GENERIC; } std::string getDescription(); /* @@ -111,10 +108,8 @@ public: Interaction interface */ - u16 punch(v3f dir, - const ToolCapabilities *toolcap, - ServerActiveObject *puncher, - float time_from_last_punch); + u16 punch(v3f dir, const ToolCapabilities *toolcap, ServerActiveObject *puncher, + float time_from_last_punch); void rightClick(ServerActiveObject *clicker) {} void setHP(s32 hp, const PlayerHPChangeReason &reason); void setHPRaw(u16 hp) { m_hp = hp; } @@ -144,10 +139,7 @@ public: // Cheat prevention - v3f getLastGoodPosition() const - { - return m_last_good_position; - } + v3f getLastGoodPosition() const { return m_last_good_position; } float resetTimeFromLastPunch() { float r = m_time_from_last_punch; @@ -159,30 +151,17 @@ public: m_nocheat_dig_pos = p; m_nocheat_dig_time = 0; } - v3s16 getNoCheatDigPos() - { - return m_nocheat_dig_pos; - } - float getNoCheatDigTime() - { - return m_nocheat_dig_time; - } - void noCheatDigEnd() - { - m_nocheat_dig_pos = v3s16(32767, 32767, 32767); - } - LagPool& getDigPool() - { - return m_dig_pool; - } + v3s16 getNoCheatDigPos() { return m_nocheat_dig_pos; } + float getNoCheatDigTime() { return m_nocheat_dig_time; } + void noCheatDigEnd() { m_nocheat_dig_pos = v3s16(32767, 32767, 32767); } + LagPool &getDigPool() { return m_dig_pool; } void setMaxSpeedOverride(const v3f &vel); // Returns true if cheated bool checkMovementCheat(); // Other - void updatePrivileges(const std::set &privs, - bool is_singleplayer) + void updatePrivileges(const std::set &privs, bool is_singleplayer) { m_privs = privs; m_is_singleplayer = is_singleplayer; @@ -236,6 +215,7 @@ private: s16 m_wanted_range = 0.0f; Metadata m_meta; + public: float m_physics_override_speed = 1.0f; float m_physics_override_jump = 1.0f; @@ -246,9 +226,10 @@ public: bool m_physics_override_sent = false; }; - -struct PlayerHPChangeReason { - enum Type : u8 { +struct PlayerHPChangeReason +{ + enum Type : u8 + { SET_HP, PLAYER_PUNCH, FALL, @@ -266,10 +247,7 @@ struct PlayerHPChangeReason { // For NODE_DAMAGE std::string node; - inline bool hasLuaReference() const - { - return lua_reference >= 0; - } + inline bool hasLuaReference() const { return lua_reference >= 0; } bool setTypeFromString(const std::string &typestr) { @@ -311,15 +289,12 @@ struct PlayerHPChangeReason { } } - PlayerHPChangeReason(Type type): - type(type) - {} + PlayerHPChangeReason(Type type) : type(type) {} - PlayerHPChangeReason(Type type, ServerActiveObject *object): + PlayerHPChangeReason(Type type, ServerActiveObject *object) : type(type), object(object) - {} + { + } - PlayerHPChangeReason(Type type, std::string node): - type(type), node(node) - {} + PlayerHPChangeReason(Type type, std::string node) : type(type), node(node) {} }; diff --git a/src/server/serveractiveobject.cpp b/src/server/serveractiveobject.cpp index 3aa78c7d5..8345ebd47 100644 --- a/src/server/serveractiveobject.cpp +++ b/src/server/serveractiveobject.cpp @@ -30,39 +30,6 @@ ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos): { } -ServerActiveObject* ServerActiveObject::create(ActiveObjectType type, - ServerEnvironment *env, u16 id, v3f pos, - const std::string &data) -{ - // Find factory function - std::map::iterator n; - n = m_types.find(type); - if(n == m_types.end()) { - // These are 0.3 entity types, return without error. - if (ACTIVEOBJECT_TYPE_ITEM <= type && type <= ACTIVEOBJECT_TYPE_MOBV2) { - return NULL; - } - - // If factory is not found, just return. - warningstream<<"ServerActiveObject: No factory for type=" - <second; - ServerActiveObject *object = (*f)(env, pos, data); - return object; -} - -void ServerActiveObject::registerType(u16 type, Factory f) -{ - std::map::iterator n; - n = m_types.find(type); - if(n != m_types.end()) - return; - m_types[type] = f; -} - float ServerActiveObject::getMinimumSavedMovement() { return 2.0*BS; diff --git a/src/server/serveractiveobject.h b/src/server/serveractiveobject.h index 2e013a6b6..927009aef 100644 --- a/src/server/serveractiveobject.h +++ b/src/server/serveractiveobject.h @@ -244,12 +244,6 @@ protected: virtual void onAttach(int parent_id) {} virtual void onDetach(int parent_id) {} - // Used for creating objects based on type - typedef ServerActiveObject* (*Factory) - (ServerEnvironment *env, v3f pos, - const std::string &data); - static void registerType(u16 type, Factory f); - ServerEnvironment *m_env; v3f m_base_position; std::unordered_set m_attached_particle_spawners; @@ -258,8 +252,4 @@ protected: Queue of messages to be sent to the client */ std::queue m_messages_out; - -private: - // Used for creating objects based on type - static std::map m_types; }; diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index c2ab5c07d..32d10f8c0 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -44,6 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #if USE_POSTGRESQL #include "database/database-postgresql.h" #endif +#include "server/luaentity_sao.h" #include "server/player_sao.h" #define LBM_NAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_:" @@ -1778,6 +1779,18 @@ static void print_hexdump(std::ostream &o, const std::string &data) } } +ServerActiveObject* ServerEnvironment::createSAO(ActiveObjectType type, v3f pos, + const std::string &data) +{ + switch (type) { + case ACTIVEOBJECT_TYPE_LUAENTITY: + return new LuaEntitySAO(this, pos, data); + default: + warningstream << "ServerActiveObject: No factory for type=" << type << std::endl; + } + return nullptr; +} + /* Convert stored objects from blocks near the players to active. */ @@ -1811,10 +1824,10 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s) std::vector new_stored; for (const StaticObject &s_obj : block->m_static_objects.m_stored) { // Create an active object from the data - ServerActiveObject *obj = ServerActiveObject::create - ((ActiveObjectType) s_obj.type, this, 0, s_obj.pos, s_obj.data); + ServerActiveObject *obj = createSAO((ActiveObjectType) s_obj.type, s_obj.pos, + s_obj.data); // If couldn't create object, store static data back. - if(obj == NULL) { + if (!obj) { errorstream<<"ServerEnvironment::activateObjects(): " <<"failed to create active object from static object " <<"in block "< m_particle_spawners; std::unordered_map m_particle_spawner_attachments; + + ServerActiveObject* createSAO(ActiveObjectType type, v3f pos, const std::string &data); }; diff --git a/src/staticobject.cpp b/src/staticobject.cpp index bebca12ec..5ccb7baf5 100644 --- a/src/staticobject.cpp +++ b/src/staticobject.cpp @@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "staticobject.h" #include "util/serialize.h" -#include "content_sao.h" +#include "server/serveractiveobject.h" StaticObject::StaticObject(const ServerActiveObject *s_obj, const v3f &pos_): type(s_obj->getType()), diff --git a/src/unittest/test_player.cpp b/src/unittest/test_player.cpp index e2b1cd855..6990b4016 100644 --- a/src/unittest/test_player.cpp +++ b/src/unittest/test_player.cpp @@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "exceptions.h" #include "remoteplayer.h" -#include "content_sao.h" #include "server.h" class TestPlayer : public TestBase diff --git a/util/travis/clang-format-whitelist.txt b/util/travis/clang-format-whitelist.txt index 816ec2c59..bb97da7b5 100644 --- a/util/travis/clang-format-whitelist.txt +++ b/util/travis/clang-format-whitelist.txt @@ -118,8 +118,6 @@ src/content_mapblock.h src/content_mapnode.cpp src/content_nodemeta.cpp src/content_nodemeta.h -src/content_sao.cpp -src/content_sao.h src/convert_json.cpp src/convert_json.h src/craftdef.cpp @@ -408,6 +406,8 @@ src/serverenvironment.h src/server.h src/serverlist.cpp src/serverlist.h +src/server/luaentity_sao.cpp +src/server/player_sao.cpp src/server/serveractiveobject.cpp src/server/serveractiveobject.h src/settings.cpp -- cgit v1.2.3 From 5cf6318117edcae6bf30d829d9e9dd9dbf1d4bf7 Mon Sep 17 00:00:00 2001 From: Hugues Ross Date: Tue, 14 Apr 2020 14:41:29 -0400 Subject: Refactor texture overrides and add new features (#9600) * Refactor texture overrides, and add new features: - Texture overrides can support multiple targets in one line - Texture override files can have comment lines - Item images/wield images can be overridden * Formatting changes * Address soime feedback - Pass vectors by const reference - Log syntax errors as warnings - Remove 'C' prefix from TextureOverrideSource * Simplify override target checks with an inline helper function * make linter happy * Apply feedback suggestions Co-Authored-By: rubenwardy * Remove remaining != 0 checks * Update copyright notice Co-authored-by: sfan5 Co-authored-by: rubenwardy --- doc/texture_packs.txt | 45 +++++++++---- src/CMakeLists.txt | 1 + src/client/client.cpp | 7 +- src/itemdef.cpp | 19 ++++++ src/itemdef.h | 5 ++ src/nodedef.cpp | 67 ++++++------------ src/nodedef.h | 12 ++-- src/server.cpp | 7 +- src/texture_override.cpp | 120 +++++++++++++++++++++++++++++++++ src/texture_override.h | 72 ++++++++++++++++++++ util/travis/clang-format-whitelist.txt | 1 + 11 files changed, 285 insertions(+), 71 deletions(-) create mode 100644 src/texture_override.cpp create mode 100644 src/texture_override.h (limited to 'util') diff --git a/doc/texture_packs.txt b/doc/texture_packs.txt index 7ab0aca94..4e7bc93c4 100644 --- a/doc/texture_packs.txt +++ b/doc/texture_packs.txt @@ -145,34 +145,51 @@ are placeholders intended to be overwritten by the game. Texture Overrides ----------------- -You can override the textures of a node from a texture pack using -texture overrides. To do this, create a file in a texture pack -called override.txt +You can override the textures of nodes and items from a +texture pack using texture overrides. To do this, create one or +more files in a texture pack called override.txt Each line in an override.txt file is a rule. It consists of - nodename face-selector texture + itemname target texture For example, default:dirt_with_grass sides default_stone.png -You can use ^ operators as usual: +or + + default:sword_steel inventory my_steel_sword.png + +You can list multiple targets on one line as a comma-separated list: + + default:tree top,bottom my_special_tree.png + +You can use texture modifiers, as usual: default:dirt_with_grass sides default_stone.png^[brighten -Here are face selectors you can choose from: +Finally, if a line is empty or starts with '#' it will be considered +a comment and not read as a rule. You can use this to better organize +your override.txt files. + +Here are targets you can choose from: -| face-selector | behavior | +| target | behavior | |---------------|---------------------------------------------------| -| left | x- | -| right | x+ | -| front | z- | -| back | z+ | -| top | y+ | -| bottom | y- | -| sides | x-, x+, z-, z+ | +| left | x- face | +| right | x+ face | +| front | z- face | +| back | z+ face | +| top | y+ face | +| bottom | y- face | +| sides | x-, x+, z-, z+ faces | | all | All faces. You can also use '*' instead of 'all'. | +| inventory | The inventory texture | +| wield | The texture used when held by the player | + +Nodes support all targets, but other items only support 'inventory' +and 'wield' Designing leaves textures for the leaves rendering options ---------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b550c09c..fa261547b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -423,6 +423,7 @@ set(common_SRCS settings.cpp staticobject.cpp terminal_chat_console.cpp + texture_override.cpp tileanimation.cpp tool.cpp translation.cpp diff --git a/src/client/client.cpp b/src/client/client.cpp index c3e2a4d2a..8ee0869cd 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1742,8 +1742,11 @@ void Client::afterContentReceived() text = wgettext("Initializing nodes..."); RenderingEngine::draw_load_screen(text, guienv, m_tsrc, 0, 72); m_nodedef->updateAliases(m_itemdef); - for (const auto &path : getTextureDirs()) - m_nodedef->applyTextureOverrides(path + DIR_DELIM + "override.txt"); + for (const auto &path : getTextureDirs()) { + TextureOverrideSource override_source(path + DIR_DELIM + "override.txt"); + m_nodedef->applyTextureOverrides(override_source.getNodeTileOverrides()); + m_itemdef->applyTextureOverrides(override_source.getItemTextureOverrides()); + } m_nodedef->setNodeRegistrationStatus(true); m_nodedef->runNodeResolveCallbacks(); delete[] text; diff --git a/src/itemdef.cpp b/src/itemdef.cpp index ba7bd6a0b..a13b3f7d4 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -422,6 +422,25 @@ public: return get(stack.name).color; } #endif + void applyTextureOverrides(const std::vector &overrides) + { + infostream << "ItemDefManager::applyTextureOverrides(): Applying " + "overrides to textures" << std::endl; + + for (const TextureOverride& texture_override : overrides) { + if (m_item_definitions.find(texture_override.id) == m_item_definitions.end()) { + continue; // Ignore unknown item + } + + ItemDefinition* itemdef = m_item_definitions[texture_override.id]; + + if (texture_override.hasTarget(OverrideTarget::INVENTORY)) + itemdef->inventory_image = texture_override.texture; + + if (texture_override.hasTarget(OverrideTarget::WIELD)) + itemdef->wield_image = texture_override.texture; + } + } void clear() { for(std::map::const_iterator diff --git a/src/itemdef.h b/src/itemdef.h index 45cff582a..f47e6cbe7 100644 --- a/src/itemdef.h +++ b/src/itemdef.h @@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include "itemgroup.h" #include "sound.h" +#include "texture_override.h" // TextureOverride class IGameDef; class Client; struct ToolCapabilities; @@ -157,6 +158,10 @@ public: Client *client) const=0; #endif + // Replace the textures of registered nodes with the ones specified in + // the texture pack's override.txt files + virtual void applyTextureOverrides(const std::vector &overrides)=0; + // Remove all registered item and node definitions and aliases // Then re-add the builtin item definitions virtual void clear()=0; diff --git a/src/nodedef.cpp b/src/nodedef.cpp index b6eca9497..37332c3c6 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -1304,60 +1304,35 @@ void NodeDefManager::updateAliases(IItemDefManager *idef) } } -void NodeDefManager::applyTextureOverrides(const std::string &override_filepath) +void NodeDefManager::applyTextureOverrides(const std::vector &overrides) { infostream << "NodeDefManager::applyTextureOverrides(): Applying " - "overrides to textures from " << override_filepath << std::endl; - - std::ifstream infile(override_filepath.c_str()); - std::string line; - int line_c = 0; - while (std::getline(infile, line)) { - line_c++; - // Also trim '\r' on DOS-style files - line = trim(line); - if (line.empty()) - continue; - - std::vector splitted = str_split(line, ' '); - if (splitted.size() != 3) { - errorstream << override_filepath - << ":" << line_c << " Could not apply texture override \"" - << line << "\": Syntax error" << std::endl; - continue; - } + "overrides to textures" << std::endl; + for (const TextureOverride& texture_override : overrides) { content_t id; - if (!getId(splitted[0], id)) + if (!getId(texture_override.id, id)) continue; // Ignore unknown node ContentFeatures &nodedef = m_content_features[id]; - if (splitted[1] == "top") - nodedef.tiledef[0].name = splitted[2]; - else if (splitted[1] == "bottom") - nodedef.tiledef[1].name = splitted[2]; - else if (splitted[1] == "right") - nodedef.tiledef[2].name = splitted[2]; - else if (splitted[1] == "left") - nodedef.tiledef[3].name = splitted[2]; - else if (splitted[1] == "back") - nodedef.tiledef[4].name = splitted[2]; - else if (splitted[1] == "front") - nodedef.tiledef[5].name = splitted[2]; - else if (splitted[1] == "all" || splitted[1] == "*") - for (TileDef &i : nodedef.tiledef) - i.name = splitted[2]; - else if (splitted[1] == "sides") - for (int i = 2; i < 6; i++) - nodedef.tiledef[i].name = splitted[2]; - else { - errorstream << override_filepath - << ":" << line_c << " Could not apply texture override \"" - << line << "\": Unknown node side \"" - << splitted[1] << "\"" << std::endl; - continue; - } + if (texture_override.hasTarget(OverrideTarget::TOP)) + nodedef.tiledef[0].name = texture_override.texture; + + if (texture_override.hasTarget(OverrideTarget::BOTTOM)) + nodedef.tiledef[1].name = texture_override.texture; + + if (texture_override.hasTarget(OverrideTarget::RIGHT)) + nodedef.tiledef[2].name = texture_override.texture; + + if (texture_override.hasTarget(OverrideTarget::LEFT)) + nodedef.tiledef[3].name = texture_override.texture; + + if (texture_override.hasTarget(OverrideTarget::BACK)) + nodedef.tiledef[4].name = texture_override.texture; + + if (texture_override.hasTarget(OverrideTarget::FRONT)) + nodedef.tiledef[5].name = texture_override.texture; } } diff --git a/src/nodedef.h b/src/nodedef.h index 1a12aae93..c77d53324 100644 --- a/src/nodedef.h +++ b/src/nodedef.h @@ -33,6 +33,7 @@ class Client; #include "itemgroup.h" #include "sound.h" // SimpleSoundSpec #include "constants.h" // BS +#include "texture_override.h" // TextureOverride #include "tileanimation.h" // PROTOCOL_VERSION >= 37 @@ -583,15 +584,12 @@ public: void updateAliases(IItemDefManager *idef); /*! - * Reads the used texture pack's override.txt, and replaces the textures - * of registered nodes with the ones specified there. + * Replaces the textures of registered nodes with the ones specified in + * the texturepack's override.txt file * - * Format of the input file: in each line - * `node_name top|bottom|right|left|front|back|all|*|sides texture_name.png` - * - * @param override_filepath path to 'texturepack/override.txt' + * @param overrides the texture overrides */ - void applyTextureOverrides(const std::string &override_filepath); + void applyTextureOverrides(const std::vector &overrides); /*! * Only the client uses this. Loads textures and shaders required for diff --git a/src/server.cpp b/src/server.cpp index 85d07fbc4..b3992b9b1 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -373,8 +373,11 @@ void Server::init() std::vector paths; fs::GetRecursiveDirs(paths, g_settings->get("texture_path")); fs::GetRecursiveDirs(paths, m_gamespec.path + DIR_DELIM + "textures"); - for (const std::string &path : paths) - m_nodedef->applyTextureOverrides(path + DIR_DELIM + "override.txt"); + for (const std::string &path : paths) { + TextureOverrideSource override_source(path + DIR_DELIM + "override.txt"); + m_nodedef->applyTextureOverrides(override_source.getNodeTileOverrides()); + m_itemdef->applyTextureOverrides(override_source.getItemTextureOverrides()); + } m_nodedef->setNodeRegistrationStatus(true); diff --git a/src/texture_override.cpp b/src/texture_override.cpp new file mode 100644 index 000000000..10d129b87 --- /dev/null +++ b/src/texture_override.cpp @@ -0,0 +1,120 @@ +/* +Minetest +Copyright (C) 2020 Hugues Ross + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "texture_override.h" + +#include "log.h" +#include "util/string.h" +#include +#include + +TextureOverrideSource::TextureOverrideSource(std::string filepath) +{ + std::ifstream infile(filepath.c_str()); + std::string line; + int line_index = 0; + while (std::getline(infile, line)) { + line_index++; + + // Also trim '\r' on DOS-style files + line = trim(line); + + // Ignore empty lines and comments + if (line.empty() || line[0] == '#') + continue; + + std::vector splitted = str_split(line, ' '); + if (splitted.size() != 3) { + warningstream << filepath << ":" << line_index + << " Syntax error in texture override \"" << line + << "\": Expected 3 arguments, got " << splitted.size() + << std::endl; + continue; + } + + TextureOverride texture_override = {}; + texture_override.id = splitted[0]; + texture_override.texture = splitted[2]; + + // Parse the target mask + std::vector targets = str_split(splitted[1], ','); + for (const std::string &target : targets) { + if (target == "top") + texture_override.target |= static_cast(OverrideTarget::TOP); + else if (target == "bottom") + texture_override.target |= static_cast(OverrideTarget::BOTTOM); + else if (target == "left") + texture_override.target |= static_cast(OverrideTarget::LEFT); + else if (target == "right") + texture_override.target |= static_cast(OverrideTarget::RIGHT); + else if (target == "front") + texture_override.target |= static_cast(OverrideTarget::FRONT); + else if (target == "back") + texture_override.target |= static_cast(OverrideTarget::BACK); + else if (target == "inventory") + texture_override.target |= static_cast(OverrideTarget::INVENTORY); + else if (target == "wield") + texture_override.target |= static_cast(OverrideTarget::WIELD); + else if (target == "sides") + texture_override.target |= static_cast(OverrideTarget::SIDES); + else if (target == "all" || target == "*") + texture_override.target |= static_cast(OverrideTarget::ALL_FACES); + else { + // Report invalid target + warningstream << filepath << ":" << line_index + << " Syntax error in texture override \"" << line + << "\": Unknown target \"" << target << "\"" + << std::endl; + } + } + + // If there are no valid targets, skip adding this override + if (texture_override.target == static_cast(OverrideTarget::INVALID)) { + continue; + } + + m_overrides.push_back(texture_override); + } +} + +//! Get all overrides that apply to item definitions +std::vector TextureOverrideSource::getItemTextureOverrides() +{ + std::vector found_overrides; + + for (const TextureOverride &texture_override : m_overrides) { + if (texture_override.hasTarget(OverrideTarget::ITEM_TARGETS)) + found_overrides.push_back(texture_override); + } + + return found_overrides; +} + +//! Get all overrides that apply to node definitions +std::vector TextureOverrideSource::getNodeTileOverrides() +{ + std::vector found_overrides; + + for (const TextureOverride &texture_override : m_overrides) { + if (texture_override.hasTarget(OverrideTarget::ALL_FACES)) + found_overrides.push_back(texture_override); + } + + return found_overrides; +} diff --git a/src/texture_override.h b/src/texture_override.h new file mode 100644 index 000000000..db03bd014 --- /dev/null +++ b/src/texture_override.h @@ -0,0 +1,72 @@ +/* +Minetest +Copyright (C) 2020 Hugues Ross + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once + +#include "irrlichttypes.h" +#include +#include + +//! Bitmask enum specifying what a texture override should apply to +enum class OverrideTarget : u8 +{ + INVALID = 0, + TOP = 1 << 0, + BOTTOM = 1 << 1, + LEFT = 1 << 2, + RIGHT = 1 << 3, + FRONT = 1 << 4, + BACK = 1 << 5, + INVENTORY = 1 << 6, + WIELD = 1 << 7, + + SIDES = LEFT | RIGHT | FRONT | BACK, + ALL_FACES = TOP | BOTTOM | SIDES, + ITEM_TARGETS = INVENTORY | WIELD, +}; + +struct TextureOverride +{ + std::string id; + std::string texture; + u8 target; + + // Helper function for checking if an OverrideTarget is found in + // a TextureOverride without casting + inline bool hasTarget(OverrideTarget overrideTarget) const + { + return (target & static_cast(overrideTarget)) != 0; + } +}; + +//! Class that provides texture override information from a texture pack +class TextureOverrideSource +{ +public: + TextureOverrideSource(std::string filepath); + + //! Get all overrides that apply to item definitions + std::vector getItemTextureOverrides(); + + //! Get all overrides that apply to node definitions + std::vector getNodeTileOverrides(); + +private: + std::vector m_overrides; +}; diff --git a/util/travis/clang-format-whitelist.txt b/util/travis/clang-format-whitelist.txt index bb97da7b5..02c8b2660 100644 --- a/util/travis/clang-format-whitelist.txt +++ b/util/travis/clang-format-whitelist.txt @@ -423,6 +423,7 @@ src/subgame.cpp src/subgame.h src/terminal_chat_console.cpp src/terminal_chat_console.h +src/texture_override.cpp src/threading/atomic.h src/threading/event.cpp src/threading/mutex_auto_lock.h -- cgit v1.2.3 From 032d90b9f6c9c83a4e1aaf87026ae72167d9ed3e Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 14 Apr 2020 21:22:19 +0200 Subject: Update wireshark dissector (#9621) --- util/wireshark/minetest.lua | 909 ++++++++++++++++++++++++-------------------- 1 file changed, 489 insertions(+), 420 deletions(-) (limited to 'util') diff --git a/util/wireshark/minetest.lua b/util/wireshark/minetest.lua index 1346adbc3..13cd6d482 100644 --- a/util/wireshark/minetest.lua +++ b/util/wireshark/minetest.lua @@ -23,18 +23,39 @@ -- +-- Wireshark documentation: +-- https://web.archive.org/web/20170711121726/https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Proto.html +-- https://web.archive.org/web/20170711121844/https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Tree.html +-- https://web.archive.org/web/20170711121917/https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Tvb.html + + -- Table of Contents: --- Part 1: Client command dissectors (TOSERVER_*) --- Part 2: Server command dissectors (TOCLIENT_*) --- Part 3: Wrapper protocol subdissectors --- Part 4: Wrapper protocol main dissector --- Part 5: Utility functions +-- Part 1: Utility functions +-- Part 2: Client command dissectors (TOSERVER_*) +-- Part 3: Server command dissectors (TOCLIENT_*) +-- Part 4: Wrapper protocol subdissectors +-- Part 5: Wrapper protocol main dissector +-- Part 6: Utility functions part 2 + + +----------------------- +-- Part 1 -- +-- Utility functions -- +----------------------- + +-- Creates two ProtoFields to hold a length and variable-length text content +-- lentype must be either "uint16" or "uint32" +function minetest_field_helper(lentype, name, abbr) + local f_textlen = ProtoField[lentype](name .. "len", abbr .. " (length)", base.DEC) + local f_text = ProtoField.string(name, abbr) + return f_textlen, f_text +end -------------------------------------------- --- Part 1 -- +-- Part 2 -- -- Client command dissectors (TOSERVER_*) -- -------------------------------------------- @@ -42,34 +63,71 @@ minetest_client_commands = {} minetest_client_obsolete = {} -- TOSERVER_INIT -minetest_client_commands[0x02] = { "INIT", 2 } do - local f_ser_fmt = ProtoField.uint8("minetest.client.init_ser_version", + local abbr = "minetest.client.init_" + + local f_ser_fmt = ProtoField.uint8(abbr.."ser_version", "Maximum serialization format version", base.DEC) - local f_player_name = ProtoField.stringz("minetest.client.init_player_name", "Player Name") - local f_password = ProtoField.stringz("minetest.client.init_password", "Password") - local f_version = ProtoField.uint16("minetest.client.init_version", "Version", base.DEC) - - minetest_client_commands[0x10] = { - "INIT_LEGACY", -- Command name - 53, -- Minimum message length including code - { f_ser_fmt, -- List of fields [optional] - f_player_name, - f_password, - f_version }, - function(buffer, pinfo, tree, t) -- Dissector function [optional] + local f_comp_modes = ProtoField.uint16(abbr.."compression", + "Supported compression modes", base.DEC, { [0] = "No compression" }) + local f_proto_min = ProtoField.uint16(abbr.."proto_min", "Minimum protocol version", base.DEC) + local f_proto_max = ProtoField.uint16(abbr.."_proto_max", "Maximum protocol version", base.DEC) + local f_player_namelen, f_player_name = + minetest_field_helper("uint16", abbr.."player_name", "Player Name") + + minetest_client_commands[0x02] = { + "INIT", -- Command name + 11, -- Minimum message length including code + { f_ser_fmt, -- List of fields [optional] + f_comp_modes, + f_proto_min, + f_proto_max, + f_player_namelen, + f_player_name }, + function(buffer, pinfo, tree, t) -- Dissector function [optional] t:add(f_ser_fmt, buffer(2,1)) - t:add(f_player_name, buffer(3,20)) - t:add(f_password, buffer(23,28)) - t:add(f_version, buffer(51,2)) + t:add(f_comp_modes, buffer(3,2)) + t:add(f_proto_min, buffer(5,2)) + t:add(f_proto_max, buffer(7,2)) + minetest_decode_helper_ascii(buffer, t, "uint16", 9, f_player_namelen, f_player_name) end } end +-- TOSERVER_INIT_LEGACY (obsolete) + +minetest_client_commands[0x10] = { "INIT_LEGACY", 53 } +minetest_client_obsolete[0x10] = true + -- TOSERVER_INIT2 -minetest_client_commands[0x11] = { "INIT2", 2 } +do + local f_langlen, f_lang = + minetest_field_helper("uint16", "minetest.client.init2_language", "Language Code") + + minetest_client_commands[0x11] = { + "INIT2", + 2, + { f_langlen, + f_lang }, + function(buffer, pinfo, tree, t) + minetest_decode_helper_ascii(buffer, t, "uint16", 2, f_langlen, f_lang) + end + } +end + +-- TOSERVER_MODCHANNEL_JOIN + +minetest_client_commands[0x17] = { "MODCHANNEL_JOIN", 2 } + +-- TOSERVER_MODCHANNEL_LEAVE + +minetest_client_commands[0x18] = { "MODCHANNEL_LEAVE", 2 } + +-- TOSERVER_MODCHANNEL_MSG + +minetest_client_commands[0x19] = { "MODCHANNEL_MSG", 2 } -- TOSERVER_GETBLOCK (obsolete) @@ -89,18 +147,24 @@ minetest_client_obsolete[0x22] = true -- TOSERVER_PLAYERPOS do - local f_x = ProtoField.int32("minetest.client.playerpos_x", "Position X", base.DEC) - local f_y = ProtoField.int32("minetest.client.playerpos_y", "Position Y", base.DEC) - local f_z = ProtoField.int32("minetest.client.playerpos_z", "Position Z", base.DEC) - local f_speed_x = ProtoField.int32("minetest.client.playerpos_speed_x", "Speed X", base.DEC) - local f_speed_y = ProtoField.int32("minetest.client.playerpos_speed_y", "Speed Y", base.DEC) - local f_speed_z = ProtoField.int32("minetest.client.playerpos_speed_z", "Speed Z", base.DEC) - local f_pitch = ProtoField.int32("minetest.client.playerpos_pitch", "Pitch", base.DEC) - local f_yaw = ProtoField.int32("minetest.client.playerpos_yaw", "Yaw", base.DEC) + local abbr = "minetest.client.playerpos_" + + local f_x = ProtoField.int32(abbr.."x", "Position X", base.DEC) + local f_y = ProtoField.int32(abbr.."y", "Position Y", base.DEC) + local f_z = ProtoField.int32(abbr.."z", "Position Z", base.DEC) + local f_speed_x = ProtoField.int32(abbr.."speed_x", "Speed X", base.DEC) + local f_speed_y = ProtoField.int32(abbr.."speed_y", "Speed Y", base.DEC) + local f_speed_z = ProtoField.int32(abbr.."speed_z", "Speed Z", base.DEC) + local f_pitch = ProtoField.int32(abbr.."pitch", "Pitch", base.DEC) + local f_yaw = ProtoField.int32(abbr.."yaw", "Yaw", base.DEC) + local f_key_pressed = ProtoField.bytes(abbr.."key_pressed", "Pressed keys") + local f_fov = ProtoField.uint8(abbr.."fov", "FOV", base.DEC) + local f_wanted_range = ProtoField.uint8(abbr.."wanted_range", "Requested view range", base.DEC) minetest_client_commands[0x23] = { "PLAYERPOS", 34, - { f_x, f_y, f_z, f_speed_x, f_speed_y, f_speed_z, f_pitch, f_yaw }, + { f_x, f_y, f_z, f_speed_x, f_speed_y, f_speed_z, f_pitch, f_yaw, + f_key_pressed, f_fov, f_wanted_range }, function(buffer, pinfo, tree, t) t:add(f_x, buffer(2,4)) t:add(f_y, buffer(6,4)) @@ -110,6 +174,9 @@ do t:add(f_speed_z, buffer(22,4)) t:add(f_pitch, buffer(26,4)) t:add(f_yaw, buffer(30,4)) + t:add(f_key_pressed, buffer(34,4)) + t:add(f_fov, buffer(38,1)) + t:add(f_wanted_range, buffer(39,1)) end } end @@ -148,7 +215,6 @@ do end -- TOSERVER_DELETEDBLOCKS --- TODO: Test this do local f_count = ProtoField.uint8("minetest.client.deletedblocks_count", "Count", base.DEC) @@ -186,122 +252,25 @@ end minetest_client_commands[0x26] = { "ADDNODE_FROM_INVENTORY", 2 } minetest_client_obsolete[0x26] = true --- TOSERVER_CLICK_OBJECT --- TODO: Test this - -do - local vs_button = { - [0] = "left", - [1] = "right" - } - - local f_button = ProtoField.uint8("minetest.client.click_object_button", "Button", base.DEC, vs_button) - local f_blockpos_x = ProtoField.int16("minetest.client.click_object_blockpos_x", "Block position X", base.DEC) - local f_blockpos_y = ProtoField.int16("minetest.client.click_object_blockpos_y", "Block position Y", base.DEC) - local f_blockpos_z = ProtoField.int16("minetest.client.click_object_blockpos_z", "Block position Z", base.DEC) - local f_id = ProtoField.int16("minetest.client.click_object_id", "ID", base.DEC) - local f_item = ProtoField.uint16("minetest.client.click_object_item", "Item", base.DEC) - - minetest_client_commands[0x27] = { - "CLICK_OBJECT", 13, - { f_button, f_blockpos_x, f_blockpos_y, f_blockpos_z, f_id, f_item }, - function(buffer, pinfo, tree, t) - t:add(f_button, buffer(2,1)) - t:add(f_blockpos_x, buffer(3,2)) - t:add(f_blockpos_y, buffer(5,2)) - t:add(f_blockpos_z, buffer(7,2)) - t:add(f_id, buffer(9,2)) - t:add(f_item, buffer(11,2)) - end - } -end - --- TOSERVER_GROUND_ACTION +-- TOSERVER_CLICK_OBJECT (obsolete) -do - local vs_action = { - [0] = "Start digging", - [1] = "Place block", - [2] = "Stop digging", - [3] = "Digging completed" - } +minetest_client_commands[0x27] = { "CLICK_OBJECT", 2 } +minetest_client_obsolete[0x27] = true - local f_action = ProtoField.uint8("minetest.client.ground_action", "Action", base.DEC, vs_action) - local f_nodepos_undersurface_x = ProtoField.int16( - "minetest.client.ground_action_nodepos_undersurface_x", - "Node position (under surface) X") - local f_nodepos_undersurface_y = ProtoField.int16( - "minetest.client.ground_action_nodepos_undersurface_y", - "Node position (under surface) Y") - local f_nodepos_undersurface_z = ProtoField.int16( - "minetest.client.ground_action_nodepos_undersurface_z", - "Node position (under surface) Z") - local f_nodepos_abovesurface_x = ProtoField.int16( - "minetest.client.ground_action_nodepos_abovesurface_x", - "Node position (above surface) X") - local f_nodepos_abovesurface_y = ProtoField.int16( - "minetest.client.ground_action_nodepos_abovesurface_y", - "Node position (above surface) Y") - local f_nodepos_abovesurface_z = ProtoField.int16( - "minetest.client.ground_action_nodepos_abovesurface_z", - "Node position (above surface) Z") - local f_item = ProtoField.uint16("minetest.client.ground_action_item", "Item") +-- TOSERVER_GROUND_ACTION (obsolete) - minetest_client_commands[0x28] = { - "GROUND_ACTION", 17, - { f_action, - f_nodepos_undersurface_x, - f_nodepos_undersurface_y, - f_nodepos_undersurface_z, - f_nodepos_abovesurface_x, - f_nodepos_abovesurface_y, - f_nodepos_abovesurface_z, - f_item }, - function(buffer, pinfo, tree, t) - t:add(f_action, buffer(2,1)) - t:add(f_nodepos_undersurface_x, buffer(3,2)) - t:add(f_nodepos_undersurface_y, buffer(5,2)) - t:add(f_nodepos_undersurface_z, buffer(7,2)) - t:add(f_nodepos_abovesurface_x, buffer(9,2)) - t:add(f_nodepos_abovesurface_y, buffer(11,2)) - t:add(f_nodepos_abovesurface_z, buffer(13,2)) - t:add(f_item, buffer(15,2)) - end - } -end +minetest_client_commands[0x28] = { "GROUND_ACTION", 2 } +minetest_client_obsolete[0x28] = true -- TOSERVER_RELEASE (obsolete) minetest_client_commands[0x29] = { "RELEASE", 2 } minetest_client_obsolete[0x29] = true --- TOSERVER_SIGNTEXT (old signs) --- TODO: Test this or mark obsolete +-- TOSERVER_SIGNTEXT (obsolete) -do - local f_blockpos_x = ProtoField.int16("minetest.client.signtext_blockpos_x", "Block position X", base.DEC) - local f_blockpos_y = ProtoField.int16("minetest.client.signtext_blockpos_y", "Block position Y", base.DEC) - local f_blockpos_z = ProtoField.int16("minetest.client.signtext_blockpos_z", "Block position Z", base.DEC) - local f_id = ProtoField.int16("minetest.client.signtext_id", "ID", base.DEC) - local f_textlen = ProtoField.uint16("minetest.client.signtext_textlen", "Text length", base.DEC) - local f_text = ProtoField.string("minetest.client.signtext_text", "Text") - - minetest_client_commands[0x30] = { - "SIGNTEXT", 12, - { f_blockpos_x, f_blockpos_y, f_blockpos_z, f_id, f_textlen, f_text }, - function(buffer, pinfo, tree, t) - t:add(f_blockpos_x, buffer(2,2)) - t:add(f_blockpos_y, buffer(4,2)) - t:add(f_blockpos_z, buffer(6,2)) - t:add(f_id, buffer(8,2)) - t:add(f_textlen, buffer(10,2)) - local textlen = buffer(10,2):uint() - if minetest_check_length(buffer, 12 + textlen, t) then - t:add(f_text, buffer, buffer(12,textlen)) - end - end - } -end +minetest_client_commands[0x30] = { "SIGNTEXT", 2 } +minetest_client_obsolete[0x30] = true -- TOSERVER_INVENTORY_ACTION @@ -336,53 +305,16 @@ do } end --- TOSERVER_SIGNNODETEXT +-- TOSERVER_SIGNNODETEXT (obsolete) -do - local f_pos_x = ProtoField.int16("minetest.client.signnodetext_pos_x", "Block position X", base.DEC) - local f_pos_y = ProtoField.int16("minetest.client.signnodetext_pos_y", "Block position Y", base.DEC) - local f_pos_z = ProtoField.int16("minetest.client.signnodetext_pos_z", "Block position Z", base.DEC) - local f_textlen = ProtoField.uint16("minetest.client.signnodetext_textlen", "Text length", base.DEC) - local f_text = ProtoField.string("minetest.client.signnodetext_text", "Text") - - minetest_client_commands[0x33] = { - "SIGNNODETEXT", 10, - { f_pos_x, f_pos_y, f_pos_z, f_textlen, f_text }, - function(buffer, pinfo, tree, t) - t:add(f_pos_x, buffer(2,2)) - t:add(f_pos_y, buffer(4,2)) - t:add(f_pos_z, buffer(6,2)) - t:add(f_textlen, buffer(8,2)) - local textlen = buffer(8,2):uint() - if minetest_check_length(buffer, 10 + textlen, t) then - t:add(f_text, buffer(10, textlen)) - end - end - } -end +minetest_client_commands[0x33] = { "SIGNNODETEXT", 2 } +minetest_client_obsolete[0x33] = true --- TOSERVER_CLICK_ACTIVEOBJECT -do - local vs_button = { - [0] = "left", - [1] = "right" - } +-- TOSERVER_CLICK_ACTIVEOBJECT (obsolete) - local f_button = ProtoField.uint8("minetest.client.click_activeobject_button", "Button", base.DEC, vs_button) - local f_id = ProtoField.uint16("minetest.client.click_activeobject_id", "ID", base.DEC) - local f_item = ProtoField.uint16("minetest.client.click_activeobject_item", "Item", base.DEC) - - minetest_client_commands[0x34] = { - "CLICK_ACTIVEOBJECT", 7, - { f_button, f_id, f_item }, - function(buffer, pinfo, tree, t) - t:add(f_button, buffer(2,1)) - t:add(f_id, buffer(3,2)) - t:add(f_item, buffer(5,2)) - end - } -end +minetest_client_commands[0x34] = { "CLICK_ACTIVEOBJECT", 2 } +minetest_client_obsolete[0x34] = true -- TOSERVER_DAMAGE @@ -398,21 +330,10 @@ do } end --- TOSERVER_PASSWORD - -do - local f_old_password = ProtoField.string("minetest.client.password_old", "Old password") - local f_new_password = ProtoField.string("minetest.client.password_new", "New password") +-- TOSERVER_PASSWORD (obsolete) - minetest_client_commands[0x36] = { - "PASSWORD", 58, - { f_old_password, f_new_password }, - function(buffer, pinfo, tree, t) - t:add(f_old_password, buffer(2,28)) - t:add(f_new_password, buffer(30,28)) - end - } -end +minetest_client_commands[0x36] = { "CLICK_ACTIVEOBJECT", 2 } +minetest_client_obsolete[0x36] = true -- TOSERVER_PLAYERITEM @@ -429,16 +350,135 @@ do end -- TOSERVER_RESPAWN + minetest_client_commands[0x38] = { "RESPAWN", 2 } -minetest_client_commands[0x39] = { "INTERACT", 2 } +-- TOSERVER_INTERACT + +do + local abbr = "minetest.client.interact_" + local vs_action = { + [0] = "Start digging", + [1] = "Stop digging", + [2] = "Digging completed", + [3] = "Place block or item", + [4] = "Use item", + [5] = "Activate held item", + } + local vs_pointed_type = { + [0] = "Nothing", + [1] = "Node", + [2] = "Object", + } + + local f_action = ProtoField.uint8(abbr.."action", "Action", base.DEC, vs_action) + local f_item = ProtoField.uint16(abbr.."item", "Item Index", base.DEC) + local f_plen = ProtoField.uint32(abbr.."plen", "Length of pointed thing", base.DEC) + local f_pointed_version = ProtoField.uint8(abbr.."pointed_version", + "Pointed Thing Version", base.DEC) + local f_pointed_type = ProtoField.uint8(abbr.."pointed_version", + "Pointed Thing Type", base.DEC, vs_pointed_type) + local f_pointed_under_x = ProtoField.int16(abbr.."pointed_under_x", + "Node position (under surface) X") + local f_pointed_under_y = ProtoField.int16(abbr.."pointed_under_y", + "Node position (under surface) Y") + local f_pointed_under_z = ProtoField.int16(abbr.."pointed_under_z", + "Node position (under surface) Z") + local f_pointed_above_x = ProtoField.int16(abbr.."pointed_above_x", + "Node position (above surface) X") + local f_pointed_above_y = ProtoField.int16(abbr.."pointed_above_y", + "Node position (above surface) Y") + local f_pointed_above_z = ProtoField.int16(abbr.."pointed_above_z", + "Node position (above surface) Z") + local f_pointed_object_id = ProtoField.int16(abbr.."pointed_object_id", + "Object ID") + -- mising: additional playerpos data just like in TOSERVER_PLAYERPOS + + minetest_client_commands[0x39] = { + "INTERACT", 11, + { f_action, + f_item, + f_plen, + f_pointed_version, + f_pointed_type, + f_pointed_under_x, + f_pointed_under_y, + f_pointed_under_z, + f_pointed_above_x, + f_pointed_above_y, + f_pointed_above_z, + f_pointed_object_id }, + function(buffer, pinfo, tree, t) + t:add(f_action, buffer(2,1)) + t:add(f_item, buffer(3,2)) + t:add(f_plen, buffer(5,4)) + local plen = buffer(5,4):uint() + if minetest_check_length(buffer, 9 + plen, t) then + t:add(f_pointed_version, buffer(9,1)) + t:add(f_pointed_type, buffer(10,1)) + local ptype = buffer(10,1):uint() + if ptype == 1 then -- Node + t:add(f_pointed_under_x, buffer(11,2)) + t:add(f_pointed_under_y, buffer(13,2)) + t:add(f_pointed_under_z, buffer(15,2)) + t:add(f_pointed_above_x, buffer(17,2)) + t:add(f_pointed_above_x, buffer(19,2)) + t:add(f_pointed_above_x, buffer(21,2)) + elseif ptype == 2 then -- Object + t:add(f_pointed_object_id, buffer(11,2)) + end + end + end + } +end + +-- ... + minetest_client_commands[0x3a] = { "REMOVED_SOUNDS", 2 } minetest_client_commands[0x3b] = { "NODEMETA_FIELDS", 2 } minetest_client_commands[0x3c] = { "INVENTORY_FIELDS", 2 } minetest_client_commands[0x40] = { "REQUEST_MEDIA", 2 } minetest_client_commands[0x41] = { "RECEIVED_MEDIA", 2 } + +-- TOSERVER_BREATH (obsolete) + minetest_client_commands[0x42] = { "BREATH", 2 } -minetest_client_commands[0x43] = { "CLIENT_READY", 2 } +minetest_client_obsolete[0x42] = true + +-- TOSERVER_CLIENT_READY + +do + local abbr = "minetest.client.client_ready_" + local f_major = ProtoField.uint8(abbr.."major","Version Major") + local f_minor = ProtoField.uint8(abbr.."minor","Version Minor") + local f_patch = ProtoField.uint8(abbr.."patch","Version Patch") + local f_reserved = ProtoField.uint8(abbr.."reserved","Reserved") + local f_versionlen, f_version = + minetest_field_helper("uint16", abbr.."version", "Full Version String") + local f_formspec_ver = ProtoField.uint16(abbr.."formspec_version", + "Formspec API version") + + minetest_client_commands[0x43] = { + "CLIENT_READY", + 8, + { f_major, f_minor, f_patch, f_reserved, f_versionlen, + f_version, f_formspec_ver }, + function(buffer, pinfo, tree, t) + t:add(f_major, buffer(2,1)) + t:add(f_minor, buffer(3,1)) + t:add(f_patch, buffer(4,1)) + t:add(f_reserved, buffer(5,1)) + local off = minetest_decode_helper_ascii(buffer, t, "uint16", 6, + f_versionlen, f_version) + if off and minetest_check_length(buffer, off + 2, t) then + t:add(f_formspec_ver, buffer(off,2)) + end + end + } +end + +-- ... + minetest_client_commands[0x50] = { "FIRST_SRP", 2 } minetest_client_commands[0x51] = { "SRP_BYTES_A", 2 } minetest_client_commands[0x52] = { "SRP_BYTES_M", 2 } @@ -446,41 +486,85 @@ minetest_client_commands[0x52] = { "SRP_BYTES_M", 2 } -------------------------------------------- --- Part 2 -- +-- Part 3 -- -- Server command dissectors (TOCLIENT_*) -- -------------------------------------------- minetest_server_commands = {} minetest_server_obsolete = {} --- TOCLIENT_INIT +-- TOCLIENT_HELLO -minetest_server_commands[0x02] = {"HELLO", 2} -minetest_server_commands[0x03] = {"AUTH_ACCEPT", 2} -minetest_server_commands[0x04] = {"ACCEPT_SUDO_MODE", 2} -minetest_server_commands[0x05] = {"DENY_SUDO_MODE", 2} -minetest_server_commands[0x0A] = {"ACCESS_DENIED", 2} +do + local abbr = "minetest.server.hello_" + + local f_ser_fmt = ProtoField.uint8(abbr.."ser_version", + "Deployed serialization format version", base.DEC) + local f_comp_mode = ProtoField.uint16(abbr.."compression", + "Deployed compression mode", base.DEC, { [0] = "No compression" }) + local f_proto = ProtoField.uint16(abbr.."proto", + "Deployed protocol version", base.DEC) + local f_auth_methods = ProtoField.bytes(abbr.."auth_modes", + "Supported authentication modes") + local f_legacy_namelen, f_legacy_name = minetest_field_helper("uint16", + abbr.."legacy_name", "Legacy player name for hashing") + + minetest_server_commands[0x02] = { + "HELLO", + 13, + { f_ser_fmt, f_comp_mode, f_proto, f_auth_methods, + f_legacy_namelen, f_legacy_name }, + function(buffer, pinfo, tree, t) + t:add(f_ser_fmt, buffer(2,1)) + t:add(f_comp_mode, buffer(3,2)) + t:add(f_proto, buffer(5,2)) + t:add(f_auth_methods, buffer(7,4)) + minetest_decode_helper_ascii(buffer, t, "uint16", 11, f_legacy_namelen, f_legacy_name) + end + } +end + +-- TOCLIENT_AUTH_ACCEPT do - local f_version = ProtoField.uint8("minetest.server.init_version", "Deployed version", base.DEC) - local f_pos_x = ProtoField.int16("minetest.server.init_pos_x", "Position X", base.DEC) - local f_pos_y = ProtoField.int16("minetest.server.init_pos_y", "Position Y", base.DEC) - local f_pos_z = ProtoField.int16("minetest.server.init_pos_x", "Position Z", base.DEC) - local f_map_seed = ProtoField.uint64("minetest.server.init_map_seed", "Map seed", base.DEC) - - minetest_server_commands[0x10] = { - "INIT", 17, - { f_version, f_pos_x, f_pos_y, f_pos_z, f_map_seed }, + local abbr = "minetest.server.auth_accept_" + + local f_player_x = ProtoField.float(abbr.."player_x", "Player position X") + local f_player_y = ProtoField.float(abbr.."player_y", "Player position Y") + local f_player_z = ProtoField.float(abbr.."player_z", "Player position Z") + local f_map_seed = ProtoField.uint64(abbr.."map_seed", "Map seed") + local f_send_interval = ProtoField.float(abbr.."send_interval", + "Recommended send interval") + local f_sudo_auth_methods = ProtoField.bytes(abbr.."sudo_auth_methods", + "Supported auth methods for sudo mode") + + minetest_server_commands[0x03] = { + "AUTH_ACCEPT", + 30, + { f_player_x, f_player_y, f_player_z, f_map_seed, + f_send_interval, f_sudo_auth_methods }, function(buffer, pinfo, tree, t) - t:add(f_version, buffer(2,1)) - t:add(f_pos_x, buffer(3,2)) - t:add(f_pos_y, buffer(5,2)) - t:add(f_pos_z, buffer(7,2)) - t:add(f_map_seed, buffer(9,8)) + t:add(f_player_x, buffer(2,4)) + t:add(f_player_y, buffer(6,4)) + t:add(f_player_z, buffer(10,4)) + t:add(f_map_seed, buffer(14,8)) + t:add(f_send_interval, buffer(22,4)) + t:add(f_sudo_auth_methods, buffer(26,4)) end } end +-- ... + +minetest_server_commands[0x04] = {"ACCEPT_SUDO_MODE", 2} +minetest_server_commands[0x05] = {"DENY_SUDO_MODE", 2} +minetest_server_commands[0x0A] = {"ACCESS_DENIED", 2} + +-- TOCLIENT_INIT (obsolete) + +minetest_server_commands[0x10] = { "INIT", 2 } +minetest_server_obsolete[0x10] = true + -- TOCLIENT_BLOCKDATA do @@ -544,37 +628,10 @@ end minetest_server_commands[0x23] = { "PLAYERPOS", 2 } minetest_server_obsolete[0x23] = true --- TOCLIENT_PLAYERINFO +-- TOCLIENT_PLAYERINFO (obsolete) -do - local f_count = ProtoField.uint16("minetest.server.playerinfo_count", "Count", base.DEC) - local f_player = ProtoField.bytes("minetest.server.playerinfo_player", "Player", base.NONE) - local f_peer_id = ProtoField.uint16("minetest.server.playerinfo_peer_id", "Peer ID", base.DEC) - local f_name = ProtoField.string("minetest.server.playerinfo_name", "Name") - - minetest_server_commands[0x24] = { - "PLAYERINFO", 2, - { f_count, f_player, f_peer_id, f_name }, - function(buffer, pinfo, tree, t) - local count = 0 - local pos, index - for pos = 2, buffer:len() - 22, 22 do -- does lua have integer division? - count = count + 1 - end - t:add(f_count, count):set_generated() - t:set_len(2 + 22 * count) - pinfo.cols.info:append(" * " .. count) - for index = 0, count - 1 do - local pos = 2 + 22 * index - local t2 = t:add(f_player, buffer(pos, 22)) - t2:set_text("Player, ID: " .. buffer(pos, 2):uint() - .. ", Name: " .. buffer(pos + 2, 20):string()) - t2:add(f_peer_id, buffer(pos, 2)) - t2:add(f_name, buffer(pos + 2, 20)) - end - end - } -end +minetest_server_commands[0x24] = { "PLAYERINFO", 2 } +minetest_server_obsolete[0x24] = true -- TOCLIENT_OPT_BLOCK_NOT_FOUND (obsolete) @@ -600,100 +657,74 @@ do } end --- TOCLIENT_OBJECTDATA - -do - local f_player_count = ProtoField.uint16("minetest.server.objectdata_player_count", - "Count of player positions", base.DEC) - local f_player = ProtoField.bytes("minetest.server.objectdata_player", "Player position") - local f_peer_id = ProtoField.uint16("minetest.server.objectdata_player_peer_id", "Peer ID") - local f_x = ProtoField.int32("minetest.server.objectdata_player_x", "Position X", base.DEC) - local f_y = ProtoField.int32("minetest.server.objectdata_player_y", "Position Y", base.DEC) - local f_z = ProtoField.int32("minetest.server.objectdata_player_z", "Position Z", base.DEC) - local f_speed_x = ProtoField.int32("minetest.server.objectdata_player_speed_x", "Speed X", base.DEC) - local f_speed_y = ProtoField.int32("minetest.server.objectdata_player_speed_y", "Speed Y", base.DEC) - local f_speed_z = ProtoField.int32("minetest.server.objectdata_player_speed_z", "Speed Z", base.DEC) - local f_pitch = ProtoField.int32("minetest.server.objectdata_player_pitch", "Pitch", base.DEC) - local f_yaw = ProtoField.int32("minetest.server.objectdata_player_yaw", "Yaw", base.DEC) - local f_block_count = ProtoField.uint16("minetest.server.objectdata_block_count", - "Count of blocks", base.DEC) - - minetest_server_commands[0x28] = { - "OBJECTDATA", 6, - { f_player_count, f_player, f_peer_id, f_x, f_y, f_z, - f_speed_x, f_speed_y, f_speed_z,f_pitch, f_yaw, - f_block_count }, - function(buffer, pinfo, tree, t) - local t2, index, pos - - local player_count_pos = 2 - local player_count = buffer(player_count_pos, 2):uint() - t:add(f_player_count, buffer(player_count_pos, 2)) - - local block_count_pos = player_count_pos + 2 + 34 * player_count - if not minetest_check_length(buffer, block_count_pos + 2, t) then - return - end - - for index = 0, player_count - 1 do - pos = player_count_pos + 2 + 34 * index - t2 = t:add(f_player, buffer(pos, 34)) - t2:set_text("Player position, ID: " .. buffer(pos, 2):uint()) - t2:add(f_peer_id, buffer(pos, 2)) - t2:add(f_x, buffer(pos + 2, 4)) - t2:add(f_y, buffer(pos + 6, 4)) - t2:add(f_z, buffer(pos + 10, 4)) - t2:add(f_speed_x, buffer(pos + 14, 4)) - t2:add(f_speed_y, buffer(pos + 18, 4)) - t2:add(f_speed_z, buffer(pos + 22, 4)) - t2:add(f_pitch, buffer(pos + 26, 4)) - t2:add(f_yaw, buffer(pos + 30, 4)) - end - - local block_count = buffer(block_count_pos, 2):uint() - t:add(f_block_count, buffer(block_count_pos, 2)) +-- TOCLIENT_OBJECTDATA (obsolete) - -- TODO: dissect blocks. - -- NOTE: block_count > 0 is obsolete. (?) - - pinfo.cols.info:append(" * " .. (player_count + block_count)) - end - } -end +minetest_server_commands[0x28] = { "OBJECTDATA", 2 } +minetest_server_obsolete[0x28] = true -- TOCLIENT_TIME_OF_DAY do local f_time = ProtoField.uint16("minetest.server.time_of_day", "Time", base.DEC) + local f_time_speed = ProtoField.float("minetest.server.time_speed", "Time Speed", base.DEC) minetest_server_commands[0x29] = { "TIME_OF_DAY", 4, - { f_time }, + { f_time, f_time_speed }, function(buffer, pinfo, tree, t) t:add(f_time, buffer(2,2)) + t:add(f_time_speed, buffer(4,4)) end } end +-- TOCLIENT_CSM_RESTRICTION_FLAGS + +minetest_server_commands[0x2a] = { "CSM_RESTRICTION_FLAGS", 2 } + +-- TOCLIENT_PLAYER_SPEED + +minetest_server_commands[0x2b] = { "PLAYER_SPEED", 2 } + -- TOCLIENT_CHAT_MESSAGE do - local f_length = ProtoField.uint16("minetest.server.chat_message_length", "Length", base.DEC) - local f_message = ProtoField.string("minetest.server.chat_message", "Message") + local abbr = "minetest.server.chat_message_" + local vs_type = { + [0] = "Raw", + [1] = "Normal", + [2] = "Announce", + [3] = "System", + } - minetest_server_commands[0x30] = { - "CHAT_MESSAGE", 4, - { f_length, f_message }, + local f_version = ProtoField.uint8(abbr.."version", "Version") + local f_type = ProtoField.uint8(abbr.."type", "Message Type", base.DEC, vs_type) + local f_senderlen, f_sender = minetest_field_helper("uint16", abbr.."sender", + "Message sender") + local f_messagelen, f_message = minetest_field_helper("uint16", abbr:sub(1,-2), + "Message") + + minetest_server_commands[0x2f] = { + "CHAT_MESSAGE", 8, + { f_version, f_type, f_senderlen, f_sender, + f_messagelen, f_message }, function(buffer, pinfo, tree, t) - t:add(f_length, buffer(2,2)) - local textlen = buffer(2,2):uint() - if minetest_check_length(buffer, 4 + textlen*2, t) then - t:add(f_message, minetest_convert_utf16(buffer(4, textlen*2), "Converted chat message")) + t:add(f_version, buffer(2,1)) + t:add(f_type, buffer(3,1)) + local off = 4 + off = minetest_decode_helper_utf16(buffer, t, "uint16", off, f_senderlen, f_sender) + if off then + off = minetest_decode_helper_utf16(buffer, t, "uint16", off, f_messagelen, f_message) end end } end +-- TOCLIENT_CHAT_MESSAGE_OLD (obsolete) + +minetest_server_commands[0x30] = { "CHAT_MESSAGE_OLD", 2 } +minetest_server_obsolete[0x30] = true + -- TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD do @@ -842,13 +873,13 @@ end -- TOCLIENT_HP do - local f_hp = ProtoField.uint8("minetest.server.hp", "Hitpoints", base.DEC) + local f_hp = ProtoField.uint16("minetest.server.hp", "Hitpoints", base.DEC) minetest_server_commands[0x33] = { - "HP", 3, + "HP", 4, { f_hp }, function(buffer, pinfo, tree, t) - t:add(f_hp, buffer(2,1)) + t:add(f_hp, buffer(2,2)) end } end @@ -856,45 +887,35 @@ end -- TOCLIENT_MOVE_PLAYER do - local f_x = ProtoField.int32("minetest.server.move_player_x", "Position X", base.DEC) - local f_y = ProtoField.int32("minetest.server.move_player_y", "Position Y", base.DEC) - local f_z = ProtoField.int32("minetest.server.move_player_z", "Position Z", base.DEC) - local f_pitch = ProtoField.int32("minetest.server.move_player_pitch", "Pitch", base.DEC) - local f_yaw = ProtoField.int32("minetest.server.move_player_yaw", "Yaw", base.DEC) - local f_garbage = ProtoField.bytes("minetest.server.move_player_garbage", "Garbage") + local abbr = "minetest.server.move_player_" + + local f_x = ProtoField.float(abbr.."x", "Position X") + local f_y = ProtoField.float(abbr.."y", "Position Y") + local f_z = ProtoField.float(abbr.."z", "Position Z") + local f_pitch = ProtoField.float(abbr.."_pitch", "Pitch") + local f_yaw = ProtoField.float(abbr.."yaw", "Yaw") minetest_server_commands[0x34] = { - "MOVE_PLAYER", 18, -- actually 22, but see below + "MOVE_PLAYER", 22, { f_x, f_y, f_z, f_pitch, f_yaw, f_garbage }, function(buffer, pinfo, tree, t) t:add(f_x, buffer(2, 4)) t:add(f_y, buffer(6, 4)) t:add(f_z, buffer(10, 4)) - - -- Compatibility note: - -- Up to 2011-08-23, there was a bug in Minetest that - -- caused the server to serialize the pitch and yaw - -- with 2 bytes each instead of 4, creating a - -- malformed message. - if buffer:len() >= 22 then - t:add(f_pitch, buffer(14, 4)) - t:add(f_yaw, buffer(18, 4)) - else - t:add(f_garbage, buffer(14, 4)) - t:add_expert_info(PI_MALFORMED, PI_WARN, "Malformed pitch and yaw, possibly caused by a serialization bug in Minetest") - end + t:add(f_pitch, buffer(14, 4)) + t:add(f_yaw, buffer(18, 4)) end } end --- TOCLIENT_ACCESS_DENIED +-- TOCLIENT_ACCESS_DENIED_LEGACY do local f_reason_length = ProtoField.uint16("minetest.server.access_denied_reason_length", "Reason length", base.DEC) local f_reason = ProtoField.string("minetest.server.access_denied_reason", "Reason") minetest_server_commands[0x35] = { - "ACCESS_DENIED", 4, + "ACCESS_DENIED_LEGACY", 4, { f_reason_length, f_reason }, function(buffer, pinfo, tree, t) t:add(f_reason_length, buffer(2,2)) @@ -906,68 +927,16 @@ do } end --- TOCLIENT_PLAYERITEM +-- TOCLIENT_FOV -do - local f_count = ProtoField.uint16( - "minetest.server.playeritem_count", - "Count of players", base.DEC) - local f_player = ProtoField.bytes( - "minetest.server.playeritem_player", - "Player") - local f_peer_id = ProtoField.uint16( - "minetest.server.playeritem_peer_id", - "Peer ID", base.DEC) - local f_item_length = ProtoField.uint16( - "minetest.server.playeritem_item_length", - "Item information length", base.DEC) - local f_item = ProtoField.string( - "minetest.server.playeritem_item", - "Item information") - - minetest_server_commands[0x36] = { - "PLAYERITEM", 4, - { f_count, f_player, f_peer_id, f_item_length, f_item }, - function(buffer, pinfo, tree, t) - local count, index, pos, item_length - - count = buffer(2,2):uint() - pinfo.cols.info:append(" * " .. count) - t:add(f_count, buffer(2,2)) - - pos = 4 - for index = 0, count - 1 do - if not minetest_check_length(buffer, pos + 4, t) then - return - end - item_length = buffer(pos + 2, 2):uint() - if not minetest_check_length(buffer, pos + 4 + item_length, t) then - return - end - - local t2 = t:add(f_player, buffer(pos, 4 + item_length)) - t2:set_text("Player, ID: " .. buffer(pos, 2):uint()) - t2:add(f_peer_id, buffer(pos, 2)) - t2:add(f_item_length, buffer(pos + 2, 2)) - t2:add(f_item, buffer(pos + 4, item_length)) - - pos = pos + 4 + item_length - end - end - } -end +minetest_server_commands[0x36] = { "FOV", 2 } -- TOCLIENT_DEATHSCREEN do - local vs_set_camera_point_target = { - [0] = "False", - [1] = "True" - } - - local f_set_camera_point_target = ProtoField.uint8( + local f_set_camera_point_target = ProtoField.bool( "minetest.server.deathscreen_set_camera_point_target", - "Set camera point target", base.DEC, vs_set_camera_point_target) + "Set camera point target") local f_camera_point_target_x = ProtoField.int32( "minetest.server.deathscreen_camera_point_target_x", "Camera point target X", base.DEC) @@ -991,10 +960,26 @@ do } end +-- TOCLIENT_MEDIA + minetest_server_commands[0x38] = {"MEDIA", 2} + +-- TOCLIENT_TOOLDEF (obsolete) + minetest_server_commands[0x39] = {"TOOLDEF", 2} +minetest_server_obsolete[0x39] = true + +-- TOCLIENT_NODEDEF + minetest_server_commands[0x3a] = {"NODEDEF", 2} + +-- TOCLIENT_CRAFTITEMDEF (obsolete) + minetest_server_commands[0x3b] = {"CRAFTITEMDEF", 2} +minetest_server_obsolete[0x3b] = true + +-- ... + minetest_server_commands[0x3c] = {"ANNOUNCE_MEDIA", 2} minetest_server_commands[0x3d] = {"ITEMDEF", 2} minetest_server_commands[0x3f] = {"PLAY_SOUND", 2} @@ -1006,7 +991,14 @@ minetest_server_commands[0x44] = {"SHOW_FORMSPEC", 2} minetest_server_commands[0x45] = {"MOVEMENT", 2} minetest_server_commands[0x46] = {"SPAWN_PARTICLE", 2} minetest_server_commands[0x47] = {"ADD_PARTICLE_SPAWNER", 2} + +-- TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY (obsolete) + minetest_server_commands[0x48] = {"DELETE_PARTICLESPAWNER_LEGACY", 2} +minetest_server_obsolete[0x48] = true + +-- ... + minetest_server_commands[0x49] = {"HUDADD", 2} minetest_server_commands[0x4a] = {"HUDRM", 2} minetest_server_commands[0x4b] = {"HUDCHANGE", 2} @@ -1020,11 +1012,57 @@ minetest_server_commands[0x52] = {"EYE_OFFSET", 2} minetest_server_commands[0x53] = {"DELETE_PARTICLESPAWNER", 2} minetest_server_commands[0x54] = {"CLOUD_PARAMS", 2} minetest_server_commands[0x55] = {"FADE_SOUND", 2} -minetest_server_commands[0x61] = {"SRP_BYTES_S_B", 2} + +-- TOCLIENT_UPDATE_PLAYER_LIST + +do + local abbr = "minetest.server.update_player_list_" + local vs_type = { + [0] = "Init", + [1] = "Add", + [2] = "Remove", + } + + local f_type = ProtoField.uint8(abbr.."type", "Type", base.DEC, vs_type) + local f_count = ProtoField.uint16(abbr.."count", "Number of players", base.DEC) + local f_name = ProtoField.string(abbr.."name", "Name") + + minetest_server_commands[0x56] = { + "UPDATE_PLAYER_LIST", + 5, + { f_type, f_count, f_name }, + function(buffer, pinfo, tree, t) + t:add(f_type, buffer(2,1)) + t:add(f_count, buffer(3,2)) + local count = buffer(3,2):uint() + local off = 5 + for i = 1, count do + if not minetest_check_length(buffer, off + 2, t) then + return + end + off = minetest_decode_helper_ascii(buffer, t, "uint16", off, nil, f_name) + if not off then + return + end + end + end + } +end + +-- ... + +minetest_server_commands[0x57] = {"MODCHANNEL_MSG", 2} +minetest_server_commands[0x58] = {"MODCHANNEL_SIGNAL", 2} +minetest_server_commands[0x59] = {"NODEMETA_CHANGED", 2} +minetest_server_commands[0x5a] = {"SET_SUN", 2} +minetest_server_commands[0x5b] = {"SET_MOON", 2} +minetest_server_commands[0x5c] = {"SET_STARS", 2} +minetest_server_commands[0x60] = {"SRP_BYTES_S_B", 2} +minetest_server_commands[0x61] = {"FORMSPEC_PREPEND", 2} ------------------------------------ --- Part 3 -- +-- Part 4 -- -- Wrapper protocol subdissectors -- ------------------------------------ @@ -1093,15 +1131,15 @@ function minetest_define_client_or_server_proto(is_client) this_peer = "Client" other_peer = "Server" empty_message_info = "Empty message / Connect" - commands = minetest_client_commands -- defined in Part 1 - obsolete = minetest_client_obsolete -- defined in Part 1 + commands = minetest_client_commands -- defined in Part 2 + obsolete = minetest_client_obsolete -- defined in Part 2 else proto_name = "minetest.server" this_peer = "Server" other_peer = "Client" empty_message_info = "Empty message" - commands = minetest_server_commands -- defined in Part 2 - obsolete = minetest_server_obsolete -- defined in Part 2 + commands = minetest_server_commands -- defined in Part 3 + obsolete = minetest_server_obsolete -- defined in Part 3 end -- Create the protocol object. @@ -1124,8 +1162,8 @@ function minetest_define_client_or_server_proto(is_client) for code, command_info in pairs(commands) do local command_fields = command_info[3] if command_fields ~= nil then - local index, field for index, field in ipairs(command_fields) do + assert(field ~= nil) table.insert(proto.fields, field) end end @@ -1199,7 +1237,7 @@ end ------------------------------------- --- Part 4 -- +-- Part 5 -- -- Wrapper protocol main dissector -- ------------------------------------- @@ -1311,10 +1349,10 @@ end ------------------------ --- Part 5 -- --- Utility functions -- ------------------------ +------------------------------ +-- Part 6 -- +-- Utility functions part 2 -- +------------------------------ -- Checks if a (sub-)Tvb is long enough to be further dissected. -- If it is long enough, sets the dissector tree item length to min_len @@ -1329,14 +1367,11 @@ function minetest_check_length(tvb, min_len, t) t:set_len(min_len) return true - -- Tvb:reported_length_remaining() has been added in August 2011 - -- and is not yet widely available, disable for the time being - -- TODO: uncomment at a later date - -- TODO: when uncommenting this, also re-check if other parts of + -- TODO: check if other parts of -- the dissector could benefit from reported_length_remaining - --elseif tvb:reported_length_remaining() >= min_len then - -- t:add_expert_info(PI_UNDECODED, PI_INFO, "Only part of this packet was captured, unable to decode.") - -- return false + elseif tvb:reported_length_remaining() >= min_len then + t:add_expert_info(PI_UNDECODED, PI_INFO, "Only part of this packet was captured, unable to decode.") + return false else t:add_expert_info(PI_MALFORMED, PI_ERROR, "Message is too short") @@ -1358,7 +1393,7 @@ function minetest_convert_utf16(tvb, name) hex = "" for pos = 0, tvb:len() - 2, 2 do char = tvb(pos, 2):uint() - if (char >= 0x20) and (char <= 0x7e) then + if (char >= 0x20 and char <= 0x7e) or char == 0x0a then hex = hex .. string.format(" %02x", char) else hex = hex .. " 3F" @@ -1373,3 +1408,37 @@ function minetest_convert_utf16(tvb, name) end end +-- Decodes a variable-length string as ASCII text +-- t_textlen, t_text should be the ProtoFields created by minetest_field_helper +-- alternatively t_text can be a ProtoField.string and t_textlen can be nil +-- lentype must be the type of the length field (as passed to minetest_field_helper) +-- returns nil if length check failed +function minetest_decode_helper_ascii(tvb, t, lentype, offset, f_textlen, f_text) + local n = ({uint16 = 2, uint32 = 4})[lentype] + assert(n) + + if f_textlen then + t:add(f_textlen, tvb(offset, n)) + end + local textlen = tvb(offset, n):uint() + if minetest_check_length(tvb, offset + n + textlen, t) then + t:add(f_text, tvb(offset + n, textlen)) + return offset + n + textlen + end +end + +-- Decodes a variable-length string as UTF-16 text +-- (see minetest_decode_helper_ascii) +function minetest_decode_helper_utf16(tvb, t, lentype, offset, f_textlen, f_text) + local n = ({uint16 = 2, uint32 = 4})[lentype] + assert(n) + + if f_textlen then + t:add(f_textlen, tvb(offset, n)) + end + local textlen = tvb(offset, n):uint() * 2 + if minetest_check_length(tvb, offset + n + textlen, t) then + t:add(f_text, minetest_convert_utf16(tvb(offset + n, textlen), "UTF-16 text")) + return offset + n + textlen + end +end -- cgit v1.2.3 From 27a485a472706bededf38f0de2630688739ca0b2 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Mon, 20 Apr 2020 20:18:40 +0200 Subject: Replace travis with github actions (#9641) * Move outside of travis to Github actions This will permit to have better integrated CI workflow than the previous travis one. --- .github/workflows/build.yml | 171 +++++++++++ .github/workflows/cpp_lint.yml | 53 ++++ .github/workflows/lua_lint.yml | 32 +++ .gitlab-ci.yml | 5 - .travis.yml | 98 ------- README.md | 2 +- util/buildbot/buildwin32.sh | 9 +- util/buildbot/buildwin64.sh | 9 +- util/ci/build.sh | 8 + util/ci/clang-format-whitelist.txt | 500 +++++++++++++++++++++++++++++++++ util/ci/clang-tidy.sh | 18 ++ util/ci/common.sh | 45 +++ util/ci/lint.sh | 43 +++ util/ci/run-clang-tidy.py | 321 +++++++++++++++++++++ util/travis/before_install.sh | 29 -- util/travis/clang-format-whitelist.txt | 499 -------------------------------- util/travis/clangtidy.sh | 28 -- util/travis/common.sh | 57 ---- util/travis/lint.sh | 43 --- util/travis/run-clang-tidy.py | 321 --------------------- util/travis/script.sh | 69 ----- util/travis/toolchain_mingw.cmake.in | 18 -- 22 files changed, 1200 insertions(+), 1178 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/cpp_lint.yml create mode 100644 .github/workflows/lua_lint.yml delete mode 100644 .travis.yml create mode 100755 util/ci/build.sh create mode 100644 util/ci/clang-format-whitelist.txt create mode 100755 util/ci/clang-tidy.sh create mode 100644 util/ci/common.sh create mode 100644 util/ci/lint.sh create mode 100755 util/ci/run-clang-tidy.py delete mode 100755 util/travis/before_install.sh delete mode 100644 util/travis/clang-format-whitelist.txt delete mode 100755 util/travis/clangtidy.sh delete mode 100644 util/travis/common.sh delete mode 100644 util/travis/lint.sh delete mode 100755 util/travis/run-clang-tidy.py delete mode 100755 util/travis/script.sh delete mode 100644 util/travis/toolchain_mingw.cmake.in (limited to 'util') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..0d559b197 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,171 @@ +name: build + +# build on c/cpp changes or workflow changes +on: + push: + paths: + - 'lib/**.[ch]' + - 'lib/**.cpp' + - 'src/**.[ch]' + - 'src/**.cpp' + - '**/CMakeLists.txt' + - 'cmake/Modules/**' + - 'util/buildbot/**' + - 'util/ci/**' + - '.github/workflows/**.yml' + pull_request: + paths: + - 'lib/**.[ch]' + - 'lib/**.cpp' + - 'src/**.[ch]' + - 'src/**.cpp' + - '**/CMakeLists.txt' + - 'cmake/Modules/**' + - 'util/buildbot/**' + - 'util/ci/**' + - '.github/workflows/**.yml' + +jobs: + # This is our minor gcc compiler + gcc_6: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install compiler + run: | + sudo apt-get install g++-6 gcc-6 -qyy + source ./util/ci/common.sh + install_linux_deps + + - name: Build + run: | + ./util/ci/build.sh + env: + CMAKE_FLAGS: "-DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6" + + - name: Test + run: | + ./bin/minetest --run-unittests + + # This is the current gcc compiler (available in bionic) + gcc_8: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install compiler + run: | + sudo apt-get install g++-8 gcc-8 -qyy + source ./util/ci/common.sh + install_linux_deps + + - name: Build + run: | + ./util/ci/build.sh + env: + CMAKE_FLAGS: "-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8" + + - name: Test + run: | + ./bin/minetest --run-unittests + + # This is our minor clang compiler + clang_3_9: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install compiler + run: | + sudo apt-get install clang-3.9 -qyy + source ./util/ci/common.sh + install_linux_deps + + - name: Build + run: | + ./util/ci/build.sh + env: + CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-3.9 -DCMAKE_CXX_COMPILER=clang++-3.9" + + - name: Test + run: | + ./bin/minetest --run-unittests + + # This is the current clang version + clang_9: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install compiler + run: | + sudo apt-get install clang-9 valgrind -qyy + source ./util/ci/common.sh + install_linux_deps + env: + WITH_LUAJIT: 1 + + - name: Build + run: | + ./util/ci/build.sh + env: + CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9" + + - name: Test + run: | + ./bin/minetest --run-unittests + + - name: Valgrind + run: | + valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests + + + # Some builds doesn't require freetype, ensure it compiled properly + clang_9_no_freetype: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install compiler + run: | + sudo apt-get install clang-9 -qyy + source ./util/ci/common.sh + install_linux_deps + + - name: Build + run: | + ./util/ci/build.sh + env: + CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DENABLE_FREETYPE=0" + + - name: Test + run: | + ./bin/minetest --run-unittests + + win32: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install compiler + run: | + wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz + sudo tar -xaf mingw.tar.xz -C /usr + + - name: Build + run: | + EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin32.sh winbuild + env: + NO_MINETEST_GAME: 1 + NO_PACKAGE: 1 + + win64: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install compiler + run: | + wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz + sudo tar -xaf mingw.tar.xz -C /usr + + - name: Build + run: | + EXISTING_MINETEST_DIR=$PWD ./util/buildbot/buildwin64.sh winbuild + env: + NO_MINETEST_GAME: 1 + NO_PACKAGE: 1 diff --git a/.github/workflows/cpp_lint.yml b/.github/workflows/cpp_lint.yml new file mode 100644 index 000000000..3044d5186 --- /dev/null +++ b/.github/workflows/cpp_lint.yml @@ -0,0 +1,53 @@ +name: cpp_lint + +# lint on c/cpp changes or workflow changes +on: + push: + paths: + - 'lib/**.[ch]' + - 'lib/**.cpp' + - 'src/**.[ch]' + - 'src/**.cpp' + - '**/CMakeLists.txt' + - 'cmake/Modules/**' + - 'util/ci/**' + - '.github/workflows/**.yml' + pull_request: + paths: + - 'lib/**.[ch]' + - 'lib/**.cpp' + - 'src/**.[ch]' + - 'src/**.cpp' + - '**/CMakeLists.txt' + - 'cmake/Modules/**' + - 'util/ci/**' + - '.github/workflows/**.yml' + +jobs: + clang_format: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install clang-format + run: | + sudo apt-get install ${CLANG_FORMAT} -qyy + env: + CLANG_FORMAT: clang-format-9 + - name: Run clang-format + run: | + source ./util/ci/lint.sh + perform_lint + + clang_tidy: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install clang-tidy + run: | + sudo apt-get install clang-tidy-9 -qyy + source ./util/ci/common.sh + install_linux_deps + + - name: Run clang-tidy + run: | + ./util/ci/clang-tidy.sh diff --git a/.github/workflows/lua_lint.yml b/.github/workflows/lua_lint.yml new file mode 100644 index 000000000..1b2c01192 --- /dev/null +++ b/.github/workflows/lua_lint.yml @@ -0,0 +1,32 @@ +name: lua_lint + +# Lint on lua changes on builtin or if workflow changed +on: + push: + paths: + - 'builtin/**.lua' + - '.github/workflows/**.yml' + pull_request: + paths: + - 'builtin/**.lua' + - '.github/workflows/**.yml' + +jobs: + luacheck: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install luarocks + run: | + sudo apt-get update -qyy + sudo apt-get install luarocks -qyy + + - name: Install luarocks tools + run: | + luarocks install --local luacheck + luarocks install --local busted + + - name: Run checks + run: | + $HOME/.luarocks/bin/luacheck builtin + $HOME/.luarocks/bin/busted builtin diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a3d634261..d03b7b601 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -219,7 +219,6 @@ build:fedora-24: - apt-get update -y - apt-get install -y wget xz-utils unzip git cmake gettext - wget -q http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz - - sed -e "s|%PREFIX%|${WIN_ARCH}-w64-mingw32|" -e "s|%ROOTPATH%|/usr/${WIN_ARCH}-w64-mingw32|" < util/travis/toolchain_mingw.cmake.in > ${TOOLCHAIN_OUTPUT} - tar -xaf mingw.tar.xz -C /usr .build_win_template: @@ -256,7 +255,6 @@ build:win32: variables: NO_PACKAGE: "1" WIN_ARCH: "i686" - TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake" package:win32: extends: .package_win_template @@ -265,7 +263,6 @@ package:win32: variables: NO_PACKAGE: "1" WIN_ARCH: "i686" - TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake" build:win64: extends: .build_win_template @@ -274,7 +271,6 @@ build:win64: variables: NO_PACKAGE: "1" WIN_ARCH: "x86_64" - TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake" package:win64: extends: .package_win_template @@ -283,7 +279,6 @@ package:win64: variables: NO_PACKAGE: "1" WIN_ARCH: "x86_64" - TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake" package:docker: stage: package diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7b224b549..000000000 --- a/.travis.yml +++ /dev/null @@ -1,98 +0,0 @@ -language: cpp -before_install: ./util/travis/before_install.sh -script: ./util/travis/script.sh -os: linux -dist: bionic -group: edge -notifications: - email: false -matrix: - fast_finish: true - include: - - - env: CLANG_FORMAT=clang-format-8 - compiler: clang - os: linux - addons: - apt: - packages: ['clang-format-8'] - - - name: "Builtin Luacheck and Unit Tests" - language: generic - compiler: null - os: linux - addons: - apt: - packages: - - luarocks - before_install: - - luarocks install --local luacheck - - luarocks install --local busted - script: - - $HOME/.luarocks/bin/luacheck builtin - - $HOME/.luarocks/bin/busted builtin - - - env: CLANG_TIDY=clang-tidy-8 - compiler: clang - os: linux - script: ./util/travis/clangtidy.sh - addons: - apt: - packages: ['clang-tidy-8'] - - - name: "MinGW cross-compiler (32-bit)" - env: PLATFORM=Win32 - compiler: gcc - os: linux - - - name: "MinGW cross-compiler (64-bit)" - env: PLATFORM=Win64 - compiler: gcc - os: linux - -# - env: PLATFORM=Unix -# compiler: clang -# os: osx -# osx_image: xcode8 - - - env: PLATFORM=Unix COMPILER=gcc-6 - compiler: gcc - os: linux - addons: - apt: - packages: ['gcc-6', 'g++-6'] - - - env: PLATFORM=Unix COMPILER=gcc-8 - compiler: gcc - os: linux - addons: - apt: - packages: ['gcc-8', 'g++-8'] - - - env: PLATFORM=Unix COMPILER=clang-3.9 - compiler: clang - os: linux - addons: - apt: - packages: ['clang-3.9'] - - - env: PLATFORM=Unix COMPILER=clang-9 - compiler: clang - os: linux - addons: - apt: - packages: ['clang-9'] - - - env: PLATFORM=Unix COMPILER=clang-9 FREETYPE=0 - compiler: clang - os: linux - addons: - apt: - packages: ['clang-9'] - - - env: PLATFORM=Unix COMPILER=clang-9 VALGRIND=1 - compiler: clang - os: linux - addons: - apt: - packages: ['valgrind', 'clang-9'] diff --git a/README.md b/README.md index e9065dfa7..4c6539af7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Minetest ======== -[![Build Status](https://travis-ci.org/minetest/minetest.svg?branch=master)](https://travis-ci.org/minetest/minetest) +![Build Status](https://github.com/minetest/minetest/workflows/validate/badge.svg) [![Translation status](https://hosted.weblate.org/widgets/minetest/-/svg-badge.svg)](https://hosted.weblate.org/engage/minetest/?utm_source=widget) [![License](https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html) diff --git a/util/buildbot/buildwin32.sh b/util/buildbot/buildwin32.sh index 090ac7b0d..e62d32969 100755 --- a/util/buildbot/buildwin32.sh +++ b/util/buildbot/buildwin32.sh @@ -86,22 +86,21 @@ cd $libdir # Get minetest cd $builddir if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then - ln -s $EXISTING_MINETEST_DIR $CORE_NAME + cd /$EXISTING_MINETEST_DIR # must be absolute path else [ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT) + cd $CORE_NAME fi -cd $CORE_NAME git_hash=$(git rev-parse --short HEAD) # Get minetest_game -cd games if [ "x$NO_MINETEST_GAME" = "x" ]; then + cd games [ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT) + cd .. fi -cd ../.. # Build the thing -cd $CORE_NAME [ -d _build ] && rm -Rf _build/ mkdir _build cd _build diff --git a/util/buildbot/buildwin64.sh b/util/buildbot/buildwin64.sh index b24a478d8..94e009c29 100755 --- a/util/buildbot/buildwin64.sh +++ b/util/buildbot/buildwin64.sh @@ -78,22 +78,21 @@ cd $libdir # Get minetest cd $builddir if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then - ln -s $EXISTING_MINETEST_DIR $CORE_NAME + cd /$EXISTING_MINETEST_DIR # must be absolute path else [ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT) + cd $CORE_NAME fi -cd $CORE_NAME git_hash=$(git rev-parse --short HEAD) # Get minetest_game -cd games if [ "x$NO_MINETEST_GAME" = "x" ]; then + cd games [ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT) + cd .. fi -cd ../.. # Build the thing -cd $CORE_NAME [ -d _build ] && rm -Rf _build/ mkdir _build cd _build diff --git a/util/ci/build.sh b/util/ci/build.sh new file mode 100755 index 000000000..59069b00a --- /dev/null +++ b/util/ci/build.sh @@ -0,0 +1,8 @@ +#! /bin/bash -eu + +mkdir cmakebuild +cd cmakebuild +cmake -DCMAKE_BUILD_TYPE=Debug \ + -DRUN_IN_PLACE=TRUE -DENABLE_GETTEXT=TRUE \ + -DBUILD_SERVER=TRUE ${CMAKE_FLAGS} .. +make -j2 diff --git a/util/ci/clang-format-whitelist.txt b/util/ci/clang-format-whitelist.txt new file mode 100644 index 000000000..3334257ae --- /dev/null +++ b/util/ci/clang-format-whitelist.txt @@ -0,0 +1,500 @@ +src/activeobject.h +src/ban.cpp +src/camera.cpp +src/camera.h +src/chat.cpp +src/chat.h +src/chat_interface.h +src/client/clientlauncher.cpp +src/client/clientlauncher.h +src/client/sound_openal.cpp +src/client.cpp +src/clientenvironment.cpp +src/clientenvironment.h +src/client/gameui.cpp +src/client.h +src/client/hud.cpp +src/client/hud.h +src/clientiface.cpp +src/clientiface.h +src/client/joystick_controller.cpp +src/client/joystick_controller.h +src/clientmap.cpp +src/clientmap.h +src/clientmedia.cpp +src/clientmedia.h +src/clientobject.cpp +src/clientobject.h +src/client/render/core.cpp +src/client/renderingengine.cpp +src/client/render/interlaced.cpp +src/client/render/plain.cpp +src/client/render/sidebyside.cpp +src/client/render/stereo.cpp +src/client/tile.cpp +src/client/tile.h +src/client/fontengine.h +src/client/clientenvironment.cpp +src/client/mapblock_mesh.cpp +src/client/sound_openal.h +src/client/clouds.cpp +src/client/fontengine.cpp +src/client/camera.h +src/client/hud.cpp +src/client/clientmap.cpp +src/client/sound_openal.cpp +src/client/minimap.h +src/client/content_cao.cpp +src/client/localplayer.h +src/client/mapblock_mesh.h +src/client/mesh.cpp +src/client/sound.cpp +src/client/guiscalingfilter.cpp +src/client/content_cso.cpp +src/client/gameui.cpp +src/client/wieldmesh.cpp +src/client/clientmedia.h +src/client/game.cpp +src/client/keys.h +src/client/client.h +src/client/shader.cpp +src/client/clientmap.h +src/client/inputhandler.h +src/client/content_mapblock.h +src/client/game.h +src/client/mesh.h +src/client/camera.cpp +src/client/sky.h +src/client/mesh_generator_thread.cpp +src/client/guiscalingfilter.h +src/client/clientobject.cpp +src/client/tile.cpp +src/client/hud.h +src/client/inputhandler.cpp +src/client/clientevent.h +src/client/gameui.h +src/client/content_cso.h +src/client/sky.cpp +src/client/localplayer.cpp +src/client/content_mapblock.cpp +src/client/clientobject.h +src/client/filecache.cpp +src/client/particles.h +src/client/clientenvironment.h +src/client/imagefilters.h +src/client/renderingengine.cpp +src/client/tile.h +src/client/clientmedia.cpp +src/client/event_manager.h +src/client/joystick_controller.h +src/client/clouds.h +src/client/clientlauncher.h +src/client/content_cao.h +src/client/minimap.cpp +src/client/sound.h +src/client/keycode.cpp +src/client/particles.cpp +src/client/joystick_controller.cpp +src/client/keycode.h +src/client/wieldmesh.h +src/client/filecache.h +src/client/shader.h +src/client/mesh_generator_thread.h +src/client/renderingengine.h +src/client/client.cpp +src/client/imagefilters.cpp +src/client/clientlauncher.cpp +src/clouds.cpp +src/clouds.h +src/collision.cpp +src/collision.h +src/config.h +src/content_cao.cpp +src/content_cao.h +src/content_cso.cpp +src/content_cso.h +src/content_mapblock.cpp +src/content_mapblock.h +src/content_mapnode.cpp +src/content_nodemeta.cpp +src/content_nodemeta.h +src/convert_json.cpp +src/convert_json.h +src/craftdef.cpp +src/craftdef.h +src/database/database.cpp +src/database/database-dummy.cpp +src/database/database-files.cpp +src/database/database-leveldb.cpp +src/database/database-postgresql.cpp +src/database/database-postgresql.h +src/database/database-redis.cpp +src/database/database-sqlite3.cpp +src/database/database-sqlite3.h +src/daynightratio.h +src/debug.cpp +src/debug.h +src/defaultsettings.cpp +src/emerge.cpp +src/emerge.h +src/environment.cpp +src/exceptions.h +src/face_position_cache.cpp +src/face_position_cache.h +src/filecache.cpp +src/filesys.cpp +src/filesys.h +src/fontengine.cpp +src/fontengine.h +src/game.cpp +src/gamedef.h +src/game.h +src/gettext.cpp +src/gettext.h +src/gui/guiAnimatedImage.cpp +src/gui/guiAnimatedImage.h +src/gui/guiBackgroundImage.cpp +src/gui/guiBackgroundImage.h +src/gui/guiBox.cpp +src/gui/guiBox.h +src/gui/guiButton.cpp +src/gui/guiButton.h +src/gui/guiButtonImage.cpp +src/gui/guiButtonImage.h +src/gui/guiButtonItemImage.cpp +src/gui/guiButtonItemImage.h +src/gui/guiChatConsole.cpp +src/gui/guiChatConsole.h +src/gui/guiConfirmRegistration.cpp +src/gui/guiEditBoxWithScrollbar.cpp +src/gui/guiEditBoxWithScrollbar.h +src/gui/guiEngine.cpp +src/gui/guiEngine.h +src/gui/guiFormSpecMenu.cpp +src/gui/guiFormSpecMenu.h +src/gui/guiKeyChangeMenu.cpp +src/gui/guiHyperText.cpp +src/gui/guiHyperText.h +src/gui/guiInventoryList.cpp +src/gui/guiInventoryList.h +src/gui/guiItemImage.cpp +src/gui/guiItemImage.h +src/gui/guiMainMenu.h +src/gui/guiPasswordChange.cpp +src/gui/guiPathSelectMenu.cpp +src/gui/guiPathSelectMenu.h +src/gui/guiScrollBar.cpp +src/gui/guiSkin.cpp +src/gui/guiSkin.h +src/gui/guiTable.cpp +src/gui/guiTable.h +src/gui/guiVolumeChange.cpp +src/gui/guiVolumeChange.h +src/gui/intlGUIEditBox.cpp +src/gui/intlGUIEditBox.h +src/gui/mainmenumanager.h +src/gui/modalMenu.h +src/guiscalingfilter.cpp +src/guiscalingfilter.h +src/gui/StyleSpec.h +src/gui/touchscreengui.cpp +src/httpfetch.cpp +src/hud.cpp +src/hud.h +src/imagefilters.cpp +src/imagefilters.h +src/inventory.cpp +src/inventory.h +src/inventorymanager.cpp +src/inventorymanager.h +src/irrlicht_changes/CGUITTFont.cpp +src/irrlicht_changes/CGUITTFont.h +src/irrlicht_changes/irrUString.h +src/irrlicht_changes/static_text.cpp +src/irrlicht_changes/static_text.h +src/irrlichttypes.h +src/itemdef.cpp +src/itemdef.h +src/itemstackmetadata.cpp +src/keycode.cpp +src/light.cpp +src/localplayer.cpp +src/log.cpp +src/log.h +src/main.cpp +src/mapblock.cpp +src/mapblock.h +src/mapblock_mesh.cpp +src/mapblock_mesh.h +src/map.cpp +src/mapgen/cavegen.cpp +src/mapgen/cavegen.h +src/mapgen/dungeongen.cpp +src/mapgen/dungeongen.h +src/mapgen/mapgen.cpp +src/mapgen/mapgen.h +src/mapgen/mapgen_carpathian.cpp +src/mapgen/mapgen_carpathian.h +src/mapgen/mapgen_flat.cpp +src/mapgen/mapgen_flat.h +src/mapgen/mapgen_fractal.cpp +src/mapgen/mapgen_fractal.h +src/mapgen/mapgen_singlenode.cpp +src/mapgen/mapgen_singlenode.h +src/mapgen/mapgen_v5.cpp +src/mapgen/mapgen_v5.h +src/mapgen/mapgen_v6.cpp +src/mapgen/mapgen_v6.h +src/mapgen/mapgen_v7.cpp +src/mapgen/mapgen_v7.h +src/mapgen/mapgen_valleys.cpp +src/mapgen/mapgen_valleys.h +src/mapgen/mg_biome.cpp +src/mapgen/mg_biome.h +src/mapgen/mg_decoration.cpp +src/mapgen/mg_decoration.h +src/mapgen/mg_ore.cpp +src/mapgen/mg_ore.h +src/mapgen/mg_schematic.cpp +src/mapgen/mg_schematic.h +src/mapgen/treegen.cpp +src/mapgen/treegen.h +src/map.h +src/mapnode.cpp +src/mapnode.h +src/mapsector.cpp +src/mapsector.h +src/map_settings_manager.cpp +src/map_settings_manager.h +src/mesh.cpp +src/mesh_generator_thread.cpp +src/mesh.h +src/metadata.h +src/minimap.cpp +src/minimap.h +src/mods.cpp +src/mods.h +src/network/address.cpp +src/network/clientopcodes.cpp +src/network/clientopcodes.h +src/network/clientpackethandler.cpp +src/network/connection.cpp +src/network/connection.h +src/network/connectionthreads.cpp +src/network/networkpacket.cpp +src/network/networkprotocol.h +src/network/serveropcodes.cpp +src/network/serveropcodes.h +src/network/serverpackethandler.cpp +src/nodedef.cpp +src/nodedef.h +src/nodemetadata.cpp +src/nodemetadata.h +src/nodetimer.cpp +src/nodetimer.h +src/noise.cpp +src/noise.h +src/objdef.cpp +src/objdef.h +src/object_properties.cpp +src/object_properties.h +src/particles.cpp +src/particles.h +src/pathfinder.cpp +src/pathfinder.h +src/player.cpp +src/player.h +src/porting_android.cpp +src/porting_android.h +src/porting.cpp +src/porting.h +src/profiler.h +src/raycast.cpp +src/raycast.h +src/reflowscan.cpp +src/reflowscan.h +src/remoteplayer.cpp +src/rollback.cpp +src/rollback.h +src/rollback_interface.cpp +src/rollback_interface.h +src/script/common/c_content.cpp +src/script/common/c_content.h +src/script/common/c_converter.cpp +src/script/common/c_converter.h +src/script/common/c_internal.cpp +src/script/common/c_internal.h +src/script/common/c_types.cpp +src/script/common/c_types.h +src/script/cpp_api/s_async.cpp +src/script/cpp_api/s_async.h +src/script/cpp_api/s_base.cpp +src/script/cpp_api/s_base.h +src/script/cpp_api/s_client.cpp +src/script/cpp_api/s_entity.cpp +src/script/cpp_api/s_entity.h +src/script/cpp_api/s_env.cpp +src/script/cpp_api/s_env.h +src/script/cpp_api/s_internal.h +src/script/cpp_api/s_inventory.cpp +src/script/cpp_api/s_inventory.h +src/script/cpp_api/s_item.cpp +src/script/cpp_api/s_item.h +src/script/cpp_api/s_mainmenu.h +src/script/cpp_api/s_node.cpp +src/script/cpp_api/s_node.h +src/script/cpp_api/s_nodemeta.cpp +src/script/cpp_api/s_nodemeta.h +src/script/cpp_api/s_player.cpp +src/script/cpp_api/s_player.h +src/script/cpp_api/s_security.cpp +src/script/cpp_api/s_security.h +src/script/cpp_api/s_server.cpp +src/script/cpp_api/s_server.h +src/script/lua_api/l_areastore.cpp +src/script/lua_api/l_base.cpp +src/script/lua_api/l_base.h +src/script/lua_api/l_client.cpp +src/script/lua_api/l_craft.cpp +src/script/lua_api/l_craft.h +src/script/lua_api/l_env.cpp +src/script/lua_api/l_env.h +src/script/lua_api/l_http.cpp +src/script/lua_api/l_http.h +src/script/lua_api/l_internal.h +src/script/lua_api/l_inventory.cpp +src/script/lua_api/l_inventory.h +src/script/lua_api/l_item.cpp +src/script/lua_api/l_item.h +src/script/lua_api/l_itemstackmeta.cpp +src/script/lua_api/l_itemstackmeta.h +src/script/lua_api/l_localplayer.cpp +src/script/lua_api/l_mainmenu.cpp +src/script/lua_api/l_mainmenu.h +src/script/lua_api/l_mapgen.cpp +src/script/lua_api/l_mapgen.h +src/script/lua_api/l_metadata.cpp +src/script/lua_api/l_minimap.cpp +src/script/lua_api/l_nodemeta.cpp +src/script/lua_api/l_nodemeta.h +src/script/lua_api/l_nodetimer.cpp +src/script/lua_api/l_noise.cpp +src/script/lua_api/l_object.cpp +src/script/lua_api/l_object.h +src/script/lua_api/l_particles.cpp +src/script/lua_api/l_particles.h +src/script/lua_api/l_particles_local.cpp +src/script/lua_api/l_rollback.cpp +src/script/lua_api/l_rollback.h +src/script/lua_api/l_server.cpp +src/script/lua_api/l_settings.cpp +src/script/lua_api/l_sound.cpp +src/script/lua_api/l_storage.cpp +src/script/lua_api/l_util.cpp +src/script/lua_api/l_vmanip.cpp +src/script/scripting_client.cpp +src/script/scripting_client.h +src/script/scripting_mainmenu.cpp +src/script/scripting_mainmenu.h +src/script/scripting_server.cpp +src/script/scripting_server.h +src/serialization.cpp +src/serialization.h +src/server.cpp +src/serverenvironment.cpp +src/serverenvironment.h +src/server.h +src/serverlist.cpp +src/serverlist.h +src/server/luaentity_sao.cpp +src/server/player_sao.cpp +src/server/serveractiveobject.cpp +src/server/serveractiveobject.h +src/settings.cpp +src/settings.h +src/settings_translation_file.cpp +src/shader.cpp +src/shader.h +src/sky.cpp +src/sound.cpp +src/staticobject.cpp +src/staticobject.h +src/subgame.cpp +src/subgame.h +src/terminal_chat_console.cpp +src/terminal_chat_console.h +src/texture_override.cpp +src/threading/atomic.h +src/threading/event.cpp +src/threading/mutex_auto_lock.h +src/threading/mutex.cpp +src/threading/mutex.h +src/threading/semaphore.cpp +src/threading/thread.cpp +src/threading/thread.h +src/threads.h +src/tileanimation.cpp +src/tileanimation.h +src/tool.cpp +src/tool.h +src/translation.cpp +src/unittest/test_areastore.cpp +src/unittest/test_collision.cpp +src/unittest/test_compression.cpp +src/unittest/test_connection.cpp +src/unittest/test.cpp +src/unittest/test_filepath.cpp +src/unittest/test.h +src/unittest/test_inventory.cpp +src/unittest/test_keycode.cpp +src/unittest/test_map_settings_manager.cpp +src/unittest/test_noderesolver.cpp +src/unittest/test_noise.cpp +src/unittest/test_random.cpp +src/unittest/test_schematic.cpp +src/unittest/test_serialization.cpp +src/unittest/test_settings.cpp +src/unittest/test_socket.cpp +src/unittest/test_threading.cpp +src/unittest/test_utilities.cpp +src/unittest/test_voxelalgorithms.cpp +src/unittest/test_voxelmanipulator.cpp +src/util/areastore.cpp +src/util/areastore.h +src/util/auth.cpp +src/util/auth.h +src/util/base64.cpp +src/util/base64.h +src/util/basic_macros.h +src/util/container.h +src/util/directiontables.cpp +src/util/directiontables.h +src/util/enriched_string.cpp +src/util/enriched_string.h +src/util/md32_common.h +src/util/numeric.cpp +src/util/numeric.h +src/util/pointedthing.cpp +src/util/pointedthing.h +src/util/pointer.h +src/util/quicktune.h +src/util/quicktune_shortcutter.h +src/util/quicktune.cpp +src/util/serialize.cpp +src/util/serialize.h +src/util/sha1.cpp +src/util/srp.cpp +src/util/srp.h +src/util/strfnd.h +src/util/string.cpp +src/util/string.h +src/util/thread.h +src/util/timetaker.cpp +src/util/timetaker.h +src/version.cpp +src/version.h +src/voxelalgorithms.cpp +src/voxelalgorithms.h +src/voxel.cpp +src/voxel.h +src/wieldmesh.cpp diff --git a/util/ci/clang-tidy.sh b/util/ci/clang-tidy.sh new file mode 100755 index 000000000..d048f54ee --- /dev/null +++ b/util/ci/clang-tidy.sh @@ -0,0 +1,18 @@ +#! /bin/bash -eu + +mkdir -p cmakebuild +cd cmakebuild +cmake -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DRUN_IN_PLACE=TRUE \ + -DENABLE_GETTEXT=TRUE \ + -DENABLE_SOUND=FALSE \ + -DBUILD_SERVER=TRUE .. +make GenerateVersion + +cd .. + +./util/ci/run-clang-tidy.py \ + -clang-tidy-binary=clang-tidy-9 -p cmakebuild \ + -quiet -config="$(cat .clang-tidy)" \ + 'src/.*' diff --git a/util/ci/common.sh b/util/ci/common.sh new file mode 100644 index 000000000..5a4f78457 --- /dev/null +++ b/util/ci/common.sh @@ -0,0 +1,45 @@ +#!/bin/bash -e + +set_linux_compiler_env() { + if [[ "${COMPILER}" == "gcc-6" ]]; then + export CC=gcc-6 + export CXX=g++-6 + elif [[ "${COMPILER}" == "gcc-8" ]]; then + export CC=gcc-8 + export CXX=g++-8 + elif [[ "${COMPILER}" == "clang-3.9" ]]; then + export CC=clang-3.9 + export CXX=clang++-3.9 + elif [[ "${COMPILER}" == "clang-9" ]]; then + export CC=clang-9 + export CXX=clang++-9 + fi +} + +# Linux build only +install_linux_deps() { + local pkgs=(libirrlicht-dev cmake libbz2-dev libpng-dev \ + libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \ + libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \ + gettext libpq-dev postgresql-server-dev-all libleveldb-dev \ + libcurl4-openssl-dev) + # for better coverage, build some jobs with luajit + if [ -n "$WITH_LUAJIT" ]; then + pkgs+=(libluajit-5.1-dev) + fi + + sudo apt-get update + sudo apt-get install -y --no-install-recommends ${pkgs[@]} +} + +# Mac OSX build only +install_macosx_deps() { + brew update + brew install freetype gettext hiredis irrlicht leveldb libogg libvorbis luajit + if brew ls | grep -q jpeg; then + brew upgrade jpeg + else + brew install jpeg + fi + #brew upgrade postgresql +} diff --git a/util/ci/lint.sh b/util/ci/lint.sh new file mode 100644 index 000000000..395445ca7 --- /dev/null +++ b/util/ci/lint.sh @@ -0,0 +1,43 @@ +#! /bin/bash +function perform_lint() { + echo "Performing LINT..." + if [ -z "${CLANG_FORMAT}" ]; then + CLANG_FORMAT=clang-format + fi + echo "LINT: Using binary $CLANG_FORMAT" + CLANG_FORMAT_WHITELIST="util/ci/clang-format-whitelist.txt" + + files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" + + local errorcount=0 + local fail=0 + for f in ${files_to_lint}; do + d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true) + + if ! [ -z "$d" ]; then + whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST") + + # If file is not whitelisted, mark a failure + if [ -z "${whitelisted}" ]; then + errorcount=$((errorcount+1)) + + printf "The file %s is not compliant with the coding style" "$f" + if [ ${errorcount} -gt 50 ]; then + printf "\nToo many errors encountered previously, this diff is hidden.\n" + else + printf ":\n%s\n" "$d" + fi + + fail=1 + fi + fi + done + + if [ "$fail" = 1 ]; then + echo "LINT reports failure." + exit 1 + fi + + echo "LINT OK" +} + diff --git a/util/ci/run-clang-tidy.py b/util/ci/run-clang-tidy.py new file mode 100755 index 000000000..6ad0ff24f --- /dev/null +++ b/util/ci/run-clang-tidy.py @@ -0,0 +1,321 @@ +#!/usr/bin/env python +# +#===- run-clang-tidy.py - Parallel clang-tidy runner ---------*- python -*--===# +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===------------------------------------------------------------------------===# +# FIXME: Integrate with clang-tidy-diff.py + +""" +Parallel clang-tidy runner +========================== + +Runs clang-tidy over all files in a compilation database. Requires clang-tidy +and clang-apply-replacements in $PATH. + +Example invocations. +- Run clang-tidy on all files in the current working directory with a default + set of checks and show warnings in the cpp files and all project headers. + run-clang-tidy.py $PWD + +- Fix all header guards. + run-clang-tidy.py -fix -checks=-*,llvm-header-guard + +- Fix all header guards included from clang-tidy and header guards + for clang-tidy headers. + run-clang-tidy.py -fix -checks=-*,llvm-header-guard extra/clang-tidy \ + -header-filter=extra/clang-tidy + +Compilation database setup: +http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html +""" + +from __future__ import print_function + +import argparse +import glob +import json +import multiprocessing +import os +import re +import shutil +import subprocess +import sys +import tempfile +import threading +import traceback + +try: + import yaml +except ImportError: + yaml = None + +is_py2 = sys.version[0] == '2' + +if is_py2: + import Queue as queue +else: + import queue as queue + +def find_compilation_database(path): + """Adjusts the directory until a compilation database is found.""" + result = './' + while not os.path.isfile(os.path.join(result, path)): + if os.path.realpath(result) == '/': + print('Error: could not find compilation database.') + sys.exit(1) + result += '../' + return os.path.realpath(result) + + +def make_absolute(f, directory): + if os.path.isabs(f): + return f + return os.path.normpath(os.path.join(directory, f)) + + +def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path, + header_filter, extra_arg, extra_arg_before, quiet, + config): + """Gets a command line for clang-tidy.""" + start = [clang_tidy_binary] + if header_filter is not None: + start.append('-header-filter=' + header_filter) + if checks: + start.append('-checks=' + checks) + if tmpdir is not None: + start.append('-export-fixes') + # Get a temporary file. We immediately close the handle so clang-tidy can + # overwrite it. + (handle, name) = tempfile.mkstemp(suffix='.yaml', dir=tmpdir) + os.close(handle) + start.append(name) + for arg in extra_arg: + start.append('-extra-arg=%s' % arg) + for arg in extra_arg_before: + start.append('-extra-arg-before=%s' % arg) + start.append('-p=' + build_path) + if quiet: + start.append('-quiet') + if config: + start.append('-config=' + config) + start.append(f) + return start + + +def merge_replacement_files(tmpdir, mergefile): + """Merge all replacement files in a directory into a single file""" + # The fixes suggested by clang-tidy >= 4.0.0 are given under + # the top level key 'Diagnostics' in the output yaml files + mergekey="Diagnostics" + merged=[] + for replacefile in glob.iglob(os.path.join(tmpdir, '*.yaml')): + content = yaml.safe_load(open(replacefile, 'r')) + if not content: + continue # Skip empty files. + merged.extend(content.get(mergekey, [])) + + if merged: + # MainSourceFile: The key is required by the definition inside + # include/clang/Tooling/ReplacementsYaml.h, but the value + # is actually never used inside clang-apply-replacements, + # so we set it to '' here. + output = { 'MainSourceFile': '', mergekey: merged } + with open(mergefile, 'w') as out: + yaml.safe_dump(output, out) + else: + # Empty the file: + open(mergefile, 'w').close() + + +def check_clang_apply_replacements_binary(args): + """Checks if invoking supplied clang-apply-replacements binary works.""" + try: + subprocess.check_call([args.clang_apply_replacements_binary, '--version']) + except: + print('Unable to run clang-apply-replacements. Is clang-apply-replacements ' + 'binary correctly specified?', file=sys.stderr) + traceback.print_exc() + sys.exit(1) + + +def apply_fixes(args, tmpdir): + """Calls clang-apply-fixes on a given directory.""" + invocation = [args.clang_apply_replacements_binary] + if args.format: + invocation.append('-format') + if args.style: + invocation.append('-style=' + args.style) + invocation.append(tmpdir) + subprocess.call(invocation) + + +def run_tidy(args, tmpdir, build_path, queue, lock, failed_files): + """Takes filenames out of queue and runs clang-tidy on them.""" + while True: + name = queue.get() + invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks, + tmpdir, build_path, args.header_filter, + args.extra_arg, args.extra_arg_before, + args.quiet, args.config) + + proc = subprocess.Popen(invocation) + proc.wait() + if proc.returncode != 0: + failed_files.append(name) + queue.task_done() + + +def main(): + parser = argparse.ArgumentParser(description='Runs clang-tidy over all files ' + 'in a compilation database. Requires ' + 'clang-tidy and clang-apply-replacements in ' + '$PATH.') + parser.add_argument('-clang-tidy-binary', metavar='PATH', + default='clang-tidy', + help='path to clang-tidy binary') + parser.add_argument('-clang-apply-replacements-binary', metavar='PATH', + default='clang-apply-replacements', + help='path to clang-apply-replacements binary') + parser.add_argument('-checks', default=None, + help='checks filter, when not specified, use clang-tidy ' + 'default') + parser.add_argument('-config', default=None, + help='Specifies a configuration in YAML/JSON format: ' + ' -config="{Checks: \'*\', ' + ' CheckOptions: [{key: x, ' + ' value: y}]}" ' + 'When the value is empty, clang-tidy will ' + 'attempt to find a file named .clang-tidy for ' + 'each source file in its parent directories.') + parser.add_argument('-header-filter', default=None, + help='regular expression matching the names of the ' + 'headers to output diagnostics from. Diagnostics from ' + 'the main file of each translation unit are always ' + 'displayed.') + if yaml: + parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes', + help='Create a yaml file to store suggested fixes in, ' + 'which can be applied with clang-apply-replacements.') + parser.add_argument('-j', type=int, default=0, + help='number of tidy instances to be run in parallel.') + parser.add_argument('files', nargs='*', default=['.*'], + help='files to be processed (regex on path)') + parser.add_argument('-fix', action='store_true', help='apply fix-its') + parser.add_argument('-format', action='store_true', help='Reformat code ' + 'after applying fixes') + parser.add_argument('-style', default='file', help='The style of reformat ' + 'code after applying fixes') + parser.add_argument('-p', dest='build_path', + help='Path used to read a compile command database.') + parser.add_argument('-extra-arg', dest='extra_arg', + action='append', default=[], + help='Additional argument to append to the compiler ' + 'command line.') + parser.add_argument('-extra-arg-before', dest='extra_arg_before', + action='append', default=[], + help='Additional argument to prepend to the compiler ' + 'command line.') + parser.add_argument('-quiet', action='store_true', + help='Run clang-tidy in quiet mode') + args = parser.parse_args() + + db_path = 'compile_commands.json' + + if args.build_path is not None: + build_path = args.build_path + else: + # Find our database + build_path = find_compilation_database(db_path) + + try: + invocation = [args.clang_tidy_binary, '-list-checks'] + invocation.append('-p=' + build_path) + if args.checks: + invocation.append('-checks=' + args.checks) + invocation.append('-') + if args.quiet: + # Even with -quiet we still want to check if we can call clang-tidy. + with open(os.devnull, 'w') as dev_null: + subprocess.check_call(invocation, stdout=dev_null) + else: + subprocess.check_call(invocation) + except: + print("Unable to run clang-tidy.", file=sys.stderr) + sys.exit(1) + + # Load the database and extract all files. + database = json.load(open(os.path.join(build_path, db_path))) + files = [make_absolute(entry['file'], entry['directory']) + for entry in database] + + max_task = args.j + if max_task == 0: + max_task = multiprocessing.cpu_count() + + tmpdir = None + if args.fix or (yaml and args.export_fixes): + check_clang_apply_replacements_binary(args) + tmpdir = tempfile.mkdtemp() + + # Build up a big regexy filter from all command line arguments. + file_name_re = re.compile('|'.join(args.files)) + + return_code = 0 + try: + # Spin up a bunch of tidy-launching threads. + task_queue = queue.Queue(max_task) + # List of files with a non-zero return code. + failed_files = [] + lock = threading.Lock() + for _ in range(max_task): + t = threading.Thread(target=run_tidy, + args=(args, tmpdir, build_path, task_queue, lock, failed_files)) + t.daemon = True + t.start() + + # Fill the queue with files. + for name in files: + if file_name_re.search(name): + task_queue.put(name) + + # Wait for all threads to be done. + task_queue.join() + if len(failed_files): + return_code = 1 + + except KeyboardInterrupt: + # This is a sad hack. Unfortunately subprocess goes + # bonkers with ctrl-c and we start forking merrily. + print('\nCtrl-C detected, goodbye.') + if tmpdir: + shutil.rmtree(tmpdir) + os.kill(0, 9) + + if yaml and args.export_fixes: + print('Writing fixes to ' + args.export_fixes + ' ...') + try: + merge_replacement_files(tmpdir, args.export_fixes) + except: + print('Error exporting fixes.\n', file=sys.stderr) + traceback.print_exc() + return_code=1 + + if args.fix: + print('Applying fixes ...') + try: + apply_fixes(args, tmpdir) + except: + print('Error applying fixes.\n', file=sys.stderr) + traceback.print_exc() + return_code=1 + + if tmpdir: + shutil.rmtree(tmpdir) + sys.exit(return_code) + +if __name__ == '__main__': + main() diff --git a/util/travis/before_install.sh b/util/travis/before_install.sh deleted file mode 100755 index 649486dad..000000000 --- a/util/travis/before_install.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -e - -echo "Preparing for $TRAVIS_COMMIT_RANGE" - -. util/travis/common.sh - -if [[ ! -z "${CLANG_FORMAT}" ]]; then - exit 0 -fi - -needs_compile || exit 0 - -if [[ $PLATFORM == "Unix" ]] || [[ ! -z "${CLANG_TIDY}" ]]; then - if [[ $TRAVIS_OS_NAME == "linux" ]] || [[ ! -z "${CLANG_TIDY}" ]]; then - install_linux_deps - else - install_macosx_deps - fi -elif [[ $PLATFORM == "Win32" ]]; then - wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz - # buildwin32.sh detects the installed toolchain automatically - sudo tar -xaf mingw.tar.xz -C /usr -elif [[ $PLATFORM == "Win64" ]]; then - wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz - sed -e "s|%PREFIX%|x86_64-w64-mingw32|" \ - -e "s|%ROOTPATH%|/usr/x86_64-w64-mingw32|" \ - < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw64.cmake - sudo tar -xaf mingw.tar.xz -C /usr -fi diff --git a/util/travis/clang-format-whitelist.txt b/util/travis/clang-format-whitelist.txt deleted file mode 100644 index 02c8b2660..000000000 --- a/util/travis/clang-format-whitelist.txt +++ /dev/null @@ -1,499 +0,0 @@ -src/activeobject.h -src/ban.cpp -src/camera.cpp -src/camera.h -src/chat.cpp -src/chat.h -src/chat_interface.h -src/client/clientlauncher.cpp -src/client/clientlauncher.h -src/client/sound_openal.cpp -src/client.cpp -src/clientenvironment.cpp -src/clientenvironment.h -src/client/gameui.cpp -src/client.h -src/client/hud.cpp -src/client/hud.h -src/clientiface.cpp -src/clientiface.h -src/client/joystick_controller.cpp -src/client/joystick_controller.h -src/clientmap.cpp -src/clientmap.h -src/clientmedia.cpp -src/clientmedia.h -src/clientobject.cpp -src/clientobject.h -src/client/render/core.cpp -src/client/renderingengine.cpp -src/client/render/interlaced.cpp -src/client/render/plain.cpp -src/client/render/sidebyside.cpp -src/client/render/stereo.cpp -src/client/tile.cpp -src/client/tile.h -src/client/fontengine.h -src/client/clientenvironment.cpp -src/client/mapblock_mesh.cpp -src/client/sound_openal.h -src/client/clouds.cpp -src/client/fontengine.cpp -src/client/camera.h -src/client/hud.cpp -src/client/clientmap.cpp -src/client/sound_openal.cpp -src/client/minimap.h -src/client/content_cao.cpp -src/client/localplayer.h -src/client/mapblock_mesh.h -src/client/mesh.cpp -src/client/sound.cpp -src/client/guiscalingfilter.cpp -src/client/content_cso.cpp -src/client/gameui.cpp -src/client/wieldmesh.cpp -src/client/clientmedia.h -src/client/game.cpp -src/client/keys.h -src/client/client.h -src/client/shader.cpp -src/client/clientmap.h -src/client/inputhandler.h -src/client/content_mapblock.h -src/client/game.h -src/client/mesh.h -src/client/camera.cpp -src/client/sky.h -src/client/mesh_generator_thread.cpp -src/client/guiscalingfilter.h -src/client/clientobject.cpp -src/client/tile.cpp -src/client/hud.h -src/client/inputhandler.cpp -src/client/clientevent.h -src/client/gameui.h -src/client/content_cso.h -src/client/sky.cpp -src/client/localplayer.cpp -src/client/content_mapblock.cpp -src/client/clientobject.h -src/client/filecache.cpp -src/client/particles.h -src/client/clientenvironment.h -src/client/imagefilters.h -src/client/renderingengine.cpp -src/client/tile.h -src/client/clientmedia.cpp -src/client/event_manager.h -src/client/joystick_controller.h -src/client/clouds.h -src/client/clientlauncher.h -src/client/content_cao.h -src/client/minimap.cpp -src/client/sound.h -src/client/keycode.cpp -src/client/particles.cpp -src/client/joystick_controller.cpp -src/client/keycode.h -src/client/wieldmesh.h -src/client/filecache.h -src/client/shader.h -src/client/mesh_generator_thread.h -src/client/renderingengine.h -src/client/client.cpp -src/client/imagefilters.cpp -src/client/clientlauncher.cpp -src/clouds.cpp -src/clouds.h -src/collision.cpp -src/collision.h -src/config.h -src/content_cao.cpp -src/content_cao.h -src/content_cso.cpp -src/content_cso.h -src/content_mapblock.cpp -src/content_mapblock.h -src/content_mapnode.cpp -src/content_nodemeta.cpp -src/content_nodemeta.h -src/convert_json.cpp -src/convert_json.h -src/craftdef.cpp -src/craftdef.h -src/database/database.cpp -src/database/database-dummy.cpp -src/database/database-files.cpp -src/database/database-leveldb.cpp -src/database/database-postgresql.cpp -src/database/database-postgresql.h -src/database/database-redis.cpp -src/database/database-sqlite3.cpp -src/database/database-sqlite3.h -src/daynightratio.h -src/debug.cpp -src/debug.h -src/defaultsettings.cpp -src/emerge.cpp -src/emerge.h -src/environment.cpp -src/exceptions.h -src/face_position_cache.cpp -src/face_position_cache.h -src/filecache.cpp -src/filesys.cpp -src/filesys.h -src/fontengine.cpp -src/fontengine.h -src/game.cpp -src/gamedef.h -src/game.h -src/gettext.cpp -src/gettext.h -src/gui/guiAnimatedImage.cpp -src/gui/guiAnimatedImage.h -src/gui/guiBackgroundImage.cpp -src/gui/guiBackgroundImage.h -src/gui/guiBox.cpp -src/gui/guiBox.h -src/gui/guiButton.cpp -src/gui/guiButton.h -src/gui/guiButtonImage.cpp -src/gui/guiButtonImage.h -src/gui/guiButtonItemImage.cpp -src/gui/guiButtonItemImage.h -src/gui/guiChatConsole.cpp -src/gui/guiChatConsole.h -src/gui/guiConfirmRegistration.cpp -src/gui/guiEditBoxWithScrollbar.cpp -src/gui/guiEditBoxWithScrollbar.h -src/gui/guiEngine.cpp -src/gui/guiEngine.h -src/gui/guiFormSpecMenu.cpp -src/gui/guiFormSpecMenu.h -src/gui/guiKeyChangeMenu.cpp -src/gui/guiHyperText.cpp -src/gui/guiHyperText.h -src/gui/guiInventoryList.cpp -src/gui/guiInventoryList.h -src/gui/guiItemImage.cpp -src/gui/guiItemImage.h -src/gui/guiMainMenu.h -src/gui/guiPasswordChange.cpp -src/gui/guiPathSelectMenu.cpp -src/gui/guiPathSelectMenu.h -src/gui/guiScrollBar.cpp -src/gui/guiSkin.cpp -src/gui/guiSkin.h -src/gui/guiTable.cpp -src/gui/guiTable.h -src/gui/guiVolumeChange.cpp -src/gui/guiVolumeChange.h -src/gui/intlGUIEditBox.cpp -src/gui/intlGUIEditBox.h -src/gui/mainmenumanager.h -src/gui/modalMenu.h -src/guiscalingfilter.cpp -src/guiscalingfilter.h -src/gui/StyleSpec.h -src/gui/touchscreengui.cpp -src/httpfetch.cpp -src/hud.cpp -src/hud.h -src/imagefilters.cpp -src/imagefilters.h -src/inventory.cpp -src/inventory.h -src/inventorymanager.cpp -src/inventorymanager.h -src/irrlicht_changes/CGUITTFont.cpp -src/irrlicht_changes/CGUITTFont.h -src/irrlicht_changes/irrUString.h -src/irrlicht_changes/static_text.cpp -src/irrlicht_changes/static_text.h -src/irrlichttypes.h -src/itemdef.cpp -src/itemdef.h -src/itemstackmetadata.cpp -src/keycode.cpp -src/light.cpp -src/localplayer.cpp -src/log.cpp -src/log.h -src/main.cpp -src/mapblock.cpp -src/mapblock.h -src/mapblock_mesh.cpp -src/mapblock_mesh.h -src/map.cpp -src/mapgen/cavegen.cpp -src/mapgen/cavegen.h -src/mapgen/dungeongen.cpp -src/mapgen/dungeongen.h -src/mapgen/mapgen.cpp -src/mapgen/mapgen.h -src/mapgen/mapgen_carpathian.cpp -src/mapgen/mapgen_carpathian.h -src/mapgen/mapgen_flat.cpp -src/mapgen/mapgen_flat.h -src/mapgen/mapgen_fractal.cpp -src/mapgen/mapgen_fractal.h -src/mapgen/mapgen_singlenode.cpp -src/mapgen/mapgen_singlenode.h -src/mapgen/mapgen_v5.cpp -src/mapgen/mapgen_v5.h -src/mapgen/mapgen_v6.cpp -src/mapgen/mapgen_v6.h -src/mapgen/mapgen_v7.cpp -src/mapgen/mapgen_v7.h -src/mapgen/mapgen_valleys.cpp -src/mapgen/mapgen_valleys.h -src/mapgen/mg_biome.cpp -src/mapgen/mg_biome.h -src/mapgen/mg_decoration.cpp -src/mapgen/mg_decoration.h -src/mapgen/mg_ore.cpp -src/mapgen/mg_ore.h -src/mapgen/mg_schematic.cpp -src/mapgen/mg_schematic.h -src/mapgen/treegen.cpp -src/mapgen/treegen.h -src/map.h -src/mapnode.cpp -src/mapnode.h -src/mapsector.cpp -src/mapsector.h -src/map_settings_manager.cpp -src/map_settings_manager.h -src/mesh.cpp -src/mesh_generator_thread.cpp -src/mesh.h -src/metadata.h -src/minimap.cpp -src/minimap.h -src/mods.cpp -src/mods.h -src/network/address.cpp -src/network/clientopcodes.cpp -src/network/clientopcodes.h -src/network/clientpackethandler.cpp -src/network/connection.cpp -src/network/connection.h -src/network/connectionthreads.cpp -src/network/networkpacket.cpp -src/network/networkprotocol.h -src/network/serveropcodes.cpp -src/network/serveropcodes.h -src/network/serverpackethandler.cpp -src/nodedef.cpp -src/nodedef.h -src/nodemetadata.cpp -src/nodemetadata.h -src/nodetimer.cpp -src/nodetimer.h -src/noise.cpp -src/noise.h -src/objdef.cpp -src/objdef.h -src/object_properties.cpp -src/object_properties.h -src/particles.cpp -src/particles.h -src/pathfinder.cpp -src/pathfinder.h -src/player.cpp -src/player.h -src/porting_android.cpp -src/porting_android.h -src/porting.cpp -src/porting.h -src/profiler.h -src/raycast.cpp -src/raycast.h -src/reflowscan.cpp -src/reflowscan.h -src/remoteplayer.cpp -src/rollback.cpp -src/rollback.h -src/rollback_interface.cpp -src/rollback_interface.h -src/script/common/c_content.cpp -src/script/common/c_content.h -src/script/common/c_converter.cpp -src/script/common/c_converter.h -src/script/common/c_internal.cpp -src/script/common/c_internal.h -src/script/common/c_types.cpp -src/script/common/c_types.h -src/script/cpp_api/s_async.cpp -src/script/cpp_api/s_async.h -src/script/cpp_api/s_base.cpp -src/script/cpp_api/s_base.h -src/script/cpp_api/s_client.cpp -src/script/cpp_api/s_entity.cpp -src/script/cpp_api/s_entity.h -src/script/cpp_api/s_env.cpp -src/script/cpp_api/s_env.h -src/script/cpp_api/s_internal.h -src/script/cpp_api/s_inventory.cpp -src/script/cpp_api/s_inventory.h -src/script/cpp_api/s_item.cpp -src/script/cpp_api/s_item.h -src/script/cpp_api/s_mainmenu.h -src/script/cpp_api/s_node.cpp -src/script/cpp_api/s_node.h -src/script/cpp_api/s_nodemeta.cpp -src/script/cpp_api/s_nodemeta.h -src/script/cpp_api/s_player.cpp -src/script/cpp_api/s_player.h -src/script/cpp_api/s_security.cpp -src/script/cpp_api/s_security.h -src/script/cpp_api/s_server.cpp -src/script/cpp_api/s_server.h -src/script/lua_api/l_areastore.cpp -src/script/lua_api/l_base.cpp -src/script/lua_api/l_base.h -src/script/lua_api/l_client.cpp -src/script/lua_api/l_craft.cpp -src/script/lua_api/l_craft.h -src/script/lua_api/l_env.cpp -src/script/lua_api/l_env.h -src/script/lua_api/l_http.cpp -src/script/lua_api/l_http.h -src/script/lua_api/l_internal.h -src/script/lua_api/l_inventory.cpp -src/script/lua_api/l_inventory.h -src/script/lua_api/l_item.cpp -src/script/lua_api/l_item.h -src/script/lua_api/l_itemstackmeta.cpp -src/script/lua_api/l_itemstackmeta.h -src/script/lua_api/l_localplayer.cpp -src/script/lua_api/l_mainmenu.cpp -src/script/lua_api/l_mainmenu.h -src/script/lua_api/l_mapgen.cpp -src/script/lua_api/l_mapgen.h -src/script/lua_api/l_metadata.cpp -src/script/lua_api/l_minimap.cpp -src/script/lua_api/l_nodemeta.cpp -src/script/lua_api/l_nodemeta.h -src/script/lua_api/l_nodetimer.cpp -src/script/lua_api/l_noise.cpp -src/script/lua_api/l_object.cpp -src/script/lua_api/l_object.h -src/script/lua_api/l_particles.cpp -src/script/lua_api/l_particles.h -src/script/lua_api/l_particles_local.cpp -src/script/lua_api/l_rollback.cpp -src/script/lua_api/l_rollback.h -src/script/lua_api/l_server.cpp -src/script/lua_api/l_settings.cpp -src/script/lua_api/l_sound.cpp -src/script/lua_api/l_storage.cpp -src/script/lua_api/l_util.cpp -src/script/lua_api/l_vmanip.cpp -src/script/scripting_client.cpp -src/script/scripting_client.h -src/script/scripting_mainmenu.cpp -src/script/scripting_mainmenu.h -src/script/scripting_server.cpp -src/script/scripting_server.h -src/serialization.cpp -src/serialization.h -src/server.cpp -src/serverenvironment.cpp -src/serverenvironment.h -src/server.h -src/serverlist.cpp -src/serverlist.h -src/server/luaentity_sao.cpp -src/server/player_sao.cpp -src/server/serveractiveobject.cpp -src/server/serveractiveobject.h -src/settings.cpp -src/settings.h -src/settings_translation_file.cpp -src/shader.cpp -src/shader.h -src/sky.cpp -src/sound.cpp -src/staticobject.cpp -src/staticobject.h -src/subgame.cpp -src/subgame.h -src/terminal_chat_console.cpp -src/terminal_chat_console.h -src/texture_override.cpp -src/threading/atomic.h -src/threading/event.cpp -src/threading/mutex_auto_lock.h -src/threading/mutex.cpp -src/threading/mutex.h -src/threading/semaphore.cpp -src/threading/thread.cpp -src/threading/thread.h -src/threads.h -src/tileanimation.cpp -src/tool.cpp -src/tool.h -src/translation.cpp -src/unittest/test_areastore.cpp -src/unittest/test_collision.cpp -src/unittest/test_compression.cpp -src/unittest/test_connection.cpp -src/unittest/test.cpp -src/unittest/test_filepath.cpp -src/unittest/test.h -src/unittest/test_inventory.cpp -src/unittest/test_keycode.cpp -src/unittest/test_map_settings_manager.cpp -src/unittest/test_noderesolver.cpp -src/unittest/test_noise.cpp -src/unittest/test_random.cpp -src/unittest/test_schematic.cpp -src/unittest/test_serialization.cpp -src/unittest/test_settings.cpp -src/unittest/test_socket.cpp -src/unittest/test_threading.cpp -src/unittest/test_utilities.cpp -src/unittest/test_voxelalgorithms.cpp -src/unittest/test_voxelmanipulator.cpp -src/util/areastore.cpp -src/util/areastore.h -src/util/auth.cpp -src/util/auth.h -src/util/base64.cpp -src/util/base64.h -src/util/basic_macros.h -src/util/container.h -src/util/directiontables.cpp -src/util/directiontables.h -src/util/enriched_string.cpp -src/util/enriched_string.h -src/util/md32_common.h -src/util/numeric.cpp -src/util/numeric.h -src/util/pointedthing.cpp -src/util/pointedthing.h -src/util/pointer.h -src/util/quicktune.h -src/util/quicktune_shortcutter.h -src/util/quicktune.cpp -src/util/serialize.cpp -src/util/serialize.h -src/util/sha1.cpp -src/util/srp.cpp -src/util/srp.h -src/util/strfnd.h -src/util/string.cpp -src/util/string.h -src/util/thread.h -src/util/timetaker.cpp -src/util/timetaker.h -src/version.cpp -src/version.h -src/voxelalgorithms.cpp -src/voxelalgorithms.h -src/voxel.cpp -src/voxel.h -src/wieldmesh.cpp diff --git a/util/travis/clangtidy.sh b/util/travis/clangtidy.sh deleted file mode 100755 index ed6523b0b..000000000 --- a/util/travis/clangtidy.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -e -. util/travis/common.sh - -needs_compile || exit 0 - -if [ -z "${CLANG_TIDY}" ]; then - CLANG_TIDY=clang-tidy -fi - -mkdir -p cmakebuild && cd cmakebuild -cmake -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - -DRUN_IN_PLACE=TRUE \ - -DENABLE_GETTEXT=TRUE \ - -DENABLE_SOUND=FALSE \ - -DBUILD_SERVER=TRUE .. -make GenerateVersion -cd .. - -echo "Performing clang-tidy checks..." -./util/travis/run-clang-tidy.py \ - -clang-tidy-binary=${CLANG_TIDY} -p cmakebuild \ - -quiet -config="$(cat .clang-tidy)" \ - 'src/.*' - -RET=$? -echo "Clang tidy returned $RET" -exit $RET diff --git a/util/travis/common.sh b/util/travis/common.sh deleted file mode 100644 index cf9ce020e..000000000 --- a/util/travis/common.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -e - -set_linux_compiler_env() { - if [[ "${COMPILER}" == "gcc-6" ]]; then - export CC=gcc-6 - export CXX=g++-6 - elif [[ "${COMPILER}" == "gcc-8" ]]; then - export CC=gcc-8 - export CXX=g++-8 - elif [[ "${COMPILER}" == "clang-3.9" ]]; then - export CC=clang-3.9 - export CXX=clang++-3.9 - elif [[ "${COMPILER}" == "clang-9" ]]; then - export CC=clang-9 - export CXX=clang++-9 - fi -} - -# Linux build only -install_linux_deps() { - local pkgs=(libirrlicht-dev cmake libbz2-dev libpng-dev \ - libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \ - libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \ - gettext libpq-dev postgresql-server-dev-all libleveldb-dev) - # for better coverage, build some jobs with luajit - if [[ "$CC" == "clang"* && -z "$VALGRIND$FREETYPE" ]]; then - pkgs+=(libluajit-5.1-dev) - fi - - sudo apt-get update - sudo apt-get install -y --no-install-recommends ${pkgs[@]} -} - -# Mac OSX build only -install_macosx_deps() { - brew update - brew install freetype gettext hiredis irrlicht leveldb libogg libvorbis luajit - if brew ls | grep -q jpeg; then - brew upgrade jpeg - else - brew install jpeg - fi - #brew upgrade postgresql -} - -# Relative to git-repository root: -TRIGGER_COMPILE_PATHS="src/.*\.(c|cpp|h)|CMakeLists.txt|cmake/Modules/|util/travis/|util/buildbot/" - -needs_compile() { - RANGE="$TRAVIS_COMMIT_RANGE" - if [[ "$(git diff --name-only $RANGE -- 2>/dev/null)" == "" ]]; then - RANGE="$TRAVIS_COMMIT^...$TRAVIS_COMMIT" - echo "Fixed range: $RANGE" - fi - git diff --name-only $RANGE -- | egrep -q "^($TRIGGER_COMPILE_PATHS)" -} - diff --git a/util/travis/lint.sh b/util/travis/lint.sh deleted file mode 100644 index b3027c689..000000000 --- a/util/travis/lint.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! /bin/bash -function perform_lint() { - echo "Performing LINT..." - if [ -z "${CLANG_FORMAT}" ]; then - CLANG_FORMAT=clang-format - fi - echo "LINT: Using binary $CLANG_FORMAT" - CLANG_FORMAT_WHITELIST="util/travis/clang-format-whitelist.txt" - - files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" - - local errorcount=0 - local fail=0 - for f in ${files_to_lint}; do - d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true) - - if ! [ -z "$d" ]; then - whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST") - - # If file is not whitelisted, mark a failure - if [ -z "${whitelisted}" ]; then - errorcount=$((errorcount+1)) - - printf "The file %s is not compliant with the coding style" "$f" - if [ ${errorcount} -gt 50 ]; then - printf "\nToo many errors encountered previously, this diff is hidden.\n" - else - printf ":\n%s\n" "$d" - fi - - fail=1 - fi - fi - done - - if [ "$fail" = 1 ]; then - echo "LINT reports failure." - exit 1 - fi - - echo "LINT OK" -} - diff --git a/util/travis/run-clang-tidy.py b/util/travis/run-clang-tidy.py deleted file mode 100755 index 6ad0ff24f..000000000 --- a/util/travis/run-clang-tidy.py +++ /dev/null @@ -1,321 +0,0 @@ -#!/usr/bin/env python -# -#===- run-clang-tidy.py - Parallel clang-tidy runner ---------*- python -*--===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# -# FIXME: Integrate with clang-tidy-diff.py - -""" -Parallel clang-tidy runner -========================== - -Runs clang-tidy over all files in a compilation database. Requires clang-tidy -and clang-apply-replacements in $PATH. - -Example invocations. -- Run clang-tidy on all files in the current working directory with a default - set of checks and show warnings in the cpp files and all project headers. - run-clang-tidy.py $PWD - -- Fix all header guards. - run-clang-tidy.py -fix -checks=-*,llvm-header-guard - -- Fix all header guards included from clang-tidy and header guards - for clang-tidy headers. - run-clang-tidy.py -fix -checks=-*,llvm-header-guard extra/clang-tidy \ - -header-filter=extra/clang-tidy - -Compilation database setup: -http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html -""" - -from __future__ import print_function - -import argparse -import glob -import json -import multiprocessing -import os -import re -import shutil -import subprocess -import sys -import tempfile -import threading -import traceback - -try: - import yaml -except ImportError: - yaml = None - -is_py2 = sys.version[0] == '2' - -if is_py2: - import Queue as queue -else: - import queue as queue - -def find_compilation_database(path): - """Adjusts the directory until a compilation database is found.""" - result = './' - while not os.path.isfile(os.path.join(result, path)): - if os.path.realpath(result) == '/': - print('Error: could not find compilation database.') - sys.exit(1) - result += '../' - return os.path.realpath(result) - - -def make_absolute(f, directory): - if os.path.isabs(f): - return f - return os.path.normpath(os.path.join(directory, f)) - - -def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path, - header_filter, extra_arg, extra_arg_before, quiet, - config): - """Gets a command line for clang-tidy.""" - start = [clang_tidy_binary] - if header_filter is not None: - start.append('-header-filter=' + header_filter) - if checks: - start.append('-checks=' + checks) - if tmpdir is not None: - start.append('-export-fixes') - # Get a temporary file. We immediately close the handle so clang-tidy can - # overwrite it. - (handle, name) = tempfile.mkstemp(suffix='.yaml', dir=tmpdir) - os.close(handle) - start.append(name) - for arg in extra_arg: - start.append('-extra-arg=%s' % arg) - for arg in extra_arg_before: - start.append('-extra-arg-before=%s' % arg) - start.append('-p=' + build_path) - if quiet: - start.append('-quiet') - if config: - start.append('-config=' + config) - start.append(f) - return start - - -def merge_replacement_files(tmpdir, mergefile): - """Merge all replacement files in a directory into a single file""" - # The fixes suggested by clang-tidy >= 4.0.0 are given under - # the top level key 'Diagnostics' in the output yaml files - mergekey="Diagnostics" - merged=[] - for replacefile in glob.iglob(os.path.join(tmpdir, '*.yaml')): - content = yaml.safe_load(open(replacefile, 'r')) - if not content: - continue # Skip empty files. - merged.extend(content.get(mergekey, [])) - - if merged: - # MainSourceFile: The key is required by the definition inside - # include/clang/Tooling/ReplacementsYaml.h, but the value - # is actually never used inside clang-apply-replacements, - # so we set it to '' here. - output = { 'MainSourceFile': '', mergekey: merged } - with open(mergefile, 'w') as out: - yaml.safe_dump(output, out) - else: - # Empty the file: - open(mergefile, 'w').close() - - -def check_clang_apply_replacements_binary(args): - """Checks if invoking supplied clang-apply-replacements binary works.""" - try: - subprocess.check_call([args.clang_apply_replacements_binary, '--version']) - except: - print('Unable to run clang-apply-replacements. Is clang-apply-replacements ' - 'binary correctly specified?', file=sys.stderr) - traceback.print_exc() - sys.exit(1) - - -def apply_fixes(args, tmpdir): - """Calls clang-apply-fixes on a given directory.""" - invocation = [args.clang_apply_replacements_binary] - if args.format: - invocation.append('-format') - if args.style: - invocation.append('-style=' + args.style) - invocation.append(tmpdir) - subprocess.call(invocation) - - -def run_tidy(args, tmpdir, build_path, queue, lock, failed_files): - """Takes filenames out of queue and runs clang-tidy on them.""" - while True: - name = queue.get() - invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks, - tmpdir, build_path, args.header_filter, - args.extra_arg, args.extra_arg_before, - args.quiet, args.config) - - proc = subprocess.Popen(invocation) - proc.wait() - if proc.returncode != 0: - failed_files.append(name) - queue.task_done() - - -def main(): - parser = argparse.ArgumentParser(description='Runs clang-tidy over all files ' - 'in a compilation database. Requires ' - 'clang-tidy and clang-apply-replacements in ' - '$PATH.') - parser.add_argument('-clang-tidy-binary', metavar='PATH', - default='clang-tidy', - help='path to clang-tidy binary') - parser.add_argument('-clang-apply-replacements-binary', metavar='PATH', - default='clang-apply-replacements', - help='path to clang-apply-replacements binary') - parser.add_argument('-checks', default=None, - help='checks filter, when not specified, use clang-tidy ' - 'default') - parser.add_argument('-config', default=None, - help='Specifies a configuration in YAML/JSON format: ' - ' -config="{Checks: \'*\', ' - ' CheckOptions: [{key: x, ' - ' value: y}]}" ' - 'When the value is empty, clang-tidy will ' - 'attempt to find a file named .clang-tidy for ' - 'each source file in its parent directories.') - parser.add_argument('-header-filter', default=None, - help='regular expression matching the names of the ' - 'headers to output diagnostics from. Diagnostics from ' - 'the main file of each translation unit are always ' - 'displayed.') - if yaml: - parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes', - help='Create a yaml file to store suggested fixes in, ' - 'which can be applied with clang-apply-replacements.') - parser.add_argument('-j', type=int, default=0, - help='number of tidy instances to be run in parallel.') - parser.add_argument('files', nargs='*', default=['.*'], - help='files to be processed (regex on path)') - parser.add_argument('-fix', action='store_true', help='apply fix-its') - parser.add_argument('-format', action='store_true', help='Reformat code ' - 'after applying fixes') - parser.add_argument('-style', default='file', help='The style of reformat ' - 'code after applying fixes') - parser.add_argument('-p', dest='build_path', - help='Path used to read a compile command database.') - parser.add_argument('-extra-arg', dest='extra_arg', - action='append', default=[], - help='Additional argument to append to the compiler ' - 'command line.') - parser.add_argument('-extra-arg-before', dest='extra_arg_before', - action='append', default=[], - help='Additional argument to prepend to the compiler ' - 'command line.') - parser.add_argument('-quiet', action='store_true', - help='Run clang-tidy in quiet mode') - args = parser.parse_args() - - db_path = 'compile_commands.json' - - if args.build_path is not None: - build_path = args.build_path - else: - # Find our database - build_path = find_compilation_database(db_path) - - try: - invocation = [args.clang_tidy_binary, '-list-checks'] - invocation.append('-p=' + build_path) - if args.checks: - invocation.append('-checks=' + args.checks) - invocation.append('-') - if args.quiet: - # Even with -quiet we still want to check if we can call clang-tidy. - with open(os.devnull, 'w') as dev_null: - subprocess.check_call(invocation, stdout=dev_null) - else: - subprocess.check_call(invocation) - except: - print("Unable to run clang-tidy.", file=sys.stderr) - sys.exit(1) - - # Load the database and extract all files. - database = json.load(open(os.path.join(build_path, db_path))) - files = [make_absolute(entry['file'], entry['directory']) - for entry in database] - - max_task = args.j - if max_task == 0: - max_task = multiprocessing.cpu_count() - - tmpdir = None - if args.fix or (yaml and args.export_fixes): - check_clang_apply_replacements_binary(args) - tmpdir = tempfile.mkdtemp() - - # Build up a big regexy filter from all command line arguments. - file_name_re = re.compile('|'.join(args.files)) - - return_code = 0 - try: - # Spin up a bunch of tidy-launching threads. - task_queue = queue.Queue(max_task) - # List of files with a non-zero return code. - failed_files = [] - lock = threading.Lock() - for _ in range(max_task): - t = threading.Thread(target=run_tidy, - args=(args, tmpdir, build_path, task_queue, lock, failed_files)) - t.daemon = True - t.start() - - # Fill the queue with files. - for name in files: - if file_name_re.search(name): - task_queue.put(name) - - # Wait for all threads to be done. - task_queue.join() - if len(failed_files): - return_code = 1 - - except KeyboardInterrupt: - # This is a sad hack. Unfortunately subprocess goes - # bonkers with ctrl-c and we start forking merrily. - print('\nCtrl-C detected, goodbye.') - if tmpdir: - shutil.rmtree(tmpdir) - os.kill(0, 9) - - if yaml and args.export_fixes: - print('Writing fixes to ' + args.export_fixes + ' ...') - try: - merge_replacement_files(tmpdir, args.export_fixes) - except: - print('Error exporting fixes.\n', file=sys.stderr) - traceback.print_exc() - return_code=1 - - if args.fix: - print('Applying fixes ...') - try: - apply_fixes(args, tmpdir) - except: - print('Error applying fixes.\n', file=sys.stderr) - traceback.print_exc() - return_code=1 - - if tmpdir: - shutil.rmtree(tmpdir) - sys.exit(return_code) - -if __name__ == '__main__': - main() diff --git a/util/travis/script.sh b/util/travis/script.sh deleted file mode 100755 index 19aa2fdf7..000000000 --- a/util/travis/script.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -e -. util/travis/common.sh -. util/travis/lint.sh - -needs_compile || exit 0 - -if [[ ! -z "${CLANG_FORMAT}" ]]; then - # Lint and exit CI - perform_lint - exit 0 -fi - -set_linux_compiler_env - -if [[ ${PLATFORM} == "Unix" ]]; then - mkdir -p travisbuild - cd travisbuild || exit 1 - - CMAKE_FLAGS='' - - if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then - CMAKE_FLAGS+=' -DCUSTOM_GETTEXT_PATH=/usr/local/opt/gettext' - fi - - if [[ -n "${FREETYPE}" ]] && [[ "${FREETYPE}" == "0" ]]; then - CMAKE_FLAGS+=' -DENABLE_FREETYPE=0' - fi - - cmake -DCMAKE_BUILD_TYPE=Debug \ - -DRUN_IN_PLACE=TRUE \ - -DENABLE_GETTEXT=TRUE \ - -DBUILD_SERVER=TRUE \ - ${CMAKE_FLAGS} .. - make -j2 - - echo "Running unit tests." - CMD="../bin/minetest --run-unittests" - if [[ "${VALGRIND}" == "1" ]]; then - valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0 - else - ${CMD} && exit 0 - fi - -elif [[ $PLATFORM == Win* ]]; then - [[ $CC == "clang" ]] && exit 1 # Not supposed to happen - # We need to have our build directory outside of the minetest directory because - # CMake will otherwise get very very confused with symlinks and complain that - # something is not a subdirectory of something even if it actually is. - # e.g.: - # /home/travis/minetest/minetest/travisbuild/minetest - # \/ \/ \/ - # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest - # \/ \/ \/ - # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest/travisbuild/minetest - # You get the idea. - OLDDIR=$(pwd) - cd .. - export EXISTING_MINETEST_DIR=$OLDDIR - export NO_MINETEST_GAME=1 - if [[ $PLATFORM == "Win32" ]]; then - "$OLDDIR/util/buildbot/buildwin32.sh" travisbuild && exit 0 - elif [[ $PLATFORM == "Win64" ]]; then - "$OLDDIR/util/buildbot/buildwin64.sh" travisbuild && exit 0 - fi -else - echo "Unknown platform \"${PLATFORM}\"." - exit 1 -fi - diff --git a/util/travis/toolchain_mingw.cmake.in b/util/travis/toolchain_mingw.cmake.in deleted file mode 100644 index 65f67517e..000000000 --- a/util/travis/toolchain_mingw.cmake.in +++ /dev/null @@ -1,18 +0,0 @@ -# Target operating system name -set(CMAKE_SYSTEM_NAME Windows) - -# Compilers to use -set(CMAKE_C_COMPILER %PREFIX%-gcc) -set(CMAKE_CXX_COMPILER %PREFIX%-g++) -set(CMAKE_RC_COMPILER %PREFIX%-windres) - -# Location of the target environment -set(CMAKE_FIND_ROOT_PATH %ROOTPATH%) - -# Adjust the default behaviour of the FIND_XXX() commands: -# search for headers and libraries in the target environment, -# search for programs in the host environment -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - -- cgit v1.2.3 From 56bababcdfce097a4e08cc3d1de8d798e7999ce7 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 27 Apr 2020 08:31:37 +0200 Subject: Add MetricsBackend with prometheus counter support --- Dockerfile | 22 +++++-- README.md | 1 + builtin/settingtypes.txt | 6 ++ src/CMakeLists.txt | 26 ++++++++ src/cmake_config.h.in | 1 + src/defaultsettings.cpp | 3 + src/map.cpp | 11 +++- src/map.h | 6 +- src/server.cpp | 57 ++++++++++++---- src/server.h | 21 ++++-- src/server/mods.cpp | 1 + src/server/mods.h | 3 + src/util/CMakeLists.txt | 1 + src/util/metricsbackend.cpp | 140 ++++++++++++++++++++++++++++++++++++++++ src/util/metricsbackend.h | 140 ++++++++++++++++++++++++++++++++++++++++ util/ci/build_prometheus_cpp.sh | 13 ++++ 16 files changed, 427 insertions(+), 25 deletions(-) create mode 100644 src/util/metricsbackend.cpp create mode 100644 src/util/metricsbackend.h create mode 100755 util/ci/build_prometheus_cpp.sh (limited to 'util') diff --git a/Dockerfile b/Dockerfile index 7c1107288..72343ab9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,15 +21,29 @@ WORKDIR /usr/src/minetest RUN apk add --no-cache git build-base irrlicht-dev cmake bzip2-dev libpng-dev \ jpeg-dev libxxf86vm-dev mesa-dev sqlite-dev libogg-dev \ libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev \ - gmp-dev jsoncpp-dev postgresql-dev && \ + gmp-dev jsoncpp-dev postgresql-dev ca-certificates && \ git clone --depth=1 -b ${MINETEST_GAME_VERSION} https://github.com/minetest/minetest_game.git ./games/minetest_game && \ - rm -fr ./games/minetest_game/.git && \ - mkdir build && \ + rm -fr ./games/minetest_game/.git + +WORKDIR /usr/src/ +RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp/ && \ + mkdir prometheus-cpp/build && \ + cd prometheus-cpp/build && \ + cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_TESTING=0 && \ + make -j2 && \ + make install + +WORKDIR /usr/src/minetest +RUN mkdir build && \ cd build && \ cmake .. \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SERVER=TRUE \ + -DENABLE_PROMETHEUS=TRUE \ -DBUILD_UNITTESTS=FALSE \ -DBUILD_CLIENT=FALSE && \ make -j2 && \ @@ -49,6 +63,6 @@ COPY --from=0 /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/ USER minetest:minetest -EXPOSE 30000/udp +EXPOSE 30000/udp 30000/tcp CMD ["/usr/local/bin/minetestserver", "--config", "/etc/minetest/minetest.conf"] diff --git a/README.md b/README.md index b3b2b863e..024e7b691 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ General options and their default values: ENABLE_SPATIAL=ON - Build with LibSpatial; Speeds up AreaStores ENABLE_SOUND=ON - Build with OpenAL, libogg & libvorbis; in-game sounds ENABLE_LUAJIT=ON - Build with LuaJIT (much faster than non-JIT Lua) + ENABLE_PROMETHEUS=OFF - Build with Prometheus metrics exporter (listens on tcp/30000 by default) ENABLE_SYSTEM_GMP=ON - Use GMP from system (much faster than bundled mini-gmp) ENABLE_SYSTEM_JSONCPP=OFF - Use JsonCPP from system OPENGL_GL_PREFERENCE=LEGACY - Linux client build only; See CMake Policy CMP0072 for reference diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index b9228f384..165ed8c06 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -955,6 +955,12 @@ address (Server address) string # Note that the port field in the main menu overrides this setting. remote_port (Remote port) int 30000 1 65535 +# Prometheus listener address. +# If minetest is compiled with ENABLE_PROMETHEUS option enabled, +# enable metrics listener for Prometheus on that address. +# Metrics can be fetch on http://127.0.0.1:30000/metrics +prometheus_listener_address (Prometheus listener address) string 127.0.0.1:30000 + # Save the map received by the client on disk. enable_local_map_saving (Saving map received from server) bool false diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b416faaf3..710d9e13e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -217,6 +217,26 @@ endif(ENABLE_REDIS) find_package(SQLite3 REQUIRED) +OPTION(ENABLE_PROMETHEUS "Enable prometheus client support" FALSE) +set(USE_PROMETHEUS FALSE) + +if(ENABLE_PROMETHEUS) + find_path(PROMETHEUS_CPP_INCLUDE_DIR NAMES prometheus/counter.h) + find_library(PROMETHEUS_PULL_LIBRARY NAMES prometheus-cpp-pull) + find_library(PROMETHEUS_CORE_LIBRARY NAMES prometheus-cpp-core) + if(PROMETHEUS_CPP_INCLUDE_DIR AND PROMETHEUS_PULL_LIBRARY AND PROMETHEUS_CORE_LIBRARY) + set(PROMETHEUS_LIBRARIES ${PROMETHEUS_PULL_LIBRARY} ${PROMETHEUS_CORE_LIBRARY}) + set(USE_PROMETHEUS TRUE) + include_directories(${PROMETHEUS_CPP_INCLUDE_DIR}) + endif(PROMETHEUS_CPP_INCLUDE_DIR AND PROMETHEUS_PULL_LIBRARY AND PROMETHEUS_CORE_LIBRARY) +endif(ENABLE_PROMETHEUS) + +if(USE_PROMETHEUS) + message(STATUS "Prometheus client enabled.") +else(USE_PROMETHEUS) + message(STATUS "Prometheus client disabled.") +endif(USE_PROMETHEUS) + OPTION(ENABLE_SPATIAL "Enable SpatialIndex AreaStore backend" TRUE) set(USE_SPATIAL FALSE) @@ -597,6 +617,9 @@ if(BUILD_CLIENT) if (USE_REDIS) target_link_libraries(${PROJECT_NAME} ${REDIS_LIBRARY}) endif() + if (USE_PROMETHEUS) + target_link_libraries(${PROJECT_NAME} ${PROMETHEUS_LIBRARIES}) + endif() if (USE_SPATIAL) target_link_libraries(${PROJECT_NAME} ${SPATIAL_LIBRARY}) endif() @@ -632,6 +655,9 @@ if(BUILD_SERVER) if (USE_REDIS) target_link_libraries(${PROJECT_NAME}server ${REDIS_LIBRARY}) endif() + if (USE_PROMETHEUS) + target_link_libraries(${PROJECT_NAME}server ${PROMETHEUS_LIBRARIES}) + endif() if (USE_SPATIAL) target_link_libraries(${PROJECT_NAME}server ${SPATIAL_LIBRARY}) endif() diff --git a/src/cmake_config.h.in b/src/cmake_config.h.in index cac6335d4..cfcee4b58 100644 --- a/src/cmake_config.h.in +++ b/src/cmake_config.h.in @@ -23,6 +23,7 @@ #cmakedefine01 USE_LEVELDB #cmakedefine01 USE_LUAJIT #cmakedefine01 USE_POSTGRESQL +#cmakedefine01 USE_PROMETHEUS #cmakedefine01 USE_SPATIAL #cmakedefine01 USE_SYSTEM_GMP #cmakedefine01 USE_REDIS diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index b6b1ce1f2..06daa3b94 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -334,6 +334,9 @@ void set_default_settings(Settings *settings) // Server settings->setDefault("disable_escape_sequences", "false"); settings->setDefault("strip_color_codes", "false"); +#if USE_PROMETHEUS + settings->setDefault("prometheus_listener_address", "127.0.0.1:30000"); +#endif // Network settings->setDefault("enable_ipv6", "true"); diff --git a/src/map.cpp b/src/map.cpp index 12e122124..5f1b984a4 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -144,7 +144,7 @@ bool Map::isNodeUnderground(v3s16 p) { v3s16 blockpos = getNodeBlockPos(p); MapBlock *block = getBlockNoCreateNoEx(blockpos); - return block && block->getIsUnderground(); + return block && block->getIsUnderground(); } bool Map::isValidPosition(v3s16 p) @@ -1187,7 +1187,7 @@ bool Map::isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes) ServerMap */ ServerMap::ServerMap(const std::string &savedir, IGameDef *gamedef, - EmergeManager *emerge): + EmergeManager *emerge, MetricsBackend *mb): Map(dout_server, gamedef), settings_mgr(g_settings, savedir + DIR_DELIM + "map_meta.txt"), m_emerge(emerge) @@ -1221,6 +1221,8 @@ ServerMap::ServerMap(const std::string &savedir, IGameDef *gamedef, m_savedir = savedir; m_map_saving_enabled = false; + m_save_time_counter = mb->addCounter("minetest_core_map_save_time", "Map save time (in nanoseconds)"); + try { // If directory exists, check contents and load if possible if (fs::PathExists(m_savedir)) { @@ -1777,6 +1779,8 @@ void ServerMap::save(ModifiedState save_level) return; } + u64 start_time = porting::getTimeNs(); + if(save_level == MOD_STATE_CLEAN) infostream<<"ServerMap: Saving whole map, this can take time." <increment(end_time - start_time); } void ServerMap::listAllLoadableBlocks(std::vector &dst) diff --git a/src/map.h b/src/map.h index ff6b20c4f..77ee4da9e 100644 --- a/src/map.h +++ b/src/map.h @@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "voxel.h" #include "modifiedstate.h" #include "util/container.h" +#include "util/metricsbackend.h" #include "nodetimer.h" #include "map_settings_manager.h" #include "debug.h" @@ -45,6 +46,7 @@ class NodeMetadata; class IGameDef; class IRollbackManager; class EmergeManager; +class MetricsBackend; class ServerEnvironment; struct BlockMakeData; @@ -324,7 +326,7 @@ public: /* savedir: directory to which map data should be saved */ - ServerMap(const std::string &savedir, IGameDef *gamedef, EmergeManager *emerge); + ServerMap(const std::string &savedir, IGameDef *gamedef, EmergeManager *emerge, MetricsBackend *mb); ~ServerMap(); s32 mapType() const @@ -449,6 +451,8 @@ private: bool m_map_metadata_changed = true; MapDatabase *dbase = nullptr; MapDatabase *dbase_ro = nullptr; + + MetricCounterPtr m_save_time_counter; }; diff --git a/src/server.cpp b/src/server.cpp index af6d3e40d..a7eb52837 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -229,18 +229,46 @@ Server::Server( m_nodedef(createNodeDefManager()), m_craftdef(createCraftDefManager()), m_thread(new ServerThread(this)), - m_uptime(0), m_clients(m_con), m_admin_chat(iface), m_modchannel_mgr(new ModChannelMgr()) { - m_lag = g_settings->getFloat("dedicated_server_step"); - if (m_path_world.empty()) throw ServerError("Supplied empty world path"); if (!gamespec.isValid()) throw ServerError("Supplied invalid gamespec"); + +#if USE_PROMETHEUS + m_metrics_backend = std::unique_ptr(createPrometheusMetricsBackend()); +#else + m_metrics_backend = std::unique_ptr(new MetricsBackend()); +#endif + + m_uptime_counter = m_metrics_backend->addCounter("minetest_core_server_uptime", "Server uptime (in seconds)"); + m_player_gauge = m_metrics_backend->addGauge("minetest_core_player_number", "Number of connected players"); + + m_timeofday_gauge = m_metrics_backend->addGauge( + "minetest_core_timeofday", + "Time of day value"); + + m_lag_gauge = m_metrics_backend->addGauge( + "minetest_core_latency", + "Latency value (in seconds)"); + + m_aom_buffer_counter = m_metrics_backend->addCounter( + "minetest_core_aom_generated_count", + "Number of active object messages generated"); + + m_packet_recv_counter = m_metrics_backend->addCounter( + "minetest_core_server_packet_recv", + "Processable packets received"); + + m_packet_recv_processed_counter = m_metrics_backend->addCounter( + "minetest_core_server_packet_recv_processed", + "Valid received packets processed"); + + m_lag_gauge->set(g_settings->getFloat("dedicated_server_step")); } Server::~Server() @@ -353,7 +381,7 @@ void Server::init() MutexAutoLock envlock(m_env_mutex); // Create the Map (loads map_meta.txt, overriding configured mapgen params) - ServerMap *servermap = new ServerMap(m_path_world, this, m_emerge); + ServerMap *servermap = new ServerMap(m_path_world, this, m_emerge, m_metrics_backend.get()); // Initialize scripting infostream << "Server: Initializing Lua" << std::endl; @@ -511,9 +539,7 @@ void Server::AsyncRunStep(bool initial_step) /* Update uptime */ - { - m_uptime.set(m_uptime.get() + dtime); - } + m_uptime_counter->increment(dtime); handlePeerChanges(); @@ -527,11 +553,13 @@ void Server::AsyncRunStep(bool initial_step) */ m_time_of_day_send_timer -= dtime; - if(m_time_of_day_send_timer < 0.0) { + if (m_time_of_day_send_timer < 0.0) { m_time_of_day_send_timer = g_settings->getFloat("time_send_interval"); u16 time = m_env->getTimeOfDay(); float time_speed = g_settings->getFloat("time_speed"); SendTimeOfDay(PEER_ID_INEXISTENT, time, time_speed); + + m_timeofday_gauge->set(time); } { @@ -603,7 +631,7 @@ void Server::AsyncRunStep(bool initial_step) } m_clients.step(dtime); - m_lag += (m_lag > dtime ? -1 : 1) * dtime/100; + m_lag_gauge->increment((m_lag_gauge->get() > dtime ? -1 : 1) * dtime/100); #if USE_CURL // send masterserver announce { @@ -614,9 +642,9 @@ void Server::AsyncRunStep(bool initial_step) ServerList::AA_START, m_bind_addr.getPort(), m_clients.getPlayerNames(), - m_uptime.get(), + m_uptime_counter->get(), m_env->getGameTime(), - m_lag, + m_lag_gauge->get(), m_gamespec.id, Mapgen::getMapgenName(m_emerge->mgparams->mgtype), m_modmgr->getMods(), @@ -638,6 +666,7 @@ void Server::AsyncRunStep(bool initial_step) const RemoteClientMap &clients = m_clients.getClientList(); ScopeProfiler sp(g_profiler, "Server: update objects within range"); + m_player_gauge->set(clients.size()); for (const auto &client_it : clients) { RemoteClient *client = client_it.second; @@ -703,6 +732,8 @@ void Server::AsyncRunStep(bool initial_step) message_list->push_back(aom); } + m_aom_buffer_counter->increment(buffered_messages.size()); + m_clients.lock(); const RemoteClientMap &clients = m_clients.getClientList(); // Route data to every client @@ -943,7 +974,9 @@ void Server::Receive() } peer_id = pkt.getPeerId(); + m_packet_recv_counter->increment(); ProcessData(&pkt); + m_packet_recv_processed_counter->increment(); } catch (const con::InvalidIncomingDataException &e) { infostream << "Server::Receive(): InvalidIncomingDataException: what()=" << e.what() << std::endl; @@ -3127,7 +3160,7 @@ std::wstring Server::getStatusString() // Version os << L"version=" << narrow_to_wide(g_version_string); // Uptime - os << L", uptime=" << m_uptime.get(); + os << L", uptime=" << m_uptime_counter->get(); // Max lag estimate os << L", max_lag=" << (m_env ? m_env->getMaxLagEstimate() : 0); diff --git a/src/server.h b/src/server.h index b995aba28..71059dd30 100644 --- a/src/server.h +++ b/src/server.h @@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/numeric.h" #include "util/thread.h" #include "util/basic_macros.h" +#include "util/metricsbackend.h" #include "serverenvironment.h" #include "clientiface.h" #include "chatmessage.h" @@ -203,7 +204,7 @@ public: // Connection must be locked when called std::wstring getStatusString(); - inline double getUptime() const { return m_uptime.m_value; } + inline double getUptime() const { return m_uptime_counter->get(); } // read shutdown state inline bool isShutdownRequested() const { return m_shutdown_state.is_requested; } @@ -591,9 +592,6 @@ private: float m_step_dtime = 0.0f; std::mutex m_step_dtime_mutex; - // current server step lag counter - float m_lag; - // The server mainly operates in this thread ServerThread *m_thread = nullptr; @@ -602,8 +600,6 @@ private: */ // Timer for sending time of day over network float m_time_of_day_send_timer = 0.0f; - // Uptime of server in seconds - MutexedVariable m_uptime; /* Client interface @@ -677,6 +673,19 @@ private: // ModChannel manager std::unique_ptr m_modchannel_mgr; + + // Global server metrics backend + std::unique_ptr m_metrics_backend; + + // Server metrics + MetricCounterPtr m_uptime_counter; + MetricGaugePtr m_player_gauge; + MetricGaugePtr m_timeofday_gauge; + // current server step lag + MetricGaugePtr m_lag_gauge; + MetricCounterPtr m_aom_buffer_counter; + MetricCounterPtr m_packet_recv_counter; + MetricCounterPtr m_packet_recv_processed_counter; }; /* diff --git a/src/server/mods.cpp b/src/server/mods.cpp index c8d8a28e2..6ac530739 100644 --- a/src/server/mods.cpp +++ b/src/server/mods.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "scripting_server.h" #include "content/subgames.h" #include "porting.h" +#include "util/metricsbackend.h" /** * Manage server mods diff --git a/src/server/mods.h b/src/server/mods.h index 2bc1aa22f..54774bd86 100644 --- a/src/server/mods.h +++ b/src/server/mods.h @@ -20,7 +20,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "content/mods.h" +#include +class MetricsBackend; +class MetricCounter; class ServerScripting; /** diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 199d3aeaa..cd2e468d1 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -5,6 +5,7 @@ set(UTIL_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/directiontables.cpp ${CMAKE_CURRENT_SOURCE_DIR}/enriched_string.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ieee_float.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/metricsbackend.cpp ${CMAKE_CURRENT_SOURCE_DIR}/numeric.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pointedthing.cpp ${CMAKE_CURRENT_SOURCE_DIR}/quicktune.cpp diff --git a/src/util/metricsbackend.cpp b/src/util/metricsbackend.cpp new file mode 100644 index 000000000..4454557a3 --- /dev/null +++ b/src/util/metricsbackend.cpp @@ -0,0 +1,140 @@ +/* +Minetest +Copyright (C) 2013-2020 Minetest core developers team + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "metricsbackend.h" +#if USE_PROMETHEUS +#include +#include +#include +#include +#include "log.h" +#include "settings.h" +#endif + +MetricCounterPtr MetricsBackend::addCounter( + const std::string &name, const std::string &help_str) +{ + return std::make_shared(name, help_str); +} + +MetricGaugePtr MetricsBackend::addGauge( + const std::string &name, const std::string &help_str) +{ + return std::make_shared(name, help_str); +} + +#if USE_PROMETHEUS + +class PrometheusMetricCounter : public MetricCounter +{ +public: + PrometheusMetricCounter() = delete; + + PrometheusMetricCounter(const std::string &name, const std::string &help_str, + std::shared_ptr registry) : + MetricCounter(), + m_family(prometheus::BuildCounter() + .Name(name) + .Help(help_str) + .Register(*registry)), + m_counter(m_family.Add({})) + { + } + + virtual ~PrometheusMetricCounter() {} + + virtual void increment(double number) { m_counter.Increment(number); } + virtual double get() const { return m_counter.Value(); } + +private: + prometheus::Family &m_family; + prometheus::Counter &m_counter; +}; + +class PrometheusMetricGauge : public MetricGauge +{ +public: + PrometheusMetricGauge() = delete; + + PrometheusMetricGauge(const std::string &name, const std::string &help_str, + std::shared_ptr registry) : + MetricGauge(), + m_family(prometheus::BuildGauge() + .Name(name) + .Help(help_str) + .Register(*registry)), + m_gauge(m_family.Add({})) + { + } + + virtual ~PrometheusMetricGauge() {} + + virtual void increment(double number) { m_gauge.Increment(number); } + virtual void decrement(double number) { m_gauge.Decrement(number); } + virtual void set(double number) { m_gauge.Set(number); } + virtual double get() const { return m_gauge.Value(); } + +private: + prometheus::Family &m_family; + prometheus::Gauge &m_gauge; +}; + +class PrometheusMetricsBackend : public MetricsBackend +{ +public: + PrometheusMetricsBackend(const std::string &addr) : + MetricsBackend(), m_exposer(std::unique_ptr( + new prometheus::Exposer(addr))), + m_registry(std::make_shared()) + { + m_exposer->RegisterCollectable(m_registry); + } + + virtual ~PrometheusMetricsBackend() {} + + virtual MetricCounterPtr addCounter( + const std::string &name, const std::string &help_str); + virtual MetricGaugePtr addGauge( + const std::string &name, const std::string &help_str); + +private: + std::unique_ptr m_exposer; + std::shared_ptr m_registry; +}; + +MetricCounterPtr PrometheusMetricsBackend::addCounter( + const std::string &name, const std::string &help_str) +{ + return std::make_shared(name, help_str, m_registry); +} + +MetricGaugePtr PrometheusMetricsBackend::addGauge( + const std::string &name, const std::string &help_str) +{ + return std::make_shared(name, help_str, m_registry); +} + +MetricsBackend *createPrometheusMetricsBackend() +{ + std::string addr; + g_settings->getNoEx("prometheus_listener_address", addr); + return new PrometheusMetricsBackend(addr); +} + +#endif diff --git a/src/util/metricsbackend.h b/src/util/metricsbackend.h new file mode 100644 index 000000000..c37306392 --- /dev/null +++ b/src/util/metricsbackend.h @@ -0,0 +1,140 @@ +/* +Minetest +Copyright (C) 2013-2020 Minetest core developers team + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#pragma once +#include +#include "config.h" +#include "util/thread.h" + +class MetricCounter +{ +public: + MetricCounter() = default; + + virtual ~MetricCounter() {} + + virtual void increment(double number = 1.0) = 0; + virtual double get() const = 0; +}; + +typedef std::shared_ptr MetricCounterPtr; + +class SimpleMetricCounter : public MetricCounter +{ +public: + SimpleMetricCounter() = delete; + + virtual ~SimpleMetricCounter() {} + + SimpleMetricCounter(const std::string &name, const std::string &help_str) : + MetricCounter(), m_name(name), m_help_str(help_str), + m_counter(0.0) + { + } + + virtual void increment(double number) + { + MutexAutoLock lock(m_mutex); + m_counter += number; + } + virtual double get() const + { + MutexAutoLock lock(m_mutex); + return m_counter; + } + +private: + std::string m_name; + std::string m_help_str; + + mutable std::mutex m_mutex; + double m_counter; +}; + +class MetricGauge +{ +public: + MetricGauge() = default; + virtual ~MetricGauge() {} + + virtual void increment(double number = 1.0) = 0; + virtual void decrement(double number = 1.0) = 0; + virtual void set(double number) = 0; + virtual double get() const = 0; +}; + +typedef std::shared_ptr MetricGaugePtr; + +class SimpleMetricGauge : public MetricGauge +{ +public: + SimpleMetricGauge() = delete; + + SimpleMetricGauge(const std::string &name, const std::string &help_str) : + MetricGauge(), m_name(name), m_help_str(help_str), m_gauge(0.0) + { + } + + virtual ~SimpleMetricGauge() {} + + virtual void increment(double number) + { + MutexAutoLock lock(m_mutex); + m_gauge += number; + } + virtual void decrement(double number) + { + MutexAutoLock lock(m_mutex); + m_gauge -= number; + } + virtual void set(double number) + { + MutexAutoLock lock(m_mutex); + m_gauge = number; + } + virtual double get() const + { + MutexAutoLock lock(m_mutex); + return m_gauge; + } + +private: + std::string m_name; + std::string m_help_str; + + mutable std::mutex m_mutex; + double m_gauge; +}; + +class MetricsBackend +{ +public: + MetricsBackend() = default; + + virtual ~MetricsBackend() {} + + virtual MetricCounterPtr addCounter( + const std::string &name, const std::string &help_str); + virtual MetricGaugePtr addGauge( + const std::string &name, const std::string &help_str); +}; + +#if USE_PROMETHEUS +MetricsBackend *createPrometheusMetricsBackend(); +#endif diff --git a/util/ci/build_prometheus_cpp.sh b/util/ci/build_prometheus_cpp.sh new file mode 100755 index 000000000..edfd574cd --- /dev/null +++ b/util/ci/build_prometheus_cpp.sh @@ -0,0 +1,13 @@ +#! /bin/bash -eu + +cd /tmp +git clone --recursive https://github.com/jupp0r/prometheus-cpp +mkdir prometheus-cpp/build +cd prometheus-cpp/build +cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_TESTING=0 +make -j2 +sudo make install + -- cgit v1.2.3 From 61d93988d8b44a9905451c4c288e02c04d41abb0 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 2 May 2020 12:52:51 +0200 Subject: ci: Update Github Actions workflows (#9774) --- .github/workflows/build.yml | 45 ++++++++++++++++++++++++++++-------------- .github/workflows/cpp_lint.yml | 9 +++++---- .github/workflows/lua_lint.yml | 2 +- util/ci/build.sh | 2 +- util/ci/clang-tidy.sh | 3 +-- util/ci/common.sh | 16 --------------- 6 files changed, 38 insertions(+), 39 deletions(-) (limited to 'util') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c4d3abd1..91ed8fd43 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Install compiler + - name: Install deps run: | sudo apt-get install g++-6 gcc-6 -qyy source ./util/ci/common.sh @@ -41,7 +41,8 @@ jobs: run: | ./util/ci/build.sh env: - CMAKE_FLAGS: "-DCMAKE_C_COMPILER=gcc-6 -DCMAKE_CXX_COMPILER=g++-6" + CC: gcc-6 + CXX: g++-6 - name: Test run: | @@ -52,7 +53,7 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Install compiler + - name: Install deps run: | sudo apt-get install g++-8 gcc-8 -qyy source ./util/ci/common.sh @@ -62,7 +63,8 @@ jobs: run: | ./util/ci/build.sh env: - CMAKE_FLAGS: "-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8" + CC: gcc-8 + CXX: g++-8 - name: Test run: | @@ -73,7 +75,7 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Install compiler + - name: Install deps run: | sudo apt-get install clang-3.9 -qyy source ./util/ci/common.sh @@ -83,7 +85,8 @@ jobs: run: | ./util/ci/build.sh env: - CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-3.9 -DCMAKE_CXX_COMPILER=clang++-3.9" + CC: clang-3.9 + CXX: clang++-3.9 - name: Test run: | @@ -94,7 +97,7 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Install compiler + - name: Install deps run: | sudo apt-get install clang-9 valgrind -qyy source ./util/ci/common.sh @@ -106,7 +109,8 @@ jobs: run: | ./util/ci/build.sh env: - CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9" + CC: clang-9 + CXX: clang++-9 - name: Test run: | @@ -116,12 +120,13 @@ jobs: run: | valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ./bin/minetest --run-unittests - + # Build with prometheus-cpp (server-only) clang_9_prometheus: + name: "clang_9 (PROMETHEUS=1)" runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Install compiler + - name: Install deps run: | sudo apt-get install clang-9 -qyy source ./util/ci/common.sh @@ -135,18 +140,21 @@ jobs: run: | ./util/ci/build.sh env: - CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DENABLE_PROMETHEUS=1" + CC: clang-9 + CXX: clang++-9 + CMAKE_FLAGS: "-DENABLE_PROMETHEUS=1 -DBUILD_CLIENT=0" - name: Test run: | - ./bin/minetest --run-unittests + ./bin/minetestserver --run-unittests - # Some builds doesn't require freetype, ensure it compiled properly + # Build without freetype (client-only) clang_9_no_freetype: + name: "clang_9 (FREETYPE=0)" runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Install compiler + - name: Install deps run: | sudo apt-get install clang-9 -qyy source ./util/ci/common.sh @@ -156,13 +164,16 @@ jobs: run: | ./util/ci/build.sh env: - CMAKE_FLAGS: "-DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DENABLE_FREETYPE=0" + CC: clang-9 + CXX: clang++-9 + CMAKE_FLAGS: "-DENABLE_FREETYPE=0 -DBUILD_SERVER=0" - name: Test run: | ./bin/minetest --run-unittests docker: + name: "Docker image" runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 @@ -171,11 +182,13 @@ jobs: docker build . win32: + name: "MinGW cross-compiler (32-bit)" runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - name: Install compiler run: | + sudo apt-get install gettext -qyy wget http://minetest.kitsunemimi.pw/mingw-w64-i686_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz sudo tar -xaf mingw.tar.xz -C /usr @@ -187,11 +200,13 @@ jobs: NO_PACKAGE: 1 win64: + name: "MinGW cross-compiler (64-bit)" runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - name: Install compiler run: | + sudo apt-get install gettext -qyy wget http://minetest.kitsunemimi.pw/mingw-w64-x86_64_9.2.0_ubuntu18.04.tar.xz -O mingw.tar.xz sudo tar -xaf mingw.tar.xz -C /usr diff --git a/.github/workflows/cpp_lint.yml b/.github/workflows/cpp_lint.yml index 3044d5186..1f97d105a 100644 --- a/.github/workflows/cpp_lint.yml +++ b/.github/workflows/cpp_lint.yml @@ -30,19 +30,20 @@ jobs: - uses: actions/checkout@v2 - name: Install clang-format run: | - sudo apt-get install ${CLANG_FORMAT} -qyy - env: - CLANG_FORMAT: clang-format-9 + sudo apt-get install clang-format-9 -qyy + - name: Run clang-format run: | source ./util/ci/lint.sh perform_lint + env: + CLANG_FORMAT: clang-format-9 clang_tidy: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Install clang-tidy + - name: Install deps run: | sudo apt-get install clang-tidy-9 -qyy source ./util/ci/common.sh diff --git a/.github/workflows/lua_lint.yml b/.github/workflows/lua_lint.yml index 1b2c01192..738e5afff 100644 --- a/.github/workflows/lua_lint.yml +++ b/.github/workflows/lua_lint.yml @@ -13,12 +13,12 @@ on: jobs: luacheck: + name: "Builtin Luacheck and Unit Tests" runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - name: Install luarocks run: | - sudo apt-get update -qyy sudo apt-get install luarocks -qyy - name: Install luarocks tools diff --git a/util/ci/build.sh b/util/ci/build.sh index 59069b00a..ba77cd645 100755 --- a/util/ci/build.sh +++ b/util/ci/build.sh @@ -1,4 +1,4 @@ -#! /bin/bash -eu +#! /bin/bash -e mkdir cmakebuild cd cmakebuild diff --git a/util/ci/clang-tidy.sh b/util/ci/clang-tidy.sh index d048f54ee..bb4e99fef 100755 --- a/util/ci/clang-tidy.sh +++ b/util/ci/clang-tidy.sh @@ -5,8 +5,7 @@ cd cmakebuild cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DRUN_IN_PLACE=TRUE \ - -DENABLE_GETTEXT=TRUE \ - -DENABLE_SOUND=FALSE \ + -DENABLE_{GETTEXT,SOUND}=FALSE \ -DBUILD_SERVER=TRUE .. make GenerateVersion diff --git a/util/ci/common.sh b/util/ci/common.sh index 5a4f78457..a2e4beac9 100644 --- a/util/ci/common.sh +++ b/util/ci/common.sh @@ -1,21 +1,5 @@ #!/bin/bash -e -set_linux_compiler_env() { - if [[ "${COMPILER}" == "gcc-6" ]]; then - export CC=gcc-6 - export CXX=g++-6 - elif [[ "${COMPILER}" == "gcc-8" ]]; then - export CC=gcc-8 - export CXX=g++-8 - elif [[ "${COMPILER}" == "clang-3.9" ]]; then - export CC=clang-3.9 - export CXX=clang++-3.9 - elif [[ "${COMPILER}" == "clang-9" ]]; then - export CC=clang-9 - export CXX=clang++-9 - fi -} - # Linux build only install_linux_deps() { local pkgs=(libirrlicht-dev cmake libbz2-dev libpng-dev \ -- cgit v1.2.3 From 083b285f4319c470f307f0b52f03a2fb68facd38 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 26 May 2020 00:17:52 +0200 Subject: Rename “Minimal development test” to “Development Test” (#9928) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 +- README.md | 2 +- builtin/mainmenu/dlg_create_world.lua | 12 +- doc/lua_api.txt | 2 +- games/devtest/LICENSE.txt | 4 + games/devtest/README.md | 52 ++ games/devtest/game.conf | 2 + games/devtest/menu/background.png | Bin 0 -> 152 bytes games/devtest/menu/header.png | Bin 0 -> 404 bytes games/devtest/menu/icon.png | Bin 0 -> 217 bytes games/devtest/mods/basenodes/init.lua | 334 ++++++++++ games/devtest/mods/basenodes/mod.conf | 2 + .../textures/basenodes_dirt_with_grass_bottom.png | Bin 0 -> 187 bytes .../textures/basenodes_dirt_with_snow.png | Bin 0 -> 166 bytes .../textures/basenodes_dirt_with_snow_bottom.png | Bin 0 -> 177 bytes .../basenodes/textures/basenodes_snow_sheet.png | Bin 0 -> 166 bytes .../mods/basenodes/textures/default_apple.png | Bin 0 -> 102 bytes .../mods/basenodes/textures/default_cobble.png | Bin 0 -> 340 bytes .../basenodes/textures/default_desert_sand.png | Bin 0 -> 293 bytes .../basenodes/textures/default_desert_stone.png | Bin 0 -> 584 bytes .../mods/basenodes/textures/default_dirt.png | Bin 0 -> 790 bytes .../mods/basenodes/textures/default_grass.png | Bin 0 -> 697 bytes .../mods/basenodes/textures/default_grass_side.png | Bin 0 -> 796 bytes .../mods/basenodes/textures/default_gravel.png | Bin 0 -> 171 bytes .../mods/basenodes/textures/default_ice.png | Bin 0 -> 369 bytes .../basenodes/textures/default_junglegrass.png | Bin 0 -> 201 bytes .../basenodes/textures/default_jungleleaves.png | Bin 0 -> 399 bytes .../mods/basenodes/textures/default_jungletree.png | Bin 0 -> 730 bytes .../basenodes/textures/default_jungletree_top.png | Bin 0 -> 714 bytes .../mods/basenodes/textures/default_lava.png | Bin 0 -> 172 bytes .../basenodes/textures/default_lava_flowing.png | Bin 0 -> 91 bytes .../mods/basenodes/textures/default_leaves.png | Bin 0 -> 883 bytes .../basenodes/textures/default_mossycobble.png | Bin 0 -> 574 bytes .../basenodes/textures/default_pine_needles.png | Bin 0 -> 648 bytes .../mods/basenodes/textures/default_pine_tree.png | Bin 0 -> 604 bytes .../basenodes/textures/default_pine_tree_top.png | Bin 0 -> 174 bytes .../basenodes/textures/default_river_water.png | Bin 0 -> 496 bytes .../textures/default_river_water_flowing.png | Bin 0 -> 99 bytes .../mods/basenodes/textures/default_sand.png | Bin 0 -> 554 bytes .../mods/basenodes/textures/default_snow.png | Bin 0 -> 166 bytes .../mods/basenodes/textures/default_snow_side.png | Bin 0 -> 152 bytes .../mods/basenodes/textures/default_stone.png | Bin 0 -> 313 bytes .../mods/basenodes/textures/default_tree.png | Bin 0 -> 659 bytes .../mods/basenodes/textures/default_tree_top.png | Bin 0 -> 175 bytes .../mods/basenodes/textures/default_water.png | Bin 0 -> 302 bytes .../basenodes/textures/default_water_flowing.png | Bin 0 -> 115 bytes games/devtest/mods/basetools/init.lua | 295 +++++++++ games/devtest/mods/basetools/mod.conf | 2 + .../mods/basetools/textures/basetools_dirtpick.png | Bin 0 -> 307 bytes .../basetools/textures/basetools_firesword.png | Bin 0 -> 190 bytes .../mods/basetools/textures/basetools_icesword.png | Bin 0 -> 190 bytes .../mods/basetools/textures/basetools_mesepick.png | Bin 0 -> 155 bytes .../mods/basetools/textures/basetools_steelaxe.png | Bin 0 -> 131 bytes .../basetools/textures/basetools_steeldagger.png | Bin 0 -> 154 bytes .../basetools/textures/basetools_steelpick.png | Bin 0 -> 159 bytes .../basetools/textures/basetools_steelpick_l1.png | Bin 0 -> 190 bytes .../basetools/textures/basetools_steelpick_l2.png | Bin 0 -> 177 bytes .../basetools/textures/basetools_steelshears.png | Bin 0 -> 208 bytes .../basetools/textures/basetools_steelshovel.png | Bin 0 -> 140 bytes .../basetools/textures/basetools_steelsword.png | Bin 0 -> 163 bytes .../mods/basetools/textures/basetools_stoneaxe.png | Bin 0 -> 130 bytes .../basetools/textures/basetools_stonepick.png | Bin 0 -> 155 bytes .../basetools/textures/basetools_stoneshears.png | Bin 0 -> 224 bytes .../basetools/textures/basetools_stoneshovel.png | Bin 0 -> 134 bytes .../basetools/textures/basetools_stonesword.png | Bin 0 -> 159 bytes .../mods/basetools/textures/basetools_woodaxe.png | Bin 0 -> 121 bytes .../mods/basetools/textures/basetools_woodpick.png | Bin 0 -> 149 bytes .../basetools/textures/basetools_woodshears.png | Bin 0 -> 212 bytes .../basetools/textures/basetools_woodshovel.png | Bin 0 -> 133 bytes .../basetools/textures/basetools_woodsword.png | Bin 0 -> 139 bytes games/devtest/mods/bucket/init.lua | 26 + games/devtest/mods/bucket/mod.conf | 2 + games/devtest/mods/bucket/textures/bucket.png | Bin 0 -> 163 bytes games/devtest/mods/bucket/textures/bucket_lava.png | Bin 0 -> 168 bytes .../devtest/mods/bucket/textures/bucket_water.png | Bin 0 -> 168 bytes games/devtest/mods/chest/init.lua | 27 + games/devtest/mods/chest/mod.conf | 2 + games/devtest/mods/chest/textures/chest_chest.png | Bin 0 -> 163 bytes games/devtest/mods/chest_of_everything/init.lua | 135 ++++ games/devtest/mods/chest_of_everything/mod.conf | 2 + .../textures/chest_of_everything_chest.png | Bin 0 -> 210 bytes games/devtest/mods/dignodes/init.lua | 37 ++ games/devtest/mods/dignodes/mod.conf | 2 + .../mods/dignodes/textures/dignodes_choppy.png | Bin 0 -> 187 bytes .../mods/dignodes/textures/dignodes_cracky.png | Bin 0 -> 193 bytes .../mods/dignodes/textures/dignodes_crumbly.png | Bin 0 -> 172 bytes .../dignodes/textures/dignodes_dig_immediate.png | Bin 0 -> 170 bytes .../mods/dignodes/textures/dignodes_none.png | Bin 0 -> 201 bytes .../mods/dignodes/textures/dignodes_rating1.png | Bin 0 -> 94 bytes .../mods/dignodes/textures/dignodes_rating2.png | Bin 0 -> 92 bytes .../mods/dignodes/textures/dignodes_rating3.png | Bin 0 -> 93 bytes games/devtest/mods/experimental/commands.lua | 215 +++++++ games/devtest/mods/experimental/detached.lua | 29 + games/devtest/mods/experimental/init.lua | 23 + games/devtest/mods/experimental/items.lua | 103 +++ games/devtest/mods/experimental/mod.conf | 2 + .../textures/experimental_callback_node.png | Bin 0 -> 139 bytes .../textures/experimental_particle_sheet.png | Bin 0 -> 208 bytes .../textures/experimental_particle_vertical.png | Bin 0 -> 308 bytes .../textures/experimental_tester_tool_1.png | Bin 0 -> 138 bytes games/devtest/mods/give_initial_stuff/init.lua | 37 ++ games/devtest/mods/give_initial_stuff/mod.conf | 3 + games/devtest/mods/initial_message/init.lua | 9 + games/devtest/mods/initial_message/mod.conf | 2 + games/devtest/mods/mapgen/init.lua | 81 +++ games/devtest/mods/mapgen/mod.conf | 3 + games/devtest/mods/modchannels/init.lua | 14 + games/devtest/mods/modchannels/mod.conf | 2 + games/devtest/mods/soundstuff/init.lua | 170 +++++ games/devtest/mods/soundstuff/mod.conf | 2 + .../mods/soundstuff/sounds/soundstuff_mono.ogg | Bin 0 -> 4362 bytes .../mods/soundstuff/textures/soundstuff_eat.png | Bin 0 -> 113 bytes .../soundstuff/textures/soundstuff_node_blank.png | Bin 0 -> 83 bytes .../textures/soundstuff_node_climbable.png | Bin 0 -> 189 bytes .../soundstuff/textures/soundstuff_node_dig.png | Bin 0 -> 126 bytes .../soundstuff/textures/soundstuff_node_dug.png | Bin 0 -> 132 bytes .../soundstuff/textures/soundstuff_node_fall.png | Bin 0 -> 100 bytes .../textures/soundstuff_node_footstep.png | Bin 0 -> 120 bytes .../soundstuff/textures/soundstuff_node_place.png | Bin 0 -> 115 bytes .../textures/soundstuff_node_place_failed.png | Bin 0 -> 143 bytes .../soundstuff/textures/soundstuff_node_sound.png | Bin 0 -> 116 bytes games/devtest/mods/stairs/init.lua | 65 ++ games/devtest/mods/stairs/mod.conf | 3 + games/devtest/mods/testentities/armor.lua | 41 ++ games/devtest/mods/testentities/callbacks.lua | 75 +++ games/devtest/mods/testentities/init.lua | 3 + games/devtest/mods/testentities/mod.conf | 2 + .../textures/testentities_armorball.png | Bin 0 -> 561 bytes .../textures/testentities_callback.png | Bin 0 -> 156 bytes .../textures/testentities_callback_step.png | Bin 0 -> 166 bytes .../testentities/textures/testentities_cube1.png | Bin 0 -> 130 bytes .../testentities/textures/testentities_cube2.png | Bin 0 -> 128 bytes .../testentities/textures/testentities_cube3.png | Bin 0 -> 124 bytes .../testentities/textures/testentities_cube4.png | Bin 0 -> 126 bytes .../testentities/textures/testentities_cube5.png | Bin 0 -> 126 bytes .../testentities/textures/testentities_cube6.png | Bin 0 -> 126 bytes .../textures/testentities_dungeon_master.png | Bin 0 -> 2855 bytes .../testentities/textures/testentities_sprite.png | Bin 0 -> 120 bytes .../textures/testentities_upright_sprite1.png | Bin 0 -> 114 bytes .../textures/testentities_upright_sprite2.png | Bin 0 -> 119 bytes games/devtest/mods/testentities/visuals.lua | 74 +++ games/devtest/mods/testfood/init.lua | 24 + games/devtest/mods/testfood/mod.conf | 2 + .../mods/testfood/textures/testfood_bad.png | Bin 0 -> 126 bytes .../mods/testfood/textures/testfood_bad2.png | Bin 0 -> 133 bytes .../mods/testfood/textures/testfood_good.png | Bin 0 -> 129 bytes .../mods/testfood/textures/testfood_good2.png | Bin 0 -> 145 bytes games/devtest/mods/testformspec/callbacks.lua | 51 ++ games/devtest/mods/testformspec/dummy_items.lua | 14 + games/devtest/mods/testformspec/formspec.lua | 381 ++++++++++++ games/devtest/mods/testformspec/init.lua | 3 + games/devtest/mods/testformspec/mod.conf | 2 + .../textures/testformspec_animation.jpg | Bin 0 -> 4376 bytes .../textures/testformspec_animation.png | Bin 0 -> 214 bytes .../mods/testformspec/textures/testformspec_bg.png | Bin 0 -> 92 bytes .../textures/testformspec_bg_9slice.png | Bin 0 -> 146 bytes .../textures/testformspec_bg_9slice_hovered.png | Bin 0 -> 146 bytes .../textures/testformspec_bg_9slice_pressed.png | Bin 0 -> 146 bytes .../textures/testformspec_bg_hovered.png | Bin 0 -> 92 bytes .../textures/testformspec_bg_pressed.png | Bin 0 -> 91 bytes .../textures/testformspec_button_image.png | Bin 0 -> 146 bytes .../testformspec/textures/testformspec_hovered.png | Bin 0 -> 195 bytes .../testformspec/textures/testformspec_item.png | Bin 0 -> 182 bytes .../testformspec/textures/testformspec_node.png | Bin 0 -> 113 bytes .../testformspec/textures/testformspec_pressed.png | Bin 0 -> 165 bytes games/devtest/mods/testnodes/README.md | 11 + games/devtest/mods/testnodes/drawtypes.lua | 517 +++++++++++++++ games/devtest/mods/testnodes/init.lua | 10 + games/devtest/mods/testnodes/light.lua | 48 ++ games/devtest/mods/testnodes/liquids.lua | 91 +++ games/devtest/mods/testnodes/meshes.lua | 145 +++++ games/devtest/mods/testnodes/mod.conf | 2 + .../mods/testnodes/models/testnodes_ocorner.obj | 23 + .../mods/testnodes/models/testnodes_pyramid.obj | 24 + games/devtest/mods/testnodes/nodeboxes.lua | 80 +++ games/devtest/mods/testnodes/param2.lua | 168 +++++ games/devtest/mods/testnodes/properties.lua | 270 ++++++++ games/devtest/mods/testnodes/settingtypes.txt | 4 + games/devtest/mods/testnodes/textures.lua | 67 ++ .../mods/testnodes/textures/testnodes_1.png | Bin 0 -> 107 bytes .../mods/testnodes/textures/testnodes_1g.png | Bin 0 -> 104 bytes .../mods/testnodes/textures/testnodes_1w.png | Bin 0 -> 121 bytes .../mods/testnodes/textures/testnodes_1wg.png | Bin 0 -> 122 bytes .../mods/testnodes/textures/testnodes_2.png | Bin 0 -> 112 bytes .../mods/testnodes/textures/testnodes_2g.png | Bin 0 -> 110 bytes .../mods/testnodes/textures/testnodes_2w.png | Bin 0 -> 134 bytes .../mods/testnodes/textures/testnodes_2wg.png | Bin 0 -> 135 bytes .../mods/testnodes/textures/testnodes_3.png | Bin 0 -> 105 bytes .../mods/testnodes/textures/testnodes_3g.png | Bin 0 -> 103 bytes .../mods/testnodes/textures/testnodes_3w.png | Bin 0 -> 112 bytes .../mods/testnodes/textures/testnodes_3wg.png | Bin 0 -> 112 bytes .../mods/testnodes/textures/testnodes_4.png | Bin 0 -> 97 bytes .../mods/testnodes/textures/testnodes_4g.png | Bin 0 -> 95 bytes .../mods/testnodes/textures/testnodes_4w.png | Bin 0 -> 128 bytes .../mods/testnodes/textures/testnodes_4wg.png | Bin 0 -> 128 bytes .../mods/testnodes/textures/testnodes_5.png | Bin 0 -> 98 bytes .../mods/testnodes/textures/testnodes_5g.png | Bin 0 -> 98 bytes .../mods/testnodes/textures/testnodes_5w.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_5wg.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_6.png | Bin 0 -> 100 bytes .../mods/testnodes/textures/testnodes_6g.png | Bin 0 -> 98 bytes .../mods/testnodes/textures/testnodes_6w.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_6wg.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_airlike.png | Bin 0 -> 92 bytes .../mods/testnodes/textures/testnodes_allfaces.png | Bin 0 -> 150 bytes .../textures/testnodes_allfaces_optional.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_alpha.png | Bin 0 -> 96 bytes .../mods/testnodes/textures/testnodes_alpha128.png | Bin 0 -> 136 bytes .../mods/testnodes/textures/testnodes_alpha191.png | Bin 0 -> 132 bytes .../mods/testnodes/textures/testnodes_alpha64.png | Bin 0 -> 134 bytes .../mods/testnodes/textures/testnodes_anim.png | Bin 0 -> 274 bytes .../textures/testnodes_attached_bottom.png | Bin 0 -> 86 bytes .../testnodes/textures/testnodes_attached_side.png | Bin 0 -> 98 bytes .../testnodes/textures/testnodes_attached_top.png | Bin 0 -> 87 bytes .../textures/testnodes_attachedw_bottom.png | Bin 0 -> 130 bytes .../textures/testnodes_attachedw_side.png | Bin 0 -> 122 bytes .../testnodes/textures/testnodes_attachedw_top.png | Bin 0 -> 109 bytes .../mods/testnodes/textures/testnodes_bouncy.png | Bin 0 -> 106 bytes .../testnodes/textures/testnodes_buildable_to.png | Bin 0 -> 89 bytes .../textures/testnodes_climbable_nojump_side.png | Bin 0 -> 164 bytes .../textures/testnodes_climbable_side.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_damage.png | Bin 0 -> 108 bytes .../testnodes/textures/testnodes_damage_neg.png | Bin 0 -> 121 bytes .../mods/testnodes/textures/testnodes_drowning.png | Bin 0 -> 127 bytes .../textures/testnodes_fall_damage_minus.png | Bin 0 -> 116 bytes .../textures/testnodes_fall_damage_plus.png | Bin 0 -> 117 bytes .../testnodes/textures/testnodes_fencelike.png | Bin 0 -> 90 bytes .../mods/testnodes/textures/testnodes_firelike.png | Bin 0 -> 149 bytes .../testnodes/textures/testnodes_glasslike.png | Bin 0 -> 117 bytes .../textures/testnodes_glasslike_detail.png | Bin 0 -> 167 bytes .../textures/testnodes_glasslike_framed.png | Bin 0 -> 88 bytes .../textures/testnodes_glasslike_framed2.png | Bin 0 -> 118 bytes .../testnodes_glasslike_framed_optional.png | Bin 0 -> 128 bytes .../textures/testnodes_glasslikeliquid.png | Bin 0 -> 122 bytes .../mods/testnodes/textures/testnodes_light.png | Bin 0 -> 117 bytes .../mods/testnodes/textures/testnodes_light_1.png | Bin 0 -> 158 bytes .../mods/testnodes/textures/testnodes_light_10.png | Bin 0 -> 147 bytes .../mods/testnodes/textures/testnodes_light_11.png | Bin 0 -> 149 bytes .../mods/testnodes/textures/testnodes_light_12.png | Bin 0 -> 138 bytes .../mods/testnodes/textures/testnodes_light_13.png | Bin 0 -> 137 bytes .../mods/testnodes/textures/testnodes_light_14.png | Bin 0 -> 132 bytes .../mods/testnodes/textures/testnodes_light_2.png | Bin 0 -> 152 bytes .../mods/testnodes/textures/testnodes_light_3.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_light_4.png | Bin 0 -> 157 bytes .../mods/testnodes/textures/testnodes_light_5.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_light_6.png | Bin 0 -> 154 bytes .../mods/testnodes/textures/testnodes_light_7.png | Bin 0 -> 146 bytes .../mods/testnodes/textures/testnodes_light_8.png | Bin 0 -> 139 bytes .../mods/testnodes/textures/testnodes_light_9.png | Bin 0 -> 149 bytes .../testnodes/textures/testnodes_line_crossing.png | Bin 0 -> 130 bytes .../testnodes/textures/testnodes_line_curved.png | Bin 0 -> 123 bytes .../testnodes/textures/testnodes_line_straight.png | Bin 0 -> 115 bytes .../textures/testnodes_line_t_junction.png | Bin 0 -> 128 bytes .../mods/testnodes/textures/testnodes_liquid.png | Bin 0 -> 95 bytes .../testnodes/textures/testnodes_liquidflowing.png | Bin 0 -> 132 bytes .../textures/testnodes_liquidflowing_r0.png | Bin 0 -> 162 bytes .../textures/testnodes_liquidflowing_r1.png | Bin 0 -> 160 bytes .../textures/testnodes_liquidflowing_r2.png | Bin 0 -> 154 bytes .../textures/testnodes_liquidflowing_r3.png | Bin 0 -> 155 bytes .../textures/testnodes_liquidflowing_r4.png | Bin 0 -> 154 bytes .../textures/testnodes_liquidflowing_r5.png | Bin 0 -> 155 bytes .../textures/testnodes_liquidflowing_r6.png | Bin 0 -> 155 bytes .../textures/testnodes_liquidflowing_r7.png | Bin 0 -> 157 bytes .../textures/testnodes_liquidflowing_r8.png | Bin 0 -> 152 bytes .../testnodes/textures/testnodes_liquidsource.png | Bin 0 -> 128 bytes .../textures/testnodes_liquidsource_r0.png | Bin 0 -> 149 bytes .../textures/testnodes_liquidsource_r1.png | Bin 0 -> 152 bytes .../textures/testnodes_liquidsource_r2.png | Bin 0 -> 152 bytes .../textures/testnodes_liquidsource_r3.png | Bin 0 -> 152 bytes .../textures/testnodes_liquidsource_r4.png | Bin 0 -> 155 bytes .../textures/testnodes_liquidsource_r5.png | Bin 0 -> 150 bytes .../textures/testnodes_liquidsource_r6.png | Bin 0 -> 148 bytes .../textures/testnodes_liquidsource_r7.png | Bin 0 -> 154 bytes .../textures/testnodes_liquidsource_r8.png | Bin 0 -> 148 bytes .../testnodes/textures/testnodes_mesh_stripes.png | Bin 0 -> 150 bytes .../testnodes/textures/testnodes_mesh_stripes2.png | Bin 0 -> 144 bytes .../testnodes/textures/testnodes_mesh_stripes3.png | Bin 0 -> 85 bytes .../testnodes/textures/testnodes_mesh_stripes4.png | Bin 0 -> 93 bytes .../mods/testnodes/textures/testnodes_node.png | Bin 0 -> 89 bytes .../testnodes/textures/testnodes_node_falling.png | Bin 0 -> 112 bytes .../mods/testnodes/textures/testnodes_nodebox.png | Bin 0 -> 112 bytes .../testnodes/textures/testnodes_nojump_side.png | Bin 0 -> 94 bytes .../testnodes/textures/testnodes_nojump_top.png | Bin 0 -> 121 bytes .../mods/testnodes/textures/testnodes_normal.png | Bin 0 -> 92 bytes .../mods/testnodes/textures/testnodes_normal1.png | Bin 0 -> 114 bytes .../mods/testnodes/textures/testnodes_normal2.png | Bin 0 -> 122 bytes .../mods/testnodes/textures/testnodes_normal3.png | Bin 0 -> 114 bytes .../mods/testnodes/textures/testnodes_normal4.png | Bin 0 -> 106 bytes .../mods/testnodes/textures/testnodes_normal5.png | Bin 0 -> 109 bytes .../mods/testnodes/textures/testnodes_normal6.png | Bin 0 -> 111 bytes .../textures/testnodes_palette_facedir.png | Bin 0 -> 87 bytes .../testnodes/textures/testnodes_palette_full.png | Bin 0 -> 568 bytes .../textures/testnodes_palette_wallmounted.png | Bin 0 -> 136 bytes .../testnodes/textures/testnodes_plantlike.png | Bin 0 -> 183 bytes .../textures/testnodes_plantlike_degrotate.png | Bin 0 -> 176 bytes .../textures/testnodes_plantlike_leveled.png | Bin 0 -> 163 bytes .../textures/testnodes_plantlike_meshoptions.png | Bin 0 -> 164 bytes .../textures/testnodes_plantlike_rooted.png | Bin 0 -> 182 bytes .../textures/testnodes_plantlike_rooted_base.png | Bin 0 -> 101 bytes ...tnodes_plantlike_rooted_base_side_degrotate.png | Bin 0 -> 145 bytes ...estnodes_plantlike_rooted_base_side_leveled.png | Bin 0 -> 127 bytes ...odes_plantlike_rooted_base_side_meshoptions.png | Bin 0 -> 128 bytes ...testnodes_plantlike_rooted_base_side_waving.png | Bin 0 -> 126 bytes .../testnodes_plantlike_rooted_degrotate.png | Bin 0 -> 176 bytes .../testnodes_plantlike_rooted_leveled.png | Bin 0 -> 162 bytes .../testnodes_plantlike_rooted_meshoptions.png | Bin 0 -> 162 bytes .../textures/testnodes_plantlike_rooted_waving.png | Bin 0 -> 125 bytes .../textures/testnodes_plantlike_waving.png | Bin 0 -> 127 bytes .../textures/testnodes_rail2_crossing.png | Bin 0 -> 246 bytes .../testnodes/textures/testnodes_rail2_curved.png | Bin 0 -> 253 bytes .../textures/testnodes_rail2_straight.png | Bin 0 -> 246 bytes .../textures/testnodes_rail2_t_junction.png | Bin 0 -> 254 bytes .../testnodes/textures/testnodes_rail_crossing.png | Bin 0 -> 151 bytes .../testnodes/textures/testnodes_rail_curved.png | Bin 0 -> 164 bytes .../testnodes/textures/testnodes_rail_straight.png | Bin 0 -> 133 bytes .../textures/testnodes_rail_t_junction.png | Bin 0 -> 202 bytes .../mods/testnodes/textures/testnodes_signlike.png | Bin 0 -> 150 bytes .../mods/testnodes/textures/testnodes_slippery.png | Bin 0 -> 111 bytes .../textures/testnodes_street_crossing.png | Bin 0 -> 137 bytes .../testnodes/textures/testnodes_street_curved.png | Bin 0 -> 115 bytes .../textures/testnodes_street_straight.png | Bin 0 -> 101 bytes .../textures/testnodes_street_t_junction.png | Bin 0 -> 126 bytes .../textures/testnodes_sunlight_filter.png | Bin 0 -> 113 bytes .../textures/testnodes_torchlike_ceiling.png | Bin 0 -> 157 bytes .../textures/testnodes_torchlike_floor.png | Bin 0 -> 141 bytes .../textures/testnodes_torchlike_wall.png | Bin 0 -> 158 bytes games/devtest/mods/testpathfinder/README.md | 15 + games/devtest/mods/testpathfinder/init.lua | 132 ++++ games/devtest/mods/testpathfinder/mod.conf | 2 + .../textures/testpathfinder_testpathfinder.png | Bin 0 -> 159 bytes .../textures/testpathfinder_waypoint.png | Bin 0 -> 99 bytes .../textures/testpathfinder_waypoint_end.png | Bin 0 -> 147 bytes .../textures/testpathfinder_waypoint_start.png | Bin 0 -> 139 bytes games/devtest/mods/testtools/README.md | 99 +++ games/devtest/mods/testtools/init.lua | 691 +++++++++++++++++++++ games/devtest/mods/testtools/mod.conf | 2 + .../textures/testtools_entity_rotator.png | Bin 0 -> 151 bytes .../testtools/textures/testtools_entity_scaler.png | Bin 0 -> 182 bytes .../textures/testtools_entity_spawner.png | Bin 0 -> 189 bytes .../textures/testtools_falling_node_tool.png | Bin 0 -> 140 bytes .../testtools/textures/testtools_node_setter.png | Bin 0 -> 146 bytes .../textures/testtools_object_attacher.png | Bin 0 -> 173 bytes .../testtools/textures/testtools_object_editor.png | Bin 0 -> 180 bytes .../testtools/textures/testtools_object_mover.png | Bin 0 -> 175 bytes .../testtools/textures/testtools_param2tool.png | Bin 0 -> 127 bytes .../mods/testtools/textures/testtools_remover.png | Bin 0 -> 129 bytes games/devtest/mods/tiled/init.lua | 33 + games/devtest/mods/tiled/mod.conf | 3 + games/devtest/mods/tiled/textures/tiled_tiled.png | Bin 0 -> 410 bytes games/devtest/mods/unittests/crafting.lua | 120 ++++ games/devtest/mods/unittests/crafting_prepare.lua | 88 +++ games/devtest/mods/unittests/init.lua | 16 + games/devtest/mods/unittests/mod.conf | 2 + games/devtest/mods/unittests/player.lua | 73 +++ games/devtest/mods/unittests/random.lua | 10 + .../unittests/textures/unittests_coal_lump.png | Bin 0 -> 160 bytes .../unittests/textures/unittests_iron_lump.png | Bin 0 -> 154 bytes .../textures/unittests_repairable_tool.png | Bin 0 -> 160 bytes .../unittests/textures/unittests_steel_ingot.png | Bin 0 -> 159 bytes .../mods/unittests/textures/unittests_stick.png | Bin 0 -> 147 bytes .../mods/unittests/textures/unittests_torch.png | Bin 0 -> 155 bytes .../textures/unittests_unrepairable_tool.png | Bin 0 -> 157 bytes games/devtest/mods/util_commands/init.lua | 137 ++++ games/devtest/mods/util_commands/mod.conf | 2 + games/devtest/screenshot.png | Bin 0 -> 133364 bytes games/devtest/settingtypes.txt | 37 ++ games/minimal/LICENSE.txt | 4 - games/minimal/README.md | 52 -- games/minimal/game.conf | 2 - games/minimal/menu/background.png | Bin 152 -> 0 bytes games/minimal/menu/header.png | Bin 210 -> 0 bytes games/minimal/menu/icon.png | Bin 217 -> 0 bytes games/minimal/mods/basenodes/init.lua | 334 ---------- games/minimal/mods/basenodes/mod.conf | 2 - .../textures/basenodes_dirt_with_grass_bottom.png | Bin 187 -> 0 bytes .../textures/basenodes_dirt_with_snow.png | Bin 166 -> 0 bytes .../textures/basenodes_dirt_with_snow_bottom.png | Bin 177 -> 0 bytes .../basenodes/textures/basenodes_snow_sheet.png | Bin 166 -> 0 bytes .../mods/basenodes/textures/default_apple.png | Bin 102 -> 0 bytes .../mods/basenodes/textures/default_cobble.png | Bin 340 -> 0 bytes .../basenodes/textures/default_desert_sand.png | Bin 293 -> 0 bytes .../basenodes/textures/default_desert_stone.png | Bin 584 -> 0 bytes .../mods/basenodes/textures/default_dirt.png | Bin 790 -> 0 bytes .../mods/basenodes/textures/default_grass.png | Bin 697 -> 0 bytes .../mods/basenodes/textures/default_grass_side.png | Bin 796 -> 0 bytes .../mods/basenodes/textures/default_gravel.png | Bin 171 -> 0 bytes .../mods/basenodes/textures/default_ice.png | Bin 369 -> 0 bytes .../basenodes/textures/default_junglegrass.png | Bin 201 -> 0 bytes .../basenodes/textures/default_jungleleaves.png | Bin 399 -> 0 bytes .../mods/basenodes/textures/default_jungletree.png | Bin 730 -> 0 bytes .../basenodes/textures/default_jungletree_top.png | Bin 714 -> 0 bytes .../mods/basenodes/textures/default_lava.png | Bin 172 -> 0 bytes .../basenodes/textures/default_lava_flowing.png | Bin 91 -> 0 bytes .../mods/basenodes/textures/default_leaves.png | Bin 883 -> 0 bytes .../basenodes/textures/default_mossycobble.png | Bin 574 -> 0 bytes .../basenodes/textures/default_pine_needles.png | Bin 648 -> 0 bytes .../mods/basenodes/textures/default_pine_tree.png | Bin 604 -> 0 bytes .../basenodes/textures/default_pine_tree_top.png | Bin 174 -> 0 bytes .../basenodes/textures/default_river_water.png | Bin 496 -> 0 bytes .../textures/default_river_water_flowing.png | Bin 99 -> 0 bytes .../mods/basenodes/textures/default_sand.png | Bin 554 -> 0 bytes .../mods/basenodes/textures/default_snow.png | Bin 166 -> 0 bytes .../mods/basenodes/textures/default_snow_side.png | Bin 152 -> 0 bytes .../mods/basenodes/textures/default_stone.png | Bin 313 -> 0 bytes .../mods/basenodes/textures/default_tree.png | Bin 659 -> 0 bytes .../mods/basenodes/textures/default_tree_top.png | Bin 175 -> 0 bytes .../mods/basenodes/textures/default_water.png | Bin 302 -> 0 bytes .../basenodes/textures/default_water_flowing.png | Bin 115 -> 0 bytes games/minimal/mods/basetools/init.lua | 295 --------- games/minimal/mods/basetools/mod.conf | 2 - .../mods/basetools/textures/basetools_dirtpick.png | Bin 307 -> 0 bytes .../basetools/textures/basetools_firesword.png | Bin 190 -> 0 bytes .../mods/basetools/textures/basetools_icesword.png | Bin 190 -> 0 bytes .../mods/basetools/textures/basetools_mesepick.png | Bin 155 -> 0 bytes .../mods/basetools/textures/basetools_steelaxe.png | Bin 131 -> 0 bytes .../basetools/textures/basetools_steeldagger.png | Bin 154 -> 0 bytes .../basetools/textures/basetools_steelpick.png | Bin 159 -> 0 bytes .../basetools/textures/basetools_steelpick_l1.png | Bin 190 -> 0 bytes .../basetools/textures/basetools_steelpick_l2.png | Bin 177 -> 0 bytes .../basetools/textures/basetools_steelshears.png | Bin 208 -> 0 bytes .../basetools/textures/basetools_steelshovel.png | Bin 140 -> 0 bytes .../basetools/textures/basetools_steelsword.png | Bin 163 -> 0 bytes .../mods/basetools/textures/basetools_stoneaxe.png | Bin 130 -> 0 bytes .../basetools/textures/basetools_stonepick.png | Bin 155 -> 0 bytes .../basetools/textures/basetools_stoneshears.png | Bin 224 -> 0 bytes .../basetools/textures/basetools_stoneshovel.png | Bin 134 -> 0 bytes .../basetools/textures/basetools_stonesword.png | Bin 159 -> 0 bytes .../mods/basetools/textures/basetools_woodaxe.png | Bin 121 -> 0 bytes .../mods/basetools/textures/basetools_woodpick.png | Bin 149 -> 0 bytes .../basetools/textures/basetools_woodshears.png | Bin 212 -> 0 bytes .../basetools/textures/basetools_woodshovel.png | Bin 133 -> 0 bytes .../basetools/textures/basetools_woodsword.png | Bin 139 -> 0 bytes games/minimal/mods/bucket/init.lua | 26 - games/minimal/mods/bucket/mod.conf | 2 - games/minimal/mods/bucket/textures/bucket.png | Bin 163 -> 0 bytes games/minimal/mods/bucket/textures/bucket_lava.png | Bin 168 -> 0 bytes .../minimal/mods/bucket/textures/bucket_water.png | Bin 168 -> 0 bytes games/minimal/mods/chest/init.lua | 27 - games/minimal/mods/chest/mod.conf | 2 - games/minimal/mods/chest/textures/chest_chest.png | Bin 163 -> 0 bytes games/minimal/mods/chest_of_everything/init.lua | 135 ---- games/minimal/mods/chest_of_everything/mod.conf | 2 - .../textures/chest_of_everything_chest.png | Bin 210 -> 0 bytes games/minimal/mods/dignodes/init.lua | 37 -- games/minimal/mods/dignodes/mod.conf | 2 - .../mods/dignodes/textures/dignodes_choppy.png | Bin 187 -> 0 bytes .../mods/dignodes/textures/dignodes_cracky.png | Bin 193 -> 0 bytes .../mods/dignodes/textures/dignodes_crumbly.png | Bin 172 -> 0 bytes .../dignodes/textures/dignodes_dig_immediate.png | Bin 170 -> 0 bytes .../mods/dignodes/textures/dignodes_none.png | Bin 201 -> 0 bytes .../mods/dignodes/textures/dignodes_rating1.png | Bin 94 -> 0 bytes .../mods/dignodes/textures/dignodes_rating2.png | Bin 92 -> 0 bytes .../mods/dignodes/textures/dignodes_rating3.png | Bin 93 -> 0 bytes games/minimal/mods/experimental/commands.lua | 215 ------- games/minimal/mods/experimental/detached.lua | 29 - games/minimal/mods/experimental/init.lua | 23 - games/minimal/mods/experimental/items.lua | 103 --- games/minimal/mods/experimental/mod.conf | 2 - .../textures/experimental_callback_node.png | Bin 139 -> 0 bytes .../textures/experimental_particle_sheet.png | Bin 208 -> 0 bytes .../textures/experimental_particle_vertical.png | Bin 308 -> 0 bytes .../textures/experimental_tester_tool_1.png | Bin 138 -> 0 bytes games/minimal/mods/give_initial_stuff/init.lua | 37 -- games/minimal/mods/give_initial_stuff/mod.conf | 3 - games/minimal/mods/initial_message/init.lua | 9 - games/minimal/mods/initial_message/mod.conf | 2 - games/minimal/mods/mapgen/init.lua | 81 --- games/minimal/mods/mapgen/mod.conf | 3 - games/minimal/mods/modchannels/init.lua | 14 - games/minimal/mods/modchannels/mod.conf | 2 - games/minimal/mods/soundstuff/init.lua | 170 ----- games/minimal/mods/soundstuff/mod.conf | 2 - .../mods/soundstuff/sounds/soundstuff_mono.ogg | Bin 4362 -> 0 bytes .../mods/soundstuff/textures/soundstuff_eat.png | Bin 113 -> 0 bytes .../soundstuff/textures/soundstuff_node_blank.png | Bin 83 -> 0 bytes .../textures/soundstuff_node_climbable.png | Bin 189 -> 0 bytes .../soundstuff/textures/soundstuff_node_dig.png | Bin 126 -> 0 bytes .../soundstuff/textures/soundstuff_node_dug.png | Bin 132 -> 0 bytes .../soundstuff/textures/soundstuff_node_fall.png | Bin 100 -> 0 bytes .../textures/soundstuff_node_footstep.png | Bin 120 -> 0 bytes .../soundstuff/textures/soundstuff_node_place.png | Bin 115 -> 0 bytes .../textures/soundstuff_node_place_failed.png | Bin 143 -> 0 bytes .../soundstuff/textures/soundstuff_node_sound.png | Bin 116 -> 0 bytes games/minimal/mods/stairs/init.lua | 65 -- games/minimal/mods/stairs/mod.conf | 3 - games/minimal/mods/testentities/armor.lua | 41 -- games/minimal/mods/testentities/callbacks.lua | 75 --- games/minimal/mods/testentities/init.lua | 3 - games/minimal/mods/testentities/mod.conf | 2 - .../textures/testentities_armorball.png | Bin 561 -> 0 bytes .../textures/testentities_callback.png | Bin 156 -> 0 bytes .../textures/testentities_callback_step.png | Bin 166 -> 0 bytes .../testentities/textures/testentities_cube1.png | Bin 130 -> 0 bytes .../testentities/textures/testentities_cube2.png | Bin 128 -> 0 bytes .../testentities/textures/testentities_cube3.png | Bin 124 -> 0 bytes .../testentities/textures/testentities_cube4.png | Bin 126 -> 0 bytes .../testentities/textures/testentities_cube5.png | Bin 126 -> 0 bytes .../testentities/textures/testentities_cube6.png | Bin 126 -> 0 bytes .../textures/testentities_dungeon_master.png | Bin 2855 -> 0 bytes .../testentities/textures/testentities_sprite.png | Bin 120 -> 0 bytes .../textures/testentities_upright_sprite1.png | Bin 114 -> 0 bytes .../textures/testentities_upright_sprite2.png | Bin 119 -> 0 bytes games/minimal/mods/testentities/visuals.lua | 74 --- games/minimal/mods/testfood/init.lua | 24 - games/minimal/mods/testfood/mod.conf | 2 - .../mods/testfood/textures/testfood_bad.png | Bin 126 -> 0 bytes .../mods/testfood/textures/testfood_bad2.png | Bin 133 -> 0 bytes .../mods/testfood/textures/testfood_good.png | Bin 129 -> 0 bytes .../mods/testfood/textures/testfood_good2.png | Bin 145 -> 0 bytes games/minimal/mods/testformspec/callbacks.lua | 51 -- games/minimal/mods/testformspec/dummy_items.lua | 14 - games/minimal/mods/testformspec/formspec.lua | 381 ------------ games/minimal/mods/testformspec/init.lua | 3 - games/minimal/mods/testformspec/mod.conf | 2 - .../textures/testformspec_animation.jpg | Bin 4376 -> 0 bytes .../textures/testformspec_animation.png | Bin 214 -> 0 bytes .../mods/testformspec/textures/testformspec_bg.png | Bin 92 -> 0 bytes .../textures/testformspec_bg_9slice.png | Bin 146 -> 0 bytes .../textures/testformspec_bg_9slice_hovered.png | Bin 146 -> 0 bytes .../textures/testformspec_bg_9slice_pressed.png | Bin 146 -> 0 bytes .../textures/testformspec_bg_hovered.png | Bin 92 -> 0 bytes .../textures/testformspec_bg_pressed.png | Bin 91 -> 0 bytes .../textures/testformspec_button_image.png | Bin 146 -> 0 bytes .../testformspec/textures/testformspec_hovered.png | Bin 195 -> 0 bytes .../testformspec/textures/testformspec_item.png | Bin 182 -> 0 bytes .../testformspec/textures/testformspec_node.png | Bin 113 -> 0 bytes .../testformspec/textures/testformspec_pressed.png | Bin 165 -> 0 bytes games/minimal/mods/testnodes/README.md | 11 - games/minimal/mods/testnodes/drawtypes.lua | 517 --------------- games/minimal/mods/testnodes/init.lua | 10 - games/minimal/mods/testnodes/light.lua | 48 -- games/minimal/mods/testnodes/liquids.lua | 91 --- games/minimal/mods/testnodes/meshes.lua | 145 ----- games/minimal/mods/testnodes/mod.conf | 2 - .../mods/testnodes/models/testnodes_ocorner.obj | 23 - .../mods/testnodes/models/testnodes_pyramid.obj | 24 - games/minimal/mods/testnodes/nodeboxes.lua | 80 --- games/minimal/mods/testnodes/param2.lua | 168 ----- games/minimal/mods/testnodes/properties.lua | 270 -------- games/minimal/mods/testnodes/settingtypes.txt | 4 - games/minimal/mods/testnodes/textures.lua | 67 -- .../mods/testnodes/textures/testnodes_1.png | Bin 107 -> 0 bytes .../mods/testnodes/textures/testnodes_1g.png | Bin 104 -> 0 bytes .../mods/testnodes/textures/testnodes_1w.png | Bin 121 -> 0 bytes .../mods/testnodes/textures/testnodes_1wg.png | Bin 122 -> 0 bytes .../mods/testnodes/textures/testnodes_2.png | Bin 112 -> 0 bytes .../mods/testnodes/textures/testnodes_2g.png | Bin 110 -> 0 bytes .../mods/testnodes/textures/testnodes_2w.png | Bin 134 -> 0 bytes .../mods/testnodes/textures/testnodes_2wg.png | Bin 135 -> 0 bytes .../mods/testnodes/textures/testnodes_3.png | Bin 105 -> 0 bytes .../mods/testnodes/textures/testnodes_3g.png | Bin 103 -> 0 bytes .../mods/testnodes/textures/testnodes_3w.png | Bin 112 -> 0 bytes .../mods/testnodes/textures/testnodes_3wg.png | Bin 112 -> 0 bytes .../mods/testnodes/textures/testnodes_4.png | Bin 97 -> 0 bytes .../mods/testnodes/textures/testnodes_4g.png | Bin 95 -> 0 bytes .../mods/testnodes/textures/testnodes_4w.png | Bin 128 -> 0 bytes .../mods/testnodes/textures/testnodes_4wg.png | Bin 128 -> 0 bytes .../mods/testnodes/textures/testnodes_5.png | Bin 98 -> 0 bytes .../mods/testnodes/textures/testnodes_5g.png | Bin 98 -> 0 bytes .../mods/testnodes/textures/testnodes_5w.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_5wg.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_6.png | Bin 100 -> 0 bytes .../mods/testnodes/textures/testnodes_6g.png | Bin 98 -> 0 bytes .../mods/testnodes/textures/testnodes_6w.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_6wg.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_airlike.png | Bin 92 -> 0 bytes .../mods/testnodes/textures/testnodes_allfaces.png | Bin 150 -> 0 bytes .../textures/testnodes_allfaces_optional.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_alpha.png | Bin 96 -> 0 bytes .../mods/testnodes/textures/testnodes_alpha128.png | Bin 136 -> 0 bytes .../mods/testnodes/textures/testnodes_alpha191.png | Bin 132 -> 0 bytes .../mods/testnodes/textures/testnodes_alpha64.png | Bin 134 -> 0 bytes .../mods/testnodes/textures/testnodes_anim.png | Bin 274 -> 0 bytes .../textures/testnodes_attached_bottom.png | Bin 86 -> 0 bytes .../testnodes/textures/testnodes_attached_side.png | Bin 98 -> 0 bytes .../testnodes/textures/testnodes_attached_top.png | Bin 87 -> 0 bytes .../textures/testnodes_attachedw_bottom.png | Bin 130 -> 0 bytes .../textures/testnodes_attachedw_side.png | Bin 122 -> 0 bytes .../testnodes/textures/testnodes_attachedw_top.png | Bin 109 -> 0 bytes .../mods/testnodes/textures/testnodes_bouncy.png | Bin 106 -> 0 bytes .../testnodes/textures/testnodes_buildable_to.png | Bin 89 -> 0 bytes .../textures/testnodes_climbable_nojump_side.png | Bin 164 -> 0 bytes .../textures/testnodes_climbable_side.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_damage.png | Bin 108 -> 0 bytes .../testnodes/textures/testnodes_damage_neg.png | Bin 121 -> 0 bytes .../mods/testnodes/textures/testnodes_drowning.png | Bin 127 -> 0 bytes .../textures/testnodes_fall_damage_minus.png | Bin 116 -> 0 bytes .../textures/testnodes_fall_damage_plus.png | Bin 117 -> 0 bytes .../testnodes/textures/testnodes_fencelike.png | Bin 90 -> 0 bytes .../mods/testnodes/textures/testnodes_firelike.png | Bin 149 -> 0 bytes .../testnodes/textures/testnodes_glasslike.png | Bin 117 -> 0 bytes .../textures/testnodes_glasslike_detail.png | Bin 167 -> 0 bytes .../textures/testnodes_glasslike_framed.png | Bin 88 -> 0 bytes .../textures/testnodes_glasslike_framed2.png | Bin 118 -> 0 bytes .../testnodes_glasslike_framed_optional.png | Bin 128 -> 0 bytes .../textures/testnodes_glasslikeliquid.png | Bin 122 -> 0 bytes .../mods/testnodes/textures/testnodes_light.png | Bin 117 -> 0 bytes .../mods/testnodes/textures/testnodes_light_1.png | Bin 158 -> 0 bytes .../mods/testnodes/textures/testnodes_light_10.png | Bin 147 -> 0 bytes .../mods/testnodes/textures/testnodes_light_11.png | Bin 149 -> 0 bytes .../mods/testnodes/textures/testnodes_light_12.png | Bin 138 -> 0 bytes .../mods/testnodes/textures/testnodes_light_13.png | Bin 137 -> 0 bytes .../mods/testnodes/textures/testnodes_light_14.png | Bin 132 -> 0 bytes .../mods/testnodes/textures/testnodes_light_2.png | Bin 152 -> 0 bytes .../mods/testnodes/textures/testnodes_light_3.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_light_4.png | Bin 157 -> 0 bytes .../mods/testnodes/textures/testnodes_light_5.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_light_6.png | Bin 154 -> 0 bytes .../mods/testnodes/textures/testnodes_light_7.png | Bin 146 -> 0 bytes .../mods/testnodes/textures/testnodes_light_8.png | Bin 139 -> 0 bytes .../mods/testnodes/textures/testnodes_light_9.png | Bin 149 -> 0 bytes .../testnodes/textures/testnodes_line_crossing.png | Bin 130 -> 0 bytes .../testnodes/textures/testnodes_line_curved.png | Bin 123 -> 0 bytes .../testnodes/textures/testnodes_line_straight.png | Bin 115 -> 0 bytes .../textures/testnodes_line_t_junction.png | Bin 128 -> 0 bytes .../mods/testnodes/textures/testnodes_liquid.png | Bin 95 -> 0 bytes .../testnodes/textures/testnodes_liquidflowing.png | Bin 132 -> 0 bytes .../textures/testnodes_liquidflowing_r0.png | Bin 162 -> 0 bytes .../textures/testnodes_liquidflowing_r1.png | Bin 160 -> 0 bytes .../textures/testnodes_liquidflowing_r2.png | Bin 154 -> 0 bytes .../textures/testnodes_liquidflowing_r3.png | Bin 155 -> 0 bytes .../textures/testnodes_liquidflowing_r4.png | Bin 154 -> 0 bytes .../textures/testnodes_liquidflowing_r5.png | Bin 155 -> 0 bytes .../textures/testnodes_liquidflowing_r6.png | Bin 155 -> 0 bytes .../textures/testnodes_liquidflowing_r7.png | Bin 157 -> 0 bytes .../textures/testnodes_liquidflowing_r8.png | Bin 152 -> 0 bytes .../testnodes/textures/testnodes_liquidsource.png | Bin 128 -> 0 bytes .../textures/testnodes_liquidsource_r0.png | Bin 149 -> 0 bytes .../textures/testnodes_liquidsource_r1.png | Bin 152 -> 0 bytes .../textures/testnodes_liquidsource_r2.png | Bin 152 -> 0 bytes .../textures/testnodes_liquidsource_r3.png | Bin 152 -> 0 bytes .../textures/testnodes_liquidsource_r4.png | Bin 155 -> 0 bytes .../textures/testnodes_liquidsource_r5.png | Bin 150 -> 0 bytes .../textures/testnodes_liquidsource_r6.png | Bin 148 -> 0 bytes .../textures/testnodes_liquidsource_r7.png | Bin 154 -> 0 bytes .../textures/testnodes_liquidsource_r8.png | Bin 148 -> 0 bytes .../testnodes/textures/testnodes_mesh_stripes.png | Bin 150 -> 0 bytes .../testnodes/textures/testnodes_mesh_stripes2.png | Bin 144 -> 0 bytes .../testnodes/textures/testnodes_mesh_stripes3.png | Bin 85 -> 0 bytes .../testnodes/textures/testnodes_mesh_stripes4.png | Bin 93 -> 0 bytes .../mods/testnodes/textures/testnodes_node.png | Bin 89 -> 0 bytes .../testnodes/textures/testnodes_node_falling.png | Bin 112 -> 0 bytes .../mods/testnodes/textures/testnodes_nodebox.png | Bin 112 -> 0 bytes .../testnodes/textures/testnodes_nojump_side.png | Bin 94 -> 0 bytes .../testnodes/textures/testnodes_nojump_top.png | Bin 121 -> 0 bytes .../mods/testnodes/textures/testnodes_normal.png | Bin 92 -> 0 bytes .../mods/testnodes/textures/testnodes_normal1.png | Bin 114 -> 0 bytes .../mods/testnodes/textures/testnodes_normal2.png | Bin 122 -> 0 bytes .../mods/testnodes/textures/testnodes_normal3.png | Bin 114 -> 0 bytes .../mods/testnodes/textures/testnodes_normal4.png | Bin 106 -> 0 bytes .../mods/testnodes/textures/testnodes_normal5.png | Bin 109 -> 0 bytes .../mods/testnodes/textures/testnodes_normal6.png | Bin 111 -> 0 bytes .../textures/testnodes_palette_facedir.png | Bin 87 -> 0 bytes .../testnodes/textures/testnodes_palette_full.png | Bin 568 -> 0 bytes .../textures/testnodes_palette_wallmounted.png | Bin 136 -> 0 bytes .../testnodes/textures/testnodes_plantlike.png | Bin 183 -> 0 bytes .../textures/testnodes_plantlike_degrotate.png | Bin 176 -> 0 bytes .../textures/testnodes_plantlike_leveled.png | Bin 163 -> 0 bytes .../textures/testnodes_plantlike_meshoptions.png | Bin 164 -> 0 bytes .../textures/testnodes_plantlike_rooted.png | Bin 182 -> 0 bytes .../textures/testnodes_plantlike_rooted_base.png | Bin 101 -> 0 bytes ...tnodes_plantlike_rooted_base_side_degrotate.png | Bin 145 -> 0 bytes ...estnodes_plantlike_rooted_base_side_leveled.png | Bin 127 -> 0 bytes ...odes_plantlike_rooted_base_side_meshoptions.png | Bin 128 -> 0 bytes ...testnodes_plantlike_rooted_base_side_waving.png | Bin 126 -> 0 bytes .../testnodes_plantlike_rooted_degrotate.png | Bin 176 -> 0 bytes .../testnodes_plantlike_rooted_leveled.png | Bin 162 -> 0 bytes .../testnodes_plantlike_rooted_meshoptions.png | Bin 162 -> 0 bytes .../textures/testnodes_plantlike_rooted_waving.png | Bin 125 -> 0 bytes .../textures/testnodes_plantlike_waving.png | Bin 127 -> 0 bytes .../textures/testnodes_rail2_crossing.png | Bin 246 -> 0 bytes .../testnodes/textures/testnodes_rail2_curved.png | Bin 253 -> 0 bytes .../textures/testnodes_rail2_straight.png | Bin 246 -> 0 bytes .../textures/testnodes_rail2_t_junction.png | Bin 254 -> 0 bytes .../testnodes/textures/testnodes_rail_crossing.png | Bin 151 -> 0 bytes .../testnodes/textures/testnodes_rail_curved.png | Bin 164 -> 0 bytes .../testnodes/textures/testnodes_rail_straight.png | Bin 133 -> 0 bytes .../textures/testnodes_rail_t_junction.png | Bin 202 -> 0 bytes .../mods/testnodes/textures/testnodes_signlike.png | Bin 150 -> 0 bytes .../mods/testnodes/textures/testnodes_slippery.png | Bin 111 -> 0 bytes .../textures/testnodes_street_crossing.png | Bin 137 -> 0 bytes .../testnodes/textures/testnodes_street_curved.png | Bin 115 -> 0 bytes .../textures/testnodes_street_straight.png | Bin 101 -> 0 bytes .../textures/testnodes_street_t_junction.png | Bin 126 -> 0 bytes .../textures/testnodes_sunlight_filter.png | Bin 113 -> 0 bytes .../textures/testnodes_torchlike_ceiling.png | Bin 157 -> 0 bytes .../textures/testnodes_torchlike_floor.png | Bin 141 -> 0 bytes .../textures/testnodes_torchlike_wall.png | Bin 158 -> 0 bytes games/minimal/mods/testpathfinder/README.md | 15 - games/minimal/mods/testpathfinder/init.lua | 132 ---- games/minimal/mods/testpathfinder/mod.conf | 2 - .../textures/testpathfinder_testpathfinder.png | Bin 159 -> 0 bytes .../textures/testpathfinder_waypoint.png | Bin 99 -> 0 bytes .../textures/testpathfinder_waypoint_end.png | Bin 147 -> 0 bytes .../textures/testpathfinder_waypoint_start.png | Bin 139 -> 0 bytes games/minimal/mods/testtools/README.md | 99 --- games/minimal/mods/testtools/init.lua | 691 --------------------- games/minimal/mods/testtools/mod.conf | 2 - .../textures/testtools_entity_rotator.png | Bin 151 -> 0 bytes .../testtools/textures/testtools_entity_scaler.png | Bin 182 -> 0 bytes .../textures/testtools_entity_spawner.png | Bin 189 -> 0 bytes .../textures/testtools_falling_node_tool.png | Bin 140 -> 0 bytes .../testtools/textures/testtools_node_setter.png | Bin 146 -> 0 bytes .../textures/testtools_object_attacher.png | Bin 173 -> 0 bytes .../testtools/textures/testtools_object_editor.png | Bin 180 -> 0 bytes .../testtools/textures/testtools_object_mover.png | Bin 175 -> 0 bytes .../testtools/textures/testtools_param2tool.png | Bin 127 -> 0 bytes .../mods/testtools/textures/testtools_remover.png | Bin 129 -> 0 bytes games/minimal/mods/tiled/init.lua | 33 - games/minimal/mods/tiled/mod.conf | 3 - games/minimal/mods/tiled/textures/tiled_tiled.png | Bin 410 -> 0 bytes games/minimal/mods/unittests/crafting.lua | 120 ---- games/minimal/mods/unittests/crafting_prepare.lua | 88 --- games/minimal/mods/unittests/init.lua | 16 - games/minimal/mods/unittests/mod.conf | 2 - games/minimal/mods/unittests/player.lua | 73 --- games/minimal/mods/unittests/random.lua | 10 - .../unittests/textures/unittests_coal_lump.png | Bin 160 -> 0 bytes .../unittests/textures/unittests_iron_lump.png | Bin 154 -> 0 bytes .../textures/unittests_repairable_tool.png | Bin 160 -> 0 bytes .../unittests/textures/unittests_steel_ingot.png | Bin 159 -> 0 bytes .../mods/unittests/textures/unittests_stick.png | Bin 147 -> 0 bytes .../mods/unittests/textures/unittests_torch.png | Bin 155 -> 0 bytes .../textures/unittests_unrepairable_tool.png | Bin 157 -> 0 bytes games/minimal/mods/util_commands/init.lua | 137 ---- games/minimal/mods/util_commands/mod.conf | 2 - games/minimal/screenshot.png | Bin 133364 -> 0 bytes games/minimal/settingtypes.txt | 37 -- src/unittest/CMakeLists.txt | 2 +- src/unittest/test_servermodmanager.cpp | 10 +- util/test_multiplayer.sh | 2 +- 731 files changed, 5299 insertions(+), 5299 deletions(-) create mode 100644 games/devtest/LICENSE.txt create mode 100644 games/devtest/README.md create mode 100644 games/devtest/game.conf create mode 100644 games/devtest/menu/background.png create mode 100644 games/devtest/menu/header.png create mode 100644 games/devtest/menu/icon.png create mode 100644 games/devtest/mods/basenodes/init.lua create mode 100644 games/devtest/mods/basenodes/mod.conf create mode 100644 games/devtest/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png create mode 100644 games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow.png create mode 100644 games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png create mode 100644 games/devtest/mods/basenodes/textures/basenodes_snow_sheet.png create mode 100644 games/devtest/mods/basenodes/textures/default_apple.png create mode 100644 games/devtest/mods/basenodes/textures/default_cobble.png create mode 100644 games/devtest/mods/basenodes/textures/default_desert_sand.png create mode 100644 games/devtest/mods/basenodes/textures/default_desert_stone.png create mode 100644 games/devtest/mods/basenodes/textures/default_dirt.png create mode 100644 games/devtest/mods/basenodes/textures/default_grass.png create mode 100644 games/devtest/mods/basenodes/textures/default_grass_side.png create mode 100644 games/devtest/mods/basenodes/textures/default_gravel.png create mode 100644 games/devtest/mods/basenodes/textures/default_ice.png create mode 100644 games/devtest/mods/basenodes/textures/default_junglegrass.png create mode 100644 games/devtest/mods/basenodes/textures/default_jungleleaves.png create mode 100644 games/devtest/mods/basenodes/textures/default_jungletree.png create mode 100644 games/devtest/mods/basenodes/textures/default_jungletree_top.png create mode 100644 games/devtest/mods/basenodes/textures/default_lava.png create mode 100644 games/devtest/mods/basenodes/textures/default_lava_flowing.png create mode 100644 games/devtest/mods/basenodes/textures/default_leaves.png create mode 100644 games/devtest/mods/basenodes/textures/default_mossycobble.png create mode 100644 games/devtest/mods/basenodes/textures/default_pine_needles.png create mode 100644 games/devtest/mods/basenodes/textures/default_pine_tree.png create mode 100644 games/devtest/mods/basenodes/textures/default_pine_tree_top.png create mode 100644 games/devtest/mods/basenodes/textures/default_river_water.png create mode 100644 games/devtest/mods/basenodes/textures/default_river_water_flowing.png create mode 100644 games/devtest/mods/basenodes/textures/default_sand.png create mode 100644 games/devtest/mods/basenodes/textures/default_snow.png create mode 100644 games/devtest/mods/basenodes/textures/default_snow_side.png create mode 100644 games/devtest/mods/basenodes/textures/default_stone.png create mode 100644 games/devtest/mods/basenodes/textures/default_tree.png create mode 100644 games/devtest/mods/basenodes/textures/default_tree_top.png create mode 100644 games/devtest/mods/basenodes/textures/default_water.png create mode 100644 games/devtest/mods/basenodes/textures/default_water_flowing.png create mode 100644 games/devtest/mods/basetools/init.lua create mode 100644 games/devtest/mods/basetools/mod.conf create mode 100644 games/devtest/mods/basetools/textures/basetools_dirtpick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_firesword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_icesword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_mesepick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelaxe.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steeldagger.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelpick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelpick_l1.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelpick_l2.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelshears.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelshovel.png create mode 100644 games/devtest/mods/basetools/textures/basetools_steelsword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stoneaxe.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stonepick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stoneshears.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stoneshovel.png create mode 100644 games/devtest/mods/basetools/textures/basetools_stonesword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodaxe.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodpick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodshears.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodshovel.png create mode 100644 games/devtest/mods/basetools/textures/basetools_woodsword.png create mode 100644 games/devtest/mods/bucket/init.lua create mode 100644 games/devtest/mods/bucket/mod.conf create mode 100644 games/devtest/mods/bucket/textures/bucket.png create mode 100644 games/devtest/mods/bucket/textures/bucket_lava.png create mode 100644 games/devtest/mods/bucket/textures/bucket_water.png create mode 100644 games/devtest/mods/chest/init.lua create mode 100644 games/devtest/mods/chest/mod.conf create mode 100644 games/devtest/mods/chest/textures/chest_chest.png create mode 100644 games/devtest/mods/chest_of_everything/init.lua create mode 100644 games/devtest/mods/chest_of_everything/mod.conf create mode 100644 games/devtest/mods/chest_of_everything/textures/chest_of_everything_chest.png create mode 100644 games/devtest/mods/dignodes/init.lua create mode 100644 games/devtest/mods/dignodes/mod.conf create mode 100644 games/devtest/mods/dignodes/textures/dignodes_choppy.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_cracky.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_crumbly.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_dig_immediate.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_none.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_rating1.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_rating2.png create mode 100644 games/devtest/mods/dignodes/textures/dignodes_rating3.png create mode 100644 games/devtest/mods/experimental/commands.lua create mode 100644 games/devtest/mods/experimental/detached.lua create mode 100644 games/devtest/mods/experimental/init.lua create mode 100644 games/devtest/mods/experimental/items.lua create mode 100644 games/devtest/mods/experimental/mod.conf create mode 100644 games/devtest/mods/experimental/textures/experimental_callback_node.png create mode 100644 games/devtest/mods/experimental/textures/experimental_particle_sheet.png create mode 100644 games/devtest/mods/experimental/textures/experimental_particle_vertical.png create mode 100644 games/devtest/mods/experimental/textures/experimental_tester_tool_1.png create mode 100644 games/devtest/mods/give_initial_stuff/init.lua create mode 100644 games/devtest/mods/give_initial_stuff/mod.conf create mode 100644 games/devtest/mods/initial_message/init.lua create mode 100644 games/devtest/mods/initial_message/mod.conf create mode 100644 games/devtest/mods/mapgen/init.lua create mode 100644 games/devtest/mods/mapgen/mod.conf create mode 100644 games/devtest/mods/modchannels/init.lua create mode 100644 games/devtest/mods/modchannels/mod.conf create mode 100644 games/devtest/mods/soundstuff/init.lua create mode 100644 games/devtest/mods/soundstuff/mod.conf create mode 100644 games/devtest/mods/soundstuff/sounds/soundstuff_mono.ogg create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_eat.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_blank.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_climbable.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_dig.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_dug.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_fall.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_footstep.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_place.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_place_failed.png create mode 100644 games/devtest/mods/soundstuff/textures/soundstuff_node_sound.png create mode 100644 games/devtest/mods/stairs/init.lua create mode 100644 games/devtest/mods/stairs/mod.conf create mode 100644 games/devtest/mods/testentities/armor.lua create mode 100644 games/devtest/mods/testentities/callbacks.lua create mode 100644 games/devtest/mods/testentities/init.lua create mode 100644 games/devtest/mods/testentities/mod.conf create mode 100644 games/devtest/mods/testentities/textures/testentities_armorball.png create mode 100644 games/devtest/mods/testentities/textures/testentities_callback.png create mode 100644 games/devtest/mods/testentities/textures/testentities_callback_step.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube1.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube2.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube3.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube4.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube5.png create mode 100644 games/devtest/mods/testentities/textures/testentities_cube6.png create mode 100644 games/devtest/mods/testentities/textures/testentities_dungeon_master.png create mode 100644 games/devtest/mods/testentities/textures/testentities_sprite.png create mode 100644 games/devtest/mods/testentities/textures/testentities_upright_sprite1.png create mode 100644 games/devtest/mods/testentities/textures/testentities_upright_sprite2.png create mode 100644 games/devtest/mods/testentities/visuals.lua create mode 100644 games/devtest/mods/testfood/init.lua create mode 100644 games/devtest/mods/testfood/mod.conf create mode 100644 games/devtest/mods/testfood/textures/testfood_bad.png create mode 100644 games/devtest/mods/testfood/textures/testfood_bad2.png create mode 100644 games/devtest/mods/testfood/textures/testfood_good.png create mode 100644 games/devtest/mods/testfood/textures/testfood_good2.png create mode 100644 games/devtest/mods/testformspec/callbacks.lua create mode 100644 games/devtest/mods/testformspec/dummy_items.lua create mode 100644 games/devtest/mods/testformspec/formspec.lua create mode 100644 games/devtest/mods/testformspec/init.lua create mode 100644 games/devtest/mods/testformspec/mod.conf create mode 100644 games/devtest/mods/testformspec/textures/testformspec_animation.jpg create mode 100644 games/devtest/mods/testformspec/textures/testformspec_animation.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_9slice.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_9slice_hovered.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_9slice_pressed.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_hovered.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_bg_pressed.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_button_image.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_hovered.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_item.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_node.png create mode 100644 games/devtest/mods/testformspec/textures/testformspec_pressed.png create mode 100644 games/devtest/mods/testnodes/README.md create mode 100644 games/devtest/mods/testnodes/drawtypes.lua create mode 100644 games/devtest/mods/testnodes/init.lua create mode 100644 games/devtest/mods/testnodes/light.lua create mode 100644 games/devtest/mods/testnodes/liquids.lua create mode 100644 games/devtest/mods/testnodes/meshes.lua create mode 100644 games/devtest/mods/testnodes/mod.conf create mode 100644 games/devtest/mods/testnodes/models/testnodes_ocorner.obj create mode 100644 games/devtest/mods/testnodes/models/testnodes_pyramid.obj create mode 100644 games/devtest/mods/testnodes/nodeboxes.lua create mode 100644 games/devtest/mods/testnodes/param2.lua create mode 100644 games/devtest/mods/testnodes/properties.lua create mode 100644 games/devtest/mods/testnodes/settingtypes.txt create mode 100644 games/devtest/mods/testnodes/textures.lua create mode 100644 games/devtest/mods/testnodes/textures/testnodes_1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_1g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_1w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_1wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_2g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_2w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_2wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_3g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_3w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_3wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_4g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_4w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_4wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_5g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_5w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_5wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_6g.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_6w.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_6wg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_airlike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_allfaces.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_allfaces_optional.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_alpha.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_alpha128.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_alpha191.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_alpha64.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_anim.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attached_bottom.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attached_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attached_top.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attachedw_bottom.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attachedw_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_attachedw_top.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_bouncy.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_buildable_to.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_climbable_nojump_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_climbable_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_damage.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_damage_neg.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_drowning.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_fall_damage_minus.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_fall_damage_plus.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_fencelike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_firelike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike_detail.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike_framed.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike_framed2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslike_framed_optional.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_glasslikeliquid.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_10.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_11.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_12.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_13.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_14.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_7.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_8.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_light_9.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_line_crossing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_line_curved.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_line_straight.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_line_t_junction.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquid.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r0.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r7.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r8.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r0.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r7.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_liquidsource_r8.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_mesh_stripes.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_mesh_stripes2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_mesh_stripes3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_mesh_stripes4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_node.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_node_falling.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_nodebox.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_nojump_side.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_nojump_top.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal1.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal2.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal3.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal4.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal5.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_normal6.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_palette_facedir.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_palette_full.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_palette_wallmounted.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_degrotate.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_leveled.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_meshoptions.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_plantlike_waving.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail2_crossing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail2_curved.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail2_straight.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail2_t_junction.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail_crossing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail_curved.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail_straight.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_rail_t_junction.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_signlike.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_slippery.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_street_crossing.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_street_curved.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_street_straight.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_street_t_junction.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_sunlight_filter.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_torchlike_ceiling.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_torchlike_floor.png create mode 100644 games/devtest/mods/testnodes/textures/testnodes_torchlike_wall.png create mode 100644 games/devtest/mods/testpathfinder/README.md create mode 100644 games/devtest/mods/testpathfinder/init.lua create mode 100644 games/devtest/mods/testpathfinder/mod.conf create mode 100644 games/devtest/mods/testpathfinder/textures/testpathfinder_testpathfinder.png create mode 100644 games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint.png create mode 100644 games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_end.png create mode 100644 games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_start.png create mode 100644 games/devtest/mods/testtools/README.md create mode 100644 games/devtest/mods/testtools/init.lua create mode 100644 games/devtest/mods/testtools/mod.conf create mode 100644 games/devtest/mods/testtools/textures/testtools_entity_rotator.png create mode 100644 games/devtest/mods/testtools/textures/testtools_entity_scaler.png create mode 100644 games/devtest/mods/testtools/textures/testtools_entity_spawner.png create mode 100644 games/devtest/mods/testtools/textures/testtools_falling_node_tool.png create mode 100644 games/devtest/mods/testtools/textures/testtools_node_setter.png create mode 100644 games/devtest/mods/testtools/textures/testtools_object_attacher.png create mode 100644 games/devtest/mods/testtools/textures/testtools_object_editor.png create mode 100644 games/devtest/mods/testtools/textures/testtools_object_mover.png create mode 100644 games/devtest/mods/testtools/textures/testtools_param2tool.png create mode 100644 games/devtest/mods/testtools/textures/testtools_remover.png create mode 100644 games/devtest/mods/tiled/init.lua create mode 100644 games/devtest/mods/tiled/mod.conf create mode 100644 games/devtest/mods/tiled/textures/tiled_tiled.png create mode 100644 games/devtest/mods/unittests/crafting.lua create mode 100644 games/devtest/mods/unittests/crafting_prepare.lua create mode 100644 games/devtest/mods/unittests/init.lua create mode 100644 games/devtest/mods/unittests/mod.conf create mode 100644 games/devtest/mods/unittests/player.lua create mode 100644 games/devtest/mods/unittests/random.lua create mode 100644 games/devtest/mods/unittests/textures/unittests_coal_lump.png create mode 100644 games/devtest/mods/unittests/textures/unittests_iron_lump.png create mode 100644 games/devtest/mods/unittests/textures/unittests_repairable_tool.png create mode 100644 games/devtest/mods/unittests/textures/unittests_steel_ingot.png create mode 100644 games/devtest/mods/unittests/textures/unittests_stick.png create mode 100644 games/devtest/mods/unittests/textures/unittests_torch.png create mode 100644 games/devtest/mods/unittests/textures/unittests_unrepairable_tool.png create mode 100644 games/devtest/mods/util_commands/init.lua create mode 100644 games/devtest/mods/util_commands/mod.conf create mode 100644 games/devtest/screenshot.png create mode 100644 games/devtest/settingtypes.txt delete mode 100644 games/minimal/LICENSE.txt delete mode 100644 games/minimal/README.md delete mode 100644 games/minimal/game.conf delete mode 100644 games/minimal/menu/background.png delete mode 100644 games/minimal/menu/header.png delete mode 100644 games/minimal/menu/icon.png delete mode 100644 games/minimal/mods/basenodes/init.lua delete mode 100644 games/minimal/mods/basenodes/mod.conf delete mode 100644 games/minimal/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png delete mode 100644 games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow.png delete mode 100644 games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png delete mode 100644 games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png delete mode 100644 games/minimal/mods/basenodes/textures/default_apple.png delete mode 100644 games/minimal/mods/basenodes/textures/default_cobble.png delete mode 100644 games/minimal/mods/basenodes/textures/default_desert_sand.png delete mode 100644 games/minimal/mods/basenodes/textures/default_desert_stone.png delete mode 100644 games/minimal/mods/basenodes/textures/default_dirt.png delete mode 100644 games/minimal/mods/basenodes/textures/default_grass.png delete mode 100644 games/minimal/mods/basenodes/textures/default_grass_side.png delete mode 100644 games/minimal/mods/basenodes/textures/default_gravel.png delete mode 100644 games/minimal/mods/basenodes/textures/default_ice.png delete mode 100644 games/minimal/mods/basenodes/textures/default_junglegrass.png delete mode 100644 games/minimal/mods/basenodes/textures/default_jungleleaves.png delete mode 100644 games/minimal/mods/basenodes/textures/default_jungletree.png delete mode 100644 games/minimal/mods/basenodes/textures/default_jungletree_top.png delete mode 100644 games/minimal/mods/basenodes/textures/default_lava.png delete mode 100644 games/minimal/mods/basenodes/textures/default_lava_flowing.png delete mode 100644 games/minimal/mods/basenodes/textures/default_leaves.png delete mode 100644 games/minimal/mods/basenodes/textures/default_mossycobble.png delete mode 100644 games/minimal/mods/basenodes/textures/default_pine_needles.png delete mode 100644 games/minimal/mods/basenodes/textures/default_pine_tree.png delete mode 100644 games/minimal/mods/basenodes/textures/default_pine_tree_top.png delete mode 100644 games/minimal/mods/basenodes/textures/default_river_water.png delete mode 100644 games/minimal/mods/basenodes/textures/default_river_water_flowing.png delete mode 100644 games/minimal/mods/basenodes/textures/default_sand.png delete mode 100644 games/minimal/mods/basenodes/textures/default_snow.png delete mode 100644 games/minimal/mods/basenodes/textures/default_snow_side.png delete mode 100644 games/minimal/mods/basenodes/textures/default_stone.png delete mode 100644 games/minimal/mods/basenodes/textures/default_tree.png delete mode 100644 games/minimal/mods/basenodes/textures/default_tree_top.png delete mode 100644 games/minimal/mods/basenodes/textures/default_water.png delete mode 100644 games/minimal/mods/basenodes/textures/default_water_flowing.png delete mode 100644 games/minimal/mods/basetools/init.lua delete mode 100644 games/minimal/mods/basetools/mod.conf delete mode 100644 games/minimal/mods/basetools/textures/basetools_dirtpick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_firesword.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_icesword.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_mesepick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelaxe.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steeldagger.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelpick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelpick_l1.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelpick_l2.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelshears.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelshovel.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_steelsword.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stoneaxe.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stonepick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stoneshears.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stoneshovel.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_stonesword.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodaxe.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodpick.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodshears.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodshovel.png delete mode 100644 games/minimal/mods/basetools/textures/basetools_woodsword.png delete mode 100644 games/minimal/mods/bucket/init.lua delete mode 100644 games/minimal/mods/bucket/mod.conf delete mode 100644 games/minimal/mods/bucket/textures/bucket.png delete mode 100644 games/minimal/mods/bucket/textures/bucket_lava.png delete mode 100644 games/minimal/mods/bucket/textures/bucket_water.png delete mode 100644 games/minimal/mods/chest/init.lua delete mode 100644 games/minimal/mods/chest/mod.conf delete mode 100644 games/minimal/mods/chest/textures/chest_chest.png delete mode 100644 games/minimal/mods/chest_of_everything/init.lua delete mode 100644 games/minimal/mods/chest_of_everything/mod.conf delete mode 100644 games/minimal/mods/chest_of_everything/textures/chest_of_everything_chest.png delete mode 100644 games/minimal/mods/dignodes/init.lua delete mode 100644 games/minimal/mods/dignodes/mod.conf delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_choppy.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_cracky.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_crumbly.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_dig_immediate.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_none.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_rating1.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_rating2.png delete mode 100644 games/minimal/mods/dignodes/textures/dignodes_rating3.png delete mode 100644 games/minimal/mods/experimental/commands.lua delete mode 100644 games/minimal/mods/experimental/detached.lua delete mode 100644 games/minimal/mods/experimental/init.lua delete mode 100644 games/minimal/mods/experimental/items.lua delete mode 100644 games/minimal/mods/experimental/mod.conf delete mode 100644 games/minimal/mods/experimental/textures/experimental_callback_node.png delete mode 100644 games/minimal/mods/experimental/textures/experimental_particle_sheet.png delete mode 100644 games/minimal/mods/experimental/textures/experimental_particle_vertical.png delete mode 100644 games/minimal/mods/experimental/textures/experimental_tester_tool_1.png delete mode 100644 games/minimal/mods/give_initial_stuff/init.lua delete mode 100644 games/minimal/mods/give_initial_stuff/mod.conf delete mode 100644 games/minimal/mods/initial_message/init.lua delete mode 100644 games/minimal/mods/initial_message/mod.conf delete mode 100644 games/minimal/mods/mapgen/init.lua delete mode 100644 games/minimal/mods/mapgen/mod.conf delete mode 100644 games/minimal/mods/modchannels/init.lua delete mode 100644 games/minimal/mods/modchannels/mod.conf delete mode 100644 games/minimal/mods/soundstuff/init.lua delete mode 100644 games/minimal/mods/soundstuff/mod.conf delete mode 100644 games/minimal/mods/soundstuff/sounds/soundstuff_mono.ogg delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_eat.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_blank.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_climbable.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_dig.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_dug.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_fall.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_footstep.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_place.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_place_failed.png delete mode 100644 games/minimal/mods/soundstuff/textures/soundstuff_node_sound.png delete mode 100644 games/minimal/mods/stairs/init.lua delete mode 100644 games/minimal/mods/stairs/mod.conf delete mode 100644 games/minimal/mods/testentities/armor.lua delete mode 100644 games/minimal/mods/testentities/callbacks.lua delete mode 100644 games/minimal/mods/testentities/init.lua delete mode 100644 games/minimal/mods/testentities/mod.conf delete mode 100644 games/minimal/mods/testentities/textures/testentities_armorball.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_callback.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_callback_step.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube1.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube2.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube3.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube4.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube5.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_cube6.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_dungeon_master.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_sprite.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_upright_sprite1.png delete mode 100644 games/minimal/mods/testentities/textures/testentities_upright_sprite2.png delete mode 100644 games/minimal/mods/testentities/visuals.lua delete mode 100644 games/minimal/mods/testfood/init.lua delete mode 100644 games/minimal/mods/testfood/mod.conf delete mode 100644 games/minimal/mods/testfood/textures/testfood_bad.png delete mode 100644 games/minimal/mods/testfood/textures/testfood_bad2.png delete mode 100644 games/minimal/mods/testfood/textures/testfood_good.png delete mode 100644 games/minimal/mods/testfood/textures/testfood_good2.png delete mode 100644 games/minimal/mods/testformspec/callbacks.lua delete mode 100644 games/minimal/mods/testformspec/dummy_items.lua delete mode 100644 games/minimal/mods/testformspec/formspec.lua delete mode 100644 games/minimal/mods/testformspec/init.lua delete mode 100644 games/minimal/mods/testformspec/mod.conf delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_animation.jpg delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_animation.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_9slice.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_9slice_hovered.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_9slice_pressed.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_hovered.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_bg_pressed.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_button_image.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_hovered.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_item.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_node.png delete mode 100644 games/minimal/mods/testformspec/textures/testformspec_pressed.png delete mode 100644 games/minimal/mods/testnodes/README.md delete mode 100644 games/minimal/mods/testnodes/drawtypes.lua delete mode 100644 games/minimal/mods/testnodes/init.lua delete mode 100644 games/minimal/mods/testnodes/light.lua delete mode 100644 games/minimal/mods/testnodes/liquids.lua delete mode 100644 games/minimal/mods/testnodes/meshes.lua delete mode 100644 games/minimal/mods/testnodes/mod.conf delete mode 100644 games/minimal/mods/testnodes/models/testnodes_ocorner.obj delete mode 100644 games/minimal/mods/testnodes/models/testnodes_pyramid.obj delete mode 100644 games/minimal/mods/testnodes/nodeboxes.lua delete mode 100644 games/minimal/mods/testnodes/param2.lua delete mode 100644 games/minimal/mods/testnodes/properties.lua delete mode 100644 games/minimal/mods/testnodes/settingtypes.txt delete mode 100644 games/minimal/mods/testnodes/textures.lua delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_1g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_1w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_1wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_2g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_2w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_2wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_3g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_3w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_3wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_4g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_4w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_4wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_5g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_5w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_5wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_6g.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_6w.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_6wg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_airlike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_allfaces.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_allfaces_optional.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_alpha.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_alpha128.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_alpha191.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_alpha64.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_anim.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attached_bottom.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attached_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attached_top.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attachedw_bottom.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attachedw_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_attachedw_top.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_bouncy.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_buildable_to.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_climbable_nojump_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_climbable_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_damage.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_damage_neg.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_drowning.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_fall_damage_minus.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_fall_damage_plus.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_fencelike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_firelike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike_detail.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike_framed.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike_framed2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslike_framed_optional.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_glasslikeliquid.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_10.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_11.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_12.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_13.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_14.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_7.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_8.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_light_9.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_line_crossing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_line_curved.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_line_straight.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_line_t_junction.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquid.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r0.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r7.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r8.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r0.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r7.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_liquidsource_r8.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_mesh_stripes.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_mesh_stripes2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_mesh_stripes3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_mesh_stripes4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_node.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_node_falling.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_nodebox.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_nojump_side.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_nojump_top.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal1.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal2.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal3.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal4.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal5.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_normal6.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_palette_facedir.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_palette_full.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_palette_wallmounted.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_degrotate.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_leveled.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_meshoptions.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_plantlike_waving.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail2_crossing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail2_curved.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail2_straight.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail2_t_junction.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail_crossing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail_curved.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail_straight.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_rail_t_junction.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_signlike.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_slippery.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_street_crossing.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_street_curved.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_street_straight.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_street_t_junction.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_sunlight_filter.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_torchlike_ceiling.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_torchlike_floor.png delete mode 100644 games/minimal/mods/testnodes/textures/testnodes_torchlike_wall.png delete mode 100644 games/minimal/mods/testpathfinder/README.md delete mode 100644 games/minimal/mods/testpathfinder/init.lua delete mode 100644 games/minimal/mods/testpathfinder/mod.conf delete mode 100644 games/minimal/mods/testpathfinder/textures/testpathfinder_testpathfinder.png delete mode 100644 games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint.png delete mode 100644 games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_end.png delete mode 100644 games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_start.png delete mode 100644 games/minimal/mods/testtools/README.md delete mode 100644 games/minimal/mods/testtools/init.lua delete mode 100644 games/minimal/mods/testtools/mod.conf delete mode 100644 games/minimal/mods/testtools/textures/testtools_entity_rotator.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_entity_scaler.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_entity_spawner.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_falling_node_tool.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_node_setter.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_object_attacher.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_object_editor.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_object_mover.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_param2tool.png delete mode 100644 games/minimal/mods/testtools/textures/testtools_remover.png delete mode 100644 games/minimal/mods/tiled/init.lua delete mode 100644 games/minimal/mods/tiled/mod.conf delete mode 100644 games/minimal/mods/tiled/textures/tiled_tiled.png delete mode 100644 games/minimal/mods/unittests/crafting.lua delete mode 100644 games/minimal/mods/unittests/crafting_prepare.lua delete mode 100644 games/minimal/mods/unittests/init.lua delete mode 100644 games/minimal/mods/unittests/mod.conf delete mode 100644 games/minimal/mods/unittests/player.lua delete mode 100644 games/minimal/mods/unittests/random.lua delete mode 100644 games/minimal/mods/unittests/textures/unittests_coal_lump.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_iron_lump.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_repairable_tool.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_steel_ingot.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_stick.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_torch.png delete mode 100644 games/minimal/mods/unittests/textures/unittests_unrepairable_tool.png delete mode 100644 games/minimal/mods/util_commands/init.lua delete mode 100644 games/minimal/mods/util_commands/mod.conf delete mode 100644 games/minimal/screenshot.png delete mode 100644 games/minimal/settingtypes.txt (limited to 'util') diff --git a/CMakeLists.txt b/CMakeLists.txt index ae842918b..a5f644652 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,7 +167,7 @@ endif() install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game" DESTINATION "${SHAREDIR}/games/" COMPONENT "SUBGAME_MINETEST_GAME" OPTIONAL PATTERN ".git*" EXCLUDE ) -install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minimal" DESTINATION "${SHAREDIR}/games/" +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/devtest" DESTINATION "${SHAREDIR}/games/" COMPONENT "SUBGAME_MINIMAL" OPTIONAL PATTERN ".git*" EXCLUDE ) if(BUILD_CLIENT) @@ -254,8 +254,8 @@ cpack_add_component(SUBGAME_MINETEST_GAME ) cpack_add_component(SUBGAME_MINIMAL - DISPLAY_NAME "Minimal development test" - DESCRIPTION "A minimal subgame helping to develop the engine." + DISPLAY_NAME "Development Test" + DESCRIPTION "A minimal test game helping to develop the engine." DISABLED #DISABLED does not mean it is disabled, and is just not selected by default. GROUP "Subgames" ) diff --git a/README.md b/README.md index 202ba4fe2..6a3c11f40 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ Download source (this is the URL to the latest of source repository, which might git clone --depth 1 https://github.com/minetest/minetest.git cd minetest -Download minetest_game (otherwise only the "Minimal development test" game is available) using Git: +Download minetest_game (otherwise only the "Development Test" game is available) using Git: git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua index 0d977a17c..36df23cce 100644 --- a/builtin/mainmenu/dlg_create_world.lua +++ b/builtin/mainmenu/dlg_create_world.lua @@ -304,13 +304,13 @@ local function create_world_formspec(dialogdata) label_spflags = "label[0,"..y_start..";" .. fgettext("Mapgen-specific flags") .. "]" end - -- Warning if only minimal is installed - local minimal_only = "" + -- Warning if only devtest is installed + local devtest_only = "" local gamelist_height = 2.3 - if #pkgmgr.games == 1 and pkgmgr.games[1].id == "minimal" then - minimal_only = "box[0,0;5.8,1.7;#ff8800]" .. + if #pkgmgr.games == 1 and pkgmgr.games[1].id == "devtest" then + devtest_only = "box[0,0;5.8,1.7;#ff8800]" .. "textarea[0.3,0;6,1.8;;;".. - fgettext("Warning: The minimal development test is meant for developers.") .. "\n" .. + fgettext("Warning: The Development Test is meant for developers.") .. "\n" .. fgettext("Download a game, such as Minetest Game, from minetest.net") .. "]" gamelist_height = 0.5 end @@ -335,7 +335,7 @@ local function create_world_formspec(dialogdata) "textlist[0,3.85;5.8,"..gamelist_height..";games;" .. pkgmgr.gamelist() .. ";" .. gameidx .. ";false]" .. "container[0,4.5]" .. - minimal_only .. + devtest_only .. "container_end[]" .. "container_end[]" .. diff --git a/doc/lua_api.txt b/doc/lua_api.txt index a77c7567e..c4310aa5b 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1069,7 +1069,7 @@ Node drawtypes There are a bunch of different looking node types. -Look for examples in `games/minimal` or `games/minetest_game`. +Look for examples in `games/devtest` or `games/minetest_game`. * `normal` * A node-sized cube. diff --git a/games/devtest/LICENSE.txt b/games/devtest/LICENSE.txt new file mode 100644 index 000000000..71bd0e596 --- /dev/null +++ b/games/devtest/LICENSE.txt @@ -0,0 +1,4 @@ +License information for Development Test +---------------------------------------- + +The same license as for Minetest applies. diff --git a/games/devtest/README.md b/games/devtest/README.md new file mode 100644 index 000000000..a7e93cf11 --- /dev/null +++ b/games/devtest/README.md @@ -0,0 +1,52 @@ +# Development Test (devtest) + +This is a basic testing environment that contains a bunch of things to test the engine, but it could also be used as a minimal testbed for testing out mods. + +## Features + +* Basic nodes for mapgen +* Basic, minimal map generator +* Lots of example nodes for testing drawtypes, param2, light level, and many other node properties +* Example entities +* Other example items +* Formspec test (via `/test_formspec` command) +* Automated unit tests (disabled by default) +* Tools for manipulating nodes and entities, like the "Param2 Tool" + +## Getting started + +Basically, just create a world and start. A few important things to note: + +* Items are gotten from the “Chest of Everything” (`chest_of_everything:chest`) +* When you lost your initial items, type in `/stuff` command to get them back +* By default, Creative Mode activates infinite node placement. This behavior can be changed with the `devtest_infplace` setting +* Use the `/infplace` command to toggle infinite node placement in-game +* Use the Param2 Tool to change the param2 of nodes; it's useful to experiment with the various drawtype test nodes +* Check out the game settings and server commands for additional tests and features +* Creative Mode does nothing (apart from default engine behavior) + +Confused by a certain node or item? Check out for inline code comments. + +### Example tests + +* You can use this to test what happens if a player is simultaneously in 2 nodes with `damage_per_second` but with a different value. +* Or use the Falling Node Tool on various test nodes to see how they behave when falling. +* You could also use this as a testbed for dependency-free mods, e.g. to test out how your formspecs behave without theming. + +## Random notes + +* Experimental/strange/unstructured tests can be found in the `experimental` mod +* Textures of drawtype test nodes have a red dot at the top left corner. This is to see whether the textures are oriented properly + +## Design philosophy + +This should loosely follow the following principles: + +* Engine testing: The main focus of this is to aid testing of *engine* features, such as mapgen or node drawtypes +* Mod testing: The secondary focus is to help modders as well, either as a minimal testbed for mods or even as a code example +* Minimal interference: Under default settings, it shall not interfere with APIs except on explicit user wish. Non-trivial tests and features need to be enabled by a setting first +* Convenience: Have various tools to make usage easier and more convenient +* Reproducing engine bugs: When an engine bug was found, consider creating a test case +* Clarity: Textures and names need to be designed to keep different things clearly visually apart at a glance +* Low loading time: It must load blazing-fast so stuff can be tested quickly + diff --git a/games/devtest/game.conf b/games/devtest/game.conf new file mode 100644 index 000000000..d6e382ad7 --- /dev/null +++ b/games/devtest/game.conf @@ -0,0 +1,2 @@ +name = Development Test +description = Testing environment to help with testing the engine features of Minetest. It can also be helpful in mod development. diff --git a/games/devtest/menu/background.png b/games/devtest/menu/background.png new file mode 100644 index 000000000..415bb3d14 Binary files /dev/null and b/games/devtest/menu/background.png differ diff --git a/games/devtest/menu/header.png b/games/devtest/menu/header.png new file mode 100644 index 000000000..c80ed71f1 Binary files /dev/null and b/games/devtest/menu/header.png differ diff --git a/games/devtest/menu/icon.png b/games/devtest/menu/icon.png new file mode 100644 index 000000000..f854b9c31 Binary files /dev/null and b/games/devtest/menu/icon.png differ diff --git a/games/devtest/mods/basenodes/init.lua b/games/devtest/mods/basenodes/init.lua new file mode 100644 index 000000000..8156c4bec --- /dev/null +++ b/games/devtest/mods/basenodes/init.lua @@ -0,0 +1,334 @@ +local WATER_ALPHA = 160 +local WATER_VISC = 1 +local LAVA_VISC = 7 + +-- +-- Node definitions +-- + +-- Register nodes + +minetest.register_node("basenodes:stone", { + description = "Stone", + tiles = {"default_stone.png"}, + groups = {cracky=3}, +}) + +minetest.register_node("basenodes:desert_stone", { + description = "Desert Stone", + tiles = {"default_desert_stone.png"}, + groups = {cracky=3}, +}) + +minetest.register_node("basenodes:dirt_with_grass", { + description = "Dirt with Grass", + tiles ={"default_grass.png", + -- a little dot on the bottom to distinguish it from dirt + "default_dirt.png^basenodes_dirt_with_grass_bottom.png", + {name = "default_dirt.png^default_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly=3, soil=1}, +}) + +minetest.register_node("basenodes:dirt_with_snow", { + description = "Dirt with Snow", + tiles ={"basenodes_dirt_with_snow.png", + -- a little dot on the bottom to distinguish it from dirt + "default_dirt.png^basenodes_dirt_with_snow_bottom.png", + {name = "default_dirt.png^default_snow_side.png", + tileable_vertical = false}}, + groups = {crumbly=3, soil=1}, +}) + +minetest.register_node("basenodes:dirt", { + description = "Dirt", + tiles ={"default_dirt.png"}, + groups = {crumbly=3, soil=1}, +}) + +minetest.register_node("basenodes:sand", { + description = "Sand", + tiles ={"default_sand.png"}, + groups = {crumbly=3}, +}) + +minetest.register_node("basenodes:desert_sand", { + description = "Desert Sand", + tiles ={"default_desert_sand.png"}, + groups = {crumbly=3}, +}) + +minetest.register_node("basenodes:gravel", { + description = "Gravel", + tiles ={"default_gravel.png"}, + groups = {crumbly=2}, +}) + +minetest.register_node("basenodes:junglegrass", { + description = "Jungle Grass", + drawtype = "plantlike", + tiles ={"default_junglegrass.png"}, + inventory_image = "default_junglegrass.png", + wield_image = "default_junglegrass.png", + paramtype = "light", + walkable = false, + groups = {snappy=3}, +}) + +minetest.register_node("basenodes:tree", { + description = "Normal Tree Trunk", + tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=1}, +}) + +minetest.register_node("basenodes:leaves", { + description = "Normal Leaves", + drawtype = "allfaces_optional", + tiles = {"default_leaves.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3}, +}) + +minetest.register_node("basenodes:jungletree", { + description = "Jungle Tree Trunk", + tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=1}, +}) + +minetest.register_node("basenodes:jungleleaves", { + description = "Jungle Leaves", + drawtype = "allfaces_optional", + tiles = {"default_jungleleaves.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3}, +}) + +minetest.register_node("basenodes:pine_tree", { + description = "Pine Tree Trunk", + tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", "default_pine_tree.png"}, + is_ground_content = false, + groups = {choppy=2,oddly_breakable_by_hand=1}, +}) + +minetest.register_node("basenodes:pine_needles", { + description = "Pine Needles", + drawtype = "allfaces_optional", + tiles = {"default_pine_needles.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3}, +}) + +minetest.register_node("basenodes:water_source", { + description = "Water Source", + drawtype = "liquid", + tiles = {"default_water.png"}, + special_tiles = { + {name = "default_water.png", backface_culling = false}, + {name = "default_water.png", backface_culling = true}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "basenodes:water_flowing", + liquid_alternative_source = "basenodes:water_source", + liquid_viscosity = WATER_VISC, + post_effect_color = {a = 64, r = 100, g = 100, b = 200}, + groups = {water = 3, liquid = 3}, +}) + +minetest.register_node("basenodes:water_flowing", { + description = "Flowing Water", + drawtype = "flowingliquid", + tiles = {"default_water_flowing.png"}, + special_tiles = { + {name = "default_water_flowing.png", backface_culling = false}, + {name = "default_water_flowing.png", backface_culling = false}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "basenodes:water_flowing", + liquid_alternative_source = "basenodes:water_source", + liquid_viscosity = WATER_VISC, + post_effect_color = {a = 64, r = 100, g = 100, b = 200}, + groups = {water = 3, liquid = 3}, +}) + +minetest.register_node("basenodes:river_water_source", { + description = "River Water Source", + drawtype = "liquid", + tiles = { "default_river_water.png" }, + special_tiles = { + {name = "default_river_water.png", backface_culling = false}, + {name = "default_river_water.png", backface_culling = true}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "basenodes:river_water_flowing", + liquid_alternative_source = "basenodes:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, }, +}) + +minetest.register_node("basenodes:river_water_flowing", { + description = "Flowing River Water", + drawtype = "flowingliquid", + tiles = {"default_river_water_flowing.png"}, + special_tiles = { + {name = "default_river_water_flowing.png", backface_culling = false}, + {name = "default_river_water_flowing.png", backface_culling = false}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "basenodes:river_water_flowing", + liquid_alternative_source = "basenodes:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, }, +}) + +minetest.register_node("basenodes:lava_flowing", { + description = "Flowing Lava", + drawtype = "flowingliquid", + tiles = {"default_lava_flowing.png"}, + special_tiles = { + {name="default_lava_flowing.png", backface_culling = false}, + {name="default_lava_flowing.png", backface_culling = false}, + }, + paramtype = "light", + light_source = minetest.LIGHT_MAX, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + damage_per_second = 4, + liquidtype = "flowing", + liquid_alternative_flowing = "basenodes:lava_flowing", + liquid_alternative_source = "basenodes:lava_source", + liquid_viscosity = LAVA_VISC, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=1}, +}) + +minetest.register_node("basenodes:lava_source", { + description = "Lava Source", + drawtype = "liquid", + tiles = { "default_lava.png" }, + special_tiles = { + {name = "default_lava.png", backface_culling = false}, + {name = "default_lava.png", backface_culling = true}, + }, + paramtype = "light", + light_source = minetest.LIGHT_MAX, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drowning = 1, + damage_per_second = 4, + liquidtype = "source", + liquid_alternative_flowing = "basenodes:lava_flowing", + liquid_alternative_source = "basenodes:lava_source", + liquid_viscosity = LAVA_VISC, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=1}, +}) + +minetest.register_node("basenodes:cobble", { + description = "Cobblestone", + tiles ={"default_cobble.png"}, + is_ground_content = false, + groups = {cracky=3}, +}) + +minetest.register_node("basenodes:mossycobble", { + description = "Mossy Cobblestone", + tiles ={"default_mossycobble.png"}, + is_ground_content = false, + groups = {cracky=3}, +}) + +minetest.register_node("basenodes:apple", { + description = "Apple", + drawtype = "plantlike", + tiles ={"default_apple.png"}, + inventory_image = "default_apple.png", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + walkable = false, + groups = {dig_immediate=3}, + + -- Make eatable because why not? + on_use = minetest.item_eat(2), +}) + +minetest.register_node("basenodes:ice", { + description = "Ice", + tiles ={"default_ice.png"}, + groups = {cracky=3}, +}) + +-- The snow nodes intentionally have different tints to make them more +-- distinguishable +minetest.register_node("basenodes:snow", { + description = "Snow Sheet", + tiles = {"basenodes_snow_sheet.png"}, + groups = {crumbly=3}, + walkable = false, + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + }, +}) + +minetest.register_node("basenodes:snowblock", { + description = "Snow Block", + tiles ={"default_snow.png"}, + groups = {crumbly=3}, +}) + + diff --git a/games/devtest/mods/basenodes/mod.conf b/games/devtest/mods/basenodes/mod.conf new file mode 100644 index 000000000..25024dc63 --- /dev/null +++ b/games/devtest/mods/basenodes/mod.conf @@ -0,0 +1,2 @@ +name = basenodes +description = Contains basic nodes for mapgen diff --git a/games/devtest/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png new file mode 100644 index 000000000..5e8fc41a9 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png differ diff --git a/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow.png b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow.png new file mode 100644 index 000000000..7ea2d8d31 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow.png differ diff --git a/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png new file mode 100644 index 000000000..447c94e98 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png differ diff --git a/games/devtest/mods/basenodes/textures/basenodes_snow_sheet.png b/games/devtest/mods/basenodes/textures/basenodes_snow_sheet.png new file mode 100644 index 000000000..455332093 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/basenodes_snow_sheet.png differ diff --git a/games/devtest/mods/basenodes/textures/default_apple.png b/games/devtest/mods/basenodes/textures/default_apple.png new file mode 100644 index 000000000..9c115dae4 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_apple.png differ diff --git a/games/devtest/mods/basenodes/textures/default_cobble.png b/games/devtest/mods/basenodes/textures/default_cobble.png new file mode 100644 index 000000000..5b859e9c2 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_cobble.png differ diff --git a/games/devtest/mods/basenodes/textures/default_desert_sand.png b/games/devtest/mods/basenodes/textures/default_desert_sand.png new file mode 100644 index 000000000..19ec87dc0 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_desert_sand.png differ diff --git a/games/devtest/mods/basenodes/textures/default_desert_stone.png b/games/devtest/mods/basenodes/textures/default_desert_stone.png new file mode 100644 index 000000000..5126fb61c Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_desert_stone.png differ diff --git a/games/devtest/mods/basenodes/textures/default_dirt.png b/games/devtest/mods/basenodes/textures/default_dirt.png new file mode 100644 index 000000000..58670305d Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_dirt.png differ diff --git a/games/devtest/mods/basenodes/textures/default_grass.png b/games/devtest/mods/basenodes/textures/default_grass.png new file mode 100644 index 000000000..3d6397186 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_grass.png differ diff --git a/games/devtest/mods/basenodes/textures/default_grass_side.png b/games/devtest/mods/basenodes/textures/default_grass_side.png new file mode 100644 index 000000000..04770b6f6 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_grass_side.png differ diff --git a/games/devtest/mods/basenodes/textures/default_gravel.png b/games/devtest/mods/basenodes/textures/default_gravel.png new file mode 100644 index 000000000..7e5ff616f Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_gravel.png differ diff --git a/games/devtest/mods/basenodes/textures/default_ice.png b/games/devtest/mods/basenodes/textures/default_ice.png new file mode 100644 index 000000000..c4bddd223 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_ice.png differ diff --git a/games/devtest/mods/basenodes/textures/default_junglegrass.png b/games/devtest/mods/basenodes/textures/default_junglegrass.png new file mode 100644 index 000000000..d64e33abc Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_junglegrass.png differ diff --git a/games/devtest/mods/basenodes/textures/default_jungleleaves.png b/games/devtest/mods/basenodes/textures/default_jungleleaves.png new file mode 100644 index 000000000..1fa67e83a Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_jungleleaves.png differ diff --git a/games/devtest/mods/basenodes/textures/default_jungletree.png b/games/devtest/mods/basenodes/textures/default_jungletree.png new file mode 100644 index 000000000..053850fa7 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_jungletree.png differ diff --git a/games/devtest/mods/basenodes/textures/default_jungletree_top.png b/games/devtest/mods/basenodes/textures/default_jungletree_top.png new file mode 100644 index 000000000..e80de8a69 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_jungletree_top.png differ diff --git a/games/devtest/mods/basenodes/textures/default_lava.png b/games/devtest/mods/basenodes/textures/default_lava.png new file mode 100644 index 000000000..a4cf649f1 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_lava.png differ diff --git a/games/devtest/mods/basenodes/textures/default_lava_flowing.png b/games/devtest/mods/basenodes/textures/default_lava_flowing.png new file mode 100644 index 000000000..07066a6e3 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_lava_flowing.png differ diff --git a/games/devtest/mods/basenodes/textures/default_leaves.png b/games/devtest/mods/basenodes/textures/default_leaves.png new file mode 100644 index 000000000..c0475d4d2 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_leaves.png differ diff --git a/games/devtest/mods/basenodes/textures/default_mossycobble.png b/games/devtest/mods/basenodes/textures/default_mossycobble.png new file mode 100644 index 000000000..69585e37b Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_mossycobble.png differ diff --git a/games/devtest/mods/basenodes/textures/default_pine_needles.png b/games/devtest/mods/basenodes/textures/default_pine_needles.png new file mode 100644 index 000000000..137caa2a3 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_pine_needles.png differ diff --git a/games/devtest/mods/basenodes/textures/default_pine_tree.png b/games/devtest/mods/basenodes/textures/default_pine_tree.png new file mode 100644 index 000000000..5743183c0 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_pine_tree.png differ diff --git a/games/devtest/mods/basenodes/textures/default_pine_tree_top.png b/games/devtest/mods/basenodes/textures/default_pine_tree_top.png new file mode 100644 index 000000000..cc18f3462 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_pine_tree_top.png differ diff --git a/games/devtest/mods/basenodes/textures/default_river_water.png b/games/devtest/mods/basenodes/textures/default_river_water.png new file mode 100644 index 000000000..e1074d2ef Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_river_water.png differ diff --git a/games/devtest/mods/basenodes/textures/default_river_water_flowing.png b/games/devtest/mods/basenodes/textures/default_river_water_flowing.png new file mode 100644 index 000000000..4a756b2bd Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_river_water_flowing.png differ diff --git a/games/devtest/mods/basenodes/textures/default_sand.png b/games/devtest/mods/basenodes/textures/default_sand.png new file mode 100644 index 000000000..0ed0e4ceb Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_sand.png differ diff --git a/games/devtest/mods/basenodes/textures/default_snow.png b/games/devtest/mods/basenodes/textures/default_snow.png new file mode 100644 index 000000000..c42e0eecb Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_snow.png differ diff --git a/games/devtest/mods/basenodes/textures/default_snow_side.png b/games/devtest/mods/basenodes/textures/default_snow_side.png new file mode 100644 index 000000000..f34d10991 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_snow_side.png differ diff --git a/games/devtest/mods/basenodes/textures/default_stone.png b/games/devtest/mods/basenodes/textures/default_stone.png new file mode 100644 index 000000000..763b4396a Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_stone.png differ diff --git a/games/devtest/mods/basenodes/textures/default_tree.png b/games/devtest/mods/basenodes/textures/default_tree.png new file mode 100644 index 000000000..189ec1593 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_tree.png differ diff --git a/games/devtest/mods/basenodes/textures/default_tree_top.png b/games/devtest/mods/basenodes/textures/default_tree_top.png new file mode 100644 index 000000000..d1a4fa704 Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_tree_top.png differ diff --git a/games/devtest/mods/basenodes/textures/default_water.png b/games/devtest/mods/basenodes/textures/default_water.png new file mode 100644 index 000000000..3e385ae8b Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_water.png differ diff --git a/games/devtest/mods/basenodes/textures/default_water_flowing.png b/games/devtest/mods/basenodes/textures/default_water_flowing.png new file mode 100644 index 000000000..7cdafd51d Binary files /dev/null and b/games/devtest/mods/basenodes/textures/default_water_flowing.png differ diff --git a/games/devtest/mods/basetools/init.lua b/games/devtest/mods/basetools/init.lua new file mode 100644 index 000000000..d9d9afb07 --- /dev/null +++ b/games/devtest/mods/basetools/init.lua @@ -0,0 +1,295 @@ +-- +-- Tool definitions +-- + +--[[ TOOLS SUMMARY: + +Tool types: + +* Hand: basic tool/weapon (just for convenience, not optimized for testing) +* Pickaxe: dig cracky +* Axe: dig choppy +* Shovel: dig crumbly +* Shears: dig snappy +* Sword: deal damage +* Dagger: deal damage, but faster + +Tool materials: + +* Dirt: dig nodes of rating 3, one use only +* Wood: dig nodes of rating 3 +* Stone: dig nodes of rating 3 or 2 +* Steel: dig nodes of rating 3, 2 or 1 +* Mese: dig "everything" instantly +]] + +-- The hand +minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x=1,y=1,z=2.5}, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level = 0, + groupcaps = { + crumbly = {times={[3]=1.50}, uses=0, maxlevel=0}, + snappy = {times={[3]=1.50}, uses=0, maxlevel=0}, + oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=2.00}, uses=0, maxlevel=0}, + }, + damage_groups = {fleshy=1}, + } +}) + +-- Mese Pickaxe: special tool that digs "everything" instantly +minetest.register_tool("basetools:pick_mese", { + description = "Mese Pickaxe", + inventory_image = "basetools_mesepick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + cracky={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + crumbly={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + snappy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + choppy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + dig_immediate={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, + }, + }, +}) + + +-- +-- Pickaxes: Dig cracky +-- + +-- This should break after only 1 use +minetest.register_tool("basetools:pick_dirt", { + description = "Dirt Pickaxe", + inventory_image = "basetools_dirtpick.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[3]=2.00}, uses=1, maxlevel=0} + }, + }, +}) + +minetest.register_tool("basetools:pick_wood", { + description = "Wooden Pickaxe", + inventory_image = "basetools_woodpick.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[3]=2.00}, uses=30, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:pick_stone", { + description = "Stone Pickaxe", + inventory_image = "basetools_stonepick.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[2]=1.20, [3]=0.80}, uses=60, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:pick_steel", { + description = "Steel Pickaxe", + inventory_image = "basetools_steelpick.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:pick_steel_l1", { + description = "Steel Pickaxe Level 1", + inventory_image = "basetools_steelpick_l1.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=1} + }, + }, +}) +minetest.register_tool("basetools:pick_steel_l2", { + description = "Steel Pickaxe Level 2", + inventory_image = "basetools_steelpick_l2.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=2} + }, + }, +}) + +-- +-- Shovels (dig crumbly) +-- + +minetest.register_tool("basetools:shovel_wood", { + description = "Wooden Shovel", + inventory_image = "basetools_woodshovel.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + crumbly={times={[3]=0.50}, uses=30, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:shovel_stone", { + description = "Stone Shovel", + inventory_image = "basetools_stoneshovel.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + crumbly={times={[2]=0.50, [3]=0.30}, uses=60, maxlevel=0} + }, + }, +}) +minetest.register_tool("basetools:shovel_steel", { + description = "Steel Shovel", + inventory_image = "basetools_steelshovel.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=90, maxlevel=0} + }, + }, +}) + +-- +-- Axes (dig choppy) +-- + +minetest.register_tool("basetools:axe_wood", { + description = "Wooden Axe", + inventory_image = "basetools_woodaxe.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + choppy={times={[3]=0.80}, uses=30, maxlevel=0}, + }, + }, +}) +minetest.register_tool("basetools:axe_stone", { + description = "Stone Axe", + inventory_image = "basetools_stoneaxe.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + choppy={times={[2]=1.00, [3]=0.60}, uses=60, maxlevel=0}, + }, + }, +}) +minetest.register_tool("basetools:axe_steel", { + description = "Steel Axe", + inventory_image = "basetools_steelaxe.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=90, maxlevel=0}, + }, + }, +}) + +-- +-- Shears (dig snappy) +-- + +minetest.register_tool("basetools:shears_wood", { + description = "Wooden Shears", + inventory_image = "basetools_woodshears.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + snappy={times={[3]=1.00}, uses=30, maxlevel=0}, + }, + }, +}) +minetest.register_tool("basetools:shears_stone", { + description = "Stone Shears", + inventory_image = "basetools_stoneshears.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + snappy={times={[2]=1.00, [3]=0.50}, uses=60, maxlevel=0}, + }, + }, +}) +minetest.register_tool("basetools:shears_steel", { + description = "Steel Shears", + inventory_image = "basetools_steelshears.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + snappy={times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=90, maxlevel=0}, + }, + }, +}) + +-- +-- Swords (deal damage) +-- + +minetest.register_tool("basetools:sword_wood", { + description = "Wooden Sword", + inventory_image = "basetools_woodsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + damage_groups = {fleshy=2}, + } +}) +minetest.register_tool("basetools:sword_stone", { + description = "Stone Sword", + inventory_image = "basetools_stonesword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + damage_groups = {fleshy=4}, + } +}) +minetest.register_tool("basetools:sword_steel", { + description = "Steel Sword", + inventory_image = "basetools_steelsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + damage_groups = {fleshy=6}, + } +}) + +-- Fire/Ice sword: Deal damage to non-fleshy damage groups +minetest.register_tool("basetools:sword_fire", { + description = "Fire Sword", + inventory_image = "basetools_firesword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + damage_groups = {icy=6}, + } +}) +minetest.register_tool("basetools:sword_ice", { + description = "Ice Sword", + inventory_image = "basetools_icesword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + damage_groups = {firy=6}, + } +}) + +-- +-- Dagger: Low damage, fast punch interval +-- +minetest.register_tool("basetools:dagger_steel", { + description = "Steel Dagger", + inventory_image = "basetools_steeldagger.png", + tool_capabilities = { + full_punch_interval = 0.5, + max_drop_level=0, + damage_groups = {fleshy=2}, + } +}) diff --git a/games/devtest/mods/basetools/mod.conf b/games/devtest/mods/basetools/mod.conf new file mode 100644 index 000000000..f0d9f657d --- /dev/null +++ b/games/devtest/mods/basetools/mod.conf @@ -0,0 +1,2 @@ +name = basetools +description = Contains basic digging tools diff --git a/games/devtest/mods/basetools/textures/basetools_dirtpick.png b/games/devtest/mods/basetools/textures/basetools_dirtpick.png new file mode 100644 index 000000000..20a021d72 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_dirtpick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_firesword.png b/games/devtest/mods/basetools/textures/basetools_firesword.png new file mode 100644 index 000000000..ee2809ab7 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_firesword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_icesword.png b/games/devtest/mods/basetools/textures/basetools_icesword.png new file mode 100644 index 000000000..35ba8214b Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_icesword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_mesepick.png b/games/devtest/mods/basetools/textures/basetools_mesepick.png new file mode 100644 index 000000000..2b5e12cdb Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_mesepick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelaxe.png b/games/devtest/mods/basetools/textures/basetools_steelaxe.png new file mode 100644 index 000000000..aac594d84 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelaxe.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steeldagger.png b/games/devtest/mods/basetools/textures/basetools_steeldagger.png new file mode 100644 index 000000000..4c9173094 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steeldagger.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelpick.png b/games/devtest/mods/basetools/textures/basetools_steelpick.png new file mode 100644 index 000000000..bc02aac3e Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelpick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelpick_l1.png b/games/devtest/mods/basetools/textures/basetools_steelpick_l1.png new file mode 100644 index 000000000..dc03f3f65 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelpick_l1.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelpick_l2.png b/games/devtest/mods/basetools/textures/basetools_steelpick_l2.png new file mode 100644 index 000000000..011df4584 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelpick_l2.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelshears.png b/games/devtest/mods/basetools/textures/basetools_steelshears.png new file mode 100644 index 000000000..04c86c370 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelshears.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelshovel.png b/games/devtest/mods/basetools/textures/basetools_steelshovel.png new file mode 100644 index 000000000..8cab60784 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelshovel.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_steelsword.png b/games/devtest/mods/basetools/textures/basetools_steelsword.png new file mode 100644 index 000000000..9909365c3 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_steelsword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stoneaxe.png b/games/devtest/mods/basetools/textures/basetools_stoneaxe.png new file mode 100644 index 000000000..a374c547d Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stoneaxe.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stonepick.png b/games/devtest/mods/basetools/textures/basetools_stonepick.png new file mode 100644 index 000000000..d9156ee3a Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stonepick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stoneshears.png b/games/devtest/mods/basetools/textures/basetools_stoneshears.png new file mode 100644 index 000000000..0b4bd3b74 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stoneshears.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stoneshovel.png b/games/devtest/mods/basetools/textures/basetools_stoneshovel.png new file mode 100644 index 000000000..3c1bb48cb Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stoneshovel.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_stonesword.png b/games/devtest/mods/basetools/textures/basetools_stonesword.png new file mode 100644 index 000000000..6f3e94cda Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_stonesword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodaxe.png b/games/devtest/mods/basetools/textures/basetools_woodaxe.png new file mode 100644 index 000000000..4015e910f Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodaxe.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodpick.png b/games/devtest/mods/basetools/textures/basetools_woodpick.png new file mode 100644 index 000000000..15c61f408 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodpick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodshears.png b/games/devtest/mods/basetools/textures/basetools_woodshears.png new file mode 100644 index 000000000..4ff92fd7c Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodshears.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodshovel.png b/games/devtest/mods/basetools/textures/basetools_woodshovel.png new file mode 100644 index 000000000..6cc52f8a1 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodshovel.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_woodsword.png b/games/devtest/mods/basetools/textures/basetools_woodsword.png new file mode 100644 index 000000000..364016ed6 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_woodsword.png differ diff --git a/games/devtest/mods/bucket/init.lua b/games/devtest/mods/bucket/init.lua new file mode 100644 index 000000000..3189d4aa6 --- /dev/null +++ b/games/devtest/mods/bucket/init.lua @@ -0,0 +1,26 @@ +-- Bucket: Punch liquid source or flowing liquid to collect it + +minetest.register_tool("bucket:bucket", { + description = "Bucket", + inventory_image = "bucket.png", + stack_max = 1, + liquids_pointable = true, + groups = { disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + -- Check if pointing to a liquid + local n = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[n.name] + if def ~= nil and (def.liquidtype == "source" or def.liquidtype == "flowing") then + minetest.add_node(pointed_thing.under, {name="air"}) + local inv = user:get_inventory() + if inv then + inv:add_item("main", ItemStack(n.name)) + end + end + end, +}) + diff --git a/games/devtest/mods/bucket/mod.conf b/games/devtest/mods/bucket/mod.conf new file mode 100644 index 000000000..d14deb4ea --- /dev/null +++ b/games/devtest/mods/bucket/mod.conf @@ -0,0 +1,2 @@ +name = bucket +description = Minimal bucket to pick up liquids diff --git a/games/devtest/mods/bucket/textures/bucket.png b/games/devtest/mods/bucket/textures/bucket.png new file mode 100644 index 000000000..677952875 Binary files /dev/null and b/games/devtest/mods/bucket/textures/bucket.png differ diff --git a/games/devtest/mods/bucket/textures/bucket_lava.png b/games/devtest/mods/bucket/textures/bucket_lava.png new file mode 100644 index 000000000..dfcae65fb Binary files /dev/null and b/games/devtest/mods/bucket/textures/bucket_lava.png differ diff --git a/games/devtest/mods/bucket/textures/bucket_water.png b/games/devtest/mods/bucket/textures/bucket_water.png new file mode 100644 index 000000000..e164b0a50 Binary files /dev/null and b/games/devtest/mods/bucket/textures/bucket_water.png differ diff --git a/games/devtest/mods/chest/init.lua b/games/devtest/mods/chest/init.lua new file mode 100644 index 000000000..c44522cb9 --- /dev/null +++ b/games/devtest/mods/chest/init.lua @@ -0,0 +1,27 @@ +minetest.register_node("chest:chest", { + description = "Chest", + tiles ={"chest_chest.png^[sheet:2x2:0,0", "chest_chest.png^[sheet:2x2:0,0", + "chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:1,0", + "chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:0,1"}, + paramtype2 = "facedir", + groups = {dig_immediate=2,choppy=3}, + is_ground_content = false, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + "list[current_name;main;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]" .. + "listring[]") + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, +}) + + diff --git a/games/devtest/mods/chest/mod.conf b/games/devtest/mods/chest/mod.conf new file mode 100644 index 000000000..0d7500164 --- /dev/null +++ b/games/devtest/mods/chest/mod.conf @@ -0,0 +1,2 @@ +name = chest +description = A simple chest to store items diff --git a/games/devtest/mods/chest/textures/chest_chest.png b/games/devtest/mods/chest/textures/chest_chest.png new file mode 100644 index 000000000..824b4d502 Binary files /dev/null and b/games/devtest/mods/chest/textures/chest_chest.png differ diff --git a/games/devtest/mods/chest_of_everything/init.lua b/games/devtest/mods/chest_of_everything/init.lua new file mode 100644 index 000000000..7d61abebf --- /dev/null +++ b/games/devtest/mods/chest_of_everything/init.lua @@ -0,0 +1,135 @@ +local F = minetest.formspec_escape + +-- Create a detached inventory +local inv_everything = minetest.create_detached_inventory("everything", { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + return 0 + end, + allow_put = function(inv, listname, index, stack, player) + return 0 + end, + allow_take = function(inv, listname, index, stack, player) + return -1 + end, +}) +local inv_trash = minetest.create_detached_inventory("trash", { + allow_take = function(inv, listname, index, stack, player) + return 0 + end, + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + return 0 + end, + on_put = function(inv, listname, index, stack, player) + inv:set_list("main", {}) + end, +}) +inv_trash:set_size("main", 1) + +local max_page = 1 + +local function get_chest_formspec(page) + local start = 0 + (page-1)*32 + return "size[8,9]".. + "list[detached:everything;main;0,0;8,4;"..start.."]".. + "list[current_player;main;0,5;8,4;]" .. + "label[6,4;Trash:]" .. + "list[detached:trash;main;7,4;1,1]" .. + "button[0,4;1,1;chest_of_everything_prev;"..F("<").."]".. + "button[1,4;1,1;chest_of_everything_next;"..F(">").."]".. + "label[2,4;"..F("Page: "..page).."]".. + "listring[detached:everything;main]".. + "listring[current_player;main]".. + "listring[detached:trash;main]" +end + +minetest.register_node("chest_of_everything:chest", { + description = "Chest of Everything", + tiles ={"chest_of_everything_chest.png^[sheet:2x2:0,0", "chest_of_everything_chest.png^[sheet:2x2:0,0", + "chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:1,0", + "chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:0,1"}, + paramtype2 = "facedir", + groups = {dig_immediate=2,choppy=3}, + is_ground_content = false, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Chest of Everything") + meta:set_int("page", 1) + meta:set_string("formspec", get_chest_formspec(1)) + end, + on_receive_fields = function(pos, formname, fields, sender) + if formname == "" then + local meta = minetest.get_meta(pos) + local page = meta:get_int("page") + if fields.chest_of_everything_prev then + page = page - 1 + elseif fields.chest_of_everything_next then + page = page + 1 + end + if page < 1 then + page = 1 + end + if page > max_page then + page = max_page + end + meta:set_int("page", page) + meta:set_string("formspec", get_chest_formspec(page)) + end + end, +}) + +minetest.register_on_mods_loaded(function() + local items = {} + for itemstring,_ in pairs(minetest.registered_items) do + if itemstring ~= "" and itemstring ~= "unknown" and itemstring ~= "ignore" then + table.insert(items, itemstring) + end + end + --[[ Sort items in this order: + * Chest of Everything + * Test tools + * Other tools + * Craftitems + * Other items + * Dummy items ]] + local function compare(item1, item2) + local def1 = minetest.registered_items[item1] + local def2 = minetest.registered_items[item2] + local tool1 = def1.type == "tool" + local tool2 = def2.type == "tool" + local testtool1 = minetest.get_item_group(item1, "testtool") == 1 + local testtool2 = minetest.get_item_group(item2, "testtool") == 1 + local dummy1 = minetest.get_item_group(item1, "dummy") == 1 + local dummy2 = minetest.get_item_group(item2, "dummy") == 1 + local craftitem1 = def1.type == "craft" + local craftitem2 = def2.type == "craft" + if item1 == "chest_of_everything:chest" then + return true + elseif item2 == "chest_of_everything:chest" then + return false + elseif dummy1 and not dummy2 then + return false + elseif not dummy1 and dummy2 then + return true + elseif testtool1 and not testtool2 then + return true + elseif not testtool1 and testtool2 then + return false + elseif tool1 and not tool2 then + return true + elseif not tool1 and tool2 then + return false + elseif craftitem1 and not craftitem2 then + return true + elseif not craftitem1 and craftitem2 then + return false + else + return item1 < item2 + end + end + table.sort(items, compare) + inv_everything:set_size("main", #items) + max_page = math.ceil(#items / 32) + for i=1, #items do + inv_everything:add_item("main", items[i]) + end +end) diff --git a/games/devtest/mods/chest_of_everything/mod.conf b/games/devtest/mods/chest_of_everything/mod.conf new file mode 100644 index 000000000..4a4425e05 --- /dev/null +++ b/games/devtest/mods/chest_of_everything/mod.conf @@ -0,0 +1,2 @@ +name = chest_of_everything +description = Adds the chest of everything from which you can take all items diff --git a/games/devtest/mods/chest_of_everything/textures/chest_of_everything_chest.png b/games/devtest/mods/chest_of_everything/textures/chest_of_everything_chest.png new file mode 100644 index 000000000..6b2fd58d5 Binary files /dev/null and b/games/devtest/mods/chest_of_everything/textures/chest_of_everything_chest.png differ diff --git a/games/devtest/mods/dignodes/init.lua b/games/devtest/mods/dignodes/init.lua new file mode 100644 index 000000000..833150873 --- /dev/null +++ b/games/devtest/mods/dignodes/init.lua @@ -0,0 +1,37 @@ +local groups = { + "cracky", "dig_immediate" +} + +-- Register dig nodes with 1 digging group, a rating between 1-3 and a level between 0-2 +for g=1, #groups do + local gr = groups[g] + for r=1, 3 do + for l=0, 2 do + if not (gr=="dig_immediate" and (l>0 or r==1)) then + local d + if l > 0 then + d = string.format("Dig Test Node: %s=%d, level=%d", gr, r, l) + else + d = string.format("Dig Test Node: %s=%d", gr, r) + end + local tile = "dignodes_"..gr..".png^dignodes_rating"..r..".png" + if l==1 then + tile = tile .. "^[colorize:#FFFF00:127" + elseif l==2 then + tile = tile .. "^[colorize:#FF0000:127" + end + minetest.register_node("dignodes:"..gr.."_"..r.."_"..l, { + description = d, + tiles = { tile }, + groups = { [gr] = r, level = l }, + }) + end + end + end +end + +-- Node without any digging groups +minetest.register_node("dignodes:none", { + description = "Dig Test Node: groupless", + tiles = {"dignodes_none.png"}, +}) diff --git a/games/devtest/mods/dignodes/mod.conf b/games/devtest/mods/dignodes/mod.conf new file mode 100644 index 000000000..52a80d66e --- /dev/null +++ b/games/devtest/mods/dignodes/mod.conf @@ -0,0 +1,2 @@ +name = dignodes +description = Nodes with different digging groups diff --git a/games/devtest/mods/dignodes/textures/dignodes_choppy.png b/games/devtest/mods/dignodes/textures/dignodes_choppy.png new file mode 100644 index 000000000..a73fc2424 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_choppy.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_cracky.png b/games/devtest/mods/dignodes/textures/dignodes_cracky.png new file mode 100644 index 000000000..eb84e3079 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_cracky.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_crumbly.png b/games/devtest/mods/dignodes/textures/dignodes_crumbly.png new file mode 100644 index 000000000..23f2f7c71 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_crumbly.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_dig_immediate.png b/games/devtest/mods/dignodes/textures/dignodes_dig_immediate.png new file mode 100644 index 000000000..a532ad90b Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_dig_immediate.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_none.png b/games/devtest/mods/dignodes/textures/dignodes_none.png new file mode 100644 index 000000000..60f13650b Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_none.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_rating1.png b/games/devtest/mods/dignodes/textures/dignodes_rating1.png new file mode 100644 index 000000000..d2fee3a23 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_rating1.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_rating2.png b/games/devtest/mods/dignodes/textures/dignodes_rating2.png new file mode 100644 index 000000000..15329b93f Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_rating2.png differ diff --git a/games/devtest/mods/dignodes/textures/dignodes_rating3.png b/games/devtest/mods/dignodes/textures/dignodes_rating3.png new file mode 100644 index 000000000..37216bfd1 Binary files /dev/null and b/games/devtest/mods/dignodes/textures/dignodes_rating3.png differ diff --git a/games/devtest/mods/experimental/commands.lua b/games/devtest/mods/experimental/commands.lua new file mode 100644 index 000000000..96f8cbe39 --- /dev/null +++ b/games/devtest/mods/experimental/commands.lua @@ -0,0 +1,215 @@ +minetest.register_chatcommand("test_inv", { + params = "", + description = "Test: Modify player's inventory formspec", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + player:set_inventory_formspec( + "size[13,7.5]".. + "image[6,0.6;1,2;player.png]".. + "list[current_player;main;5,3.5;8,4;]".. + "list[current_player;craft;8,0;3,3;]".. + "list[current_player;craftpreview;12,1;1,1;]".. + "list[detached:test_inventory;main;0,0;4,6;0]".. + "button[0.5,7;2,1;button1;Button 1]".. + "button_exit[2.5,7;2,1;button2;Exit Button]") + return true, "Done." + end, +}) + +minetest.register_chatcommand("test_bulk_set_node", { + params = "", + description = "Test: Bulk-set 9×9×9 stone nodes", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local pos_list = {} + local ppos = player:get_pos() + local i = 1 + for x=2,10 do + for y=2,10 do + for z=2,10 do + pos_list[i] = {x=ppos.x + x,y = ppos.y + y,z = ppos.z + z} + i = i + 1 + end + end + end + minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) + return true, "Done." + end, +}) + +minetest.register_chatcommand("bench_bulk_set_node", { + params = "", + description = "Benchmark: Bulk-set 99×99×99 stone nodes", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local pos_list = {} + local ppos = player:get_pos() + local i = 1 + for x=2,100 do + for y=2,100 do + for z=2,100 do + pos_list[i] = {x=ppos.x + x,y = ppos.y + y,z = ppos.z + z} + i = i + 1 + end + end + end + + minetest.chat_send_player(name, "Benchmarking minetest.bulk_set_node. Warming up ..."); + + -- warm up with stone to prevent having different callbacks + -- due to different node topology + minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) + + minetest.chat_send_player(name, "Warming up finished, now benchmarking ..."); + + local start_time = minetest.get_us_time() + for i=1,#pos_list do + minetest.set_node(pos_list[i], {name = "mapgen_stone"}) + end + local middle_time = minetest.get_us_time() + minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) + local end_time = minetest.get_us_time() + local msg = string.format("Benchmark results: minetest.set_node loop: %.2f ms; minetest.bulk_set_node: %.2f ms", + ((middle_time - start_time)) / 1000, + ((end_time - middle_time)) / 1000 + ) + return true, msg + end, +}) + +local function advance_pos(pos, start_pos, advance_z) + if advance_z then + pos.z = pos.z + 2 + pos.x = start_pos.x + else + pos.x = pos.x + 2 + end + if pos.x > 30900 or pos.x - start_pos.x > 46 then + pos.x = start_pos.x + pos.z = pos.z + 2 + end + if pos.z > 30900 then + -- We ran out of space! Aborting + aborted = true + return false + end + return pos +end + +local function place_nodes(param) + local nodes = param.nodes + local name = param.name + local pos = param.pos + local start_pos = param.start_pos + table.sort(nodes) + minetest.chat_send_player(name, "Placing nodes …") + local nodes_placed = 0 + for n=1, #nodes do + local itemstring = nodes[n] + local def = minetest.registered_nodes[itemstring] + local p2_max = 0 + if param.param ~= "no_param2" then + -- Also test the param2 values of the nodes + -- ... but we only use permissible param2 values + if def.paramtype2 == "wallmounted" then + p2_max = 5 + elseif def.paramtype2 == "facedir" then + p2_max = 23 + elseif def.paramtype2 == "glasslikeliquidlevel" then + p2_max = 63 + elseif def.paramtype2 == "meshoptions" and def.drawtype == "plantlike" then + p2_max = 63 + elseif def.paramtype2 == "leveled" then + p2_max = 127 + elseif def.paramtype2 == "degrotate" and def.drawtype == "plantlike" then + p2_max = 179 + elseif def.paramtype2 == "colorfacedir" or + def.paramtype2 == "colorwallmounted" or + def.paramtype2 == "color" then + p2_max = 255 + end + end + for p2 = 0, p2_max do + -- Skip undefined param2 values + if not ((def.paramtype2 == "meshoptions" and p2 % 8 > 4) or + (def.paramtype2 == "colorwallmounted" and p2 % 8 > 5) or + (def.paramtype2 == "colorfacedir" and p2 % 32 > 23)) then + + minetest.set_node(pos, { name = itemstring, param2 = p2 }) + nodes_placed = nodes_placed + 1 + pos = advance_pos(pos, start_pos) + if not pos then + aborted = true + break + end + end + end + if aborted then + break + end + end + if aborted then + minetest.chat_send_player(name, "Not all nodes could be placed, please move further away from the world boundary. Nodes placed: "..nodes_placed) + end + minetest.chat_send_player(name, "Nodes placed: "..nodes_placed..".") +end + +local function after_emerge(blockpos, action, calls_remaining, param) + if calls_remaining == 0 then + place_nodes(param) + end +end + +minetest.register_chatcommand("test_place_nodes", { + params = "[ no_param2 ]", + description = "Test: Place all non-experimental nodes and optionally their permissible param2 variants", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local pos = vector.floor(player:get_pos()) + pos.x = math.ceil(pos.x + 3) + pos.z = math.ceil(pos.z + 3) + pos.y = math.ceil(pos.y + 1) + local start_pos = table.copy(pos) + if pos.x > 30800 then + return false, "Too close to world boundary (+X). Please move to X < 30800." + end + if pos.z > 30800 then + return false, "Too close to world boundary (+Z). Please move to Z < 30800." + end + + local aborted = false + local nodes = {} + local emerge_estimate = 0 + for itemstring, def in pairs(minetest.registered_nodes) do + if itemstring ~= "ignore" and string.sub(itemstring, 1, 13) ~= "experimental:" then + table.insert(nodes, itemstring) + if def.paramtype2 == 0 then + emerge_estimate = emerge_estimate + 1 + else + emerge_estimate = emerge_estimate + 255 + end + end + end + -- Emerge area to make sure that all nodes are being placed. + -- Note we will emerge much more than we need to (overestimation), + -- the estimation code could be improved performance-wise … + local length = 16 + math.ceil(emerge_estimate / 24) * 2 + minetest.emerge_area(start_pos, + { x = start_pos.x + 46, y = start_pos.y, z = start_pos.z + length }, + after_emerge, { nodes = nodes, name = name, pos = pos, start_pos = start_pos, param = param }) + return true, "Emerging area …" + end, +}) + diff --git a/games/devtest/mods/experimental/detached.lua b/games/devtest/mods/experimental/detached.lua new file mode 100644 index 000000000..673adfdd4 --- /dev/null +++ b/games/devtest/mods/experimental/detached.lua @@ -0,0 +1,29 @@ +-- Create a detached inventory +local inv = minetest.create_detached_inventory("test_inventory", { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + experimental.print_to_everything("allow move asked") + return count -- Allow all + end, + allow_put = function(inv, listname, index, stack, player) + experimental.print_to_everything("allow put asked") + return 1 -- Allow only 1 + end, + allow_take = function(inv, listname, index, stack, player) + experimental.print_to_everything("allow take asked") + return 4 -- Allow 4 at max + end, + on_move = function(inv, from_list, from_index, to_list, to_index, count, player) + experimental.print_to_everything(player:get_player_name().." moved items") + end, + on_put = function(inv, listname, index, stack, player) + experimental.print_to_everything(player:get_player_name().." put items") + end, + on_take = function(inv, listname, index, stack, player) + experimental.print_to_everything(player:get_player_name().." took items") + end, +}) +inv:set_size("main", 4*6) +inv:add_item("main", "experimental:callback_node") +inv:add_item("main", "experimental:particle_spawner") + + diff --git a/games/devtest/mods/experimental/init.lua b/games/devtest/mods/experimental/init.lua new file mode 100644 index 000000000..b292f792e --- /dev/null +++ b/games/devtest/mods/experimental/init.lua @@ -0,0 +1,23 @@ +-- +-- Experimental things +-- + +experimental = {} + +dofile(minetest.get_modpath("experimental").."/detached.lua") +dofile(minetest.get_modpath("experimental").."/items.lua") +dofile(minetest.get_modpath("experimental").."/commands.lua") + +function experimental.print_to_everything(msg) + minetest.log("action", msg) + minetest.chat_send_all(msg) +end + +minetest.log("info", "[experimental] modname="..dump(minetest.get_current_modname())) +minetest.log("info", "[experimental] modpath="..dump(minetest.get_modpath("experimental"))) +minetest.log("info", "[experimental] worldpath="..dump(minetest.get_worldpath())) + + +minetest.register_on_mods_loaded(function() + minetest.log("action", "[experimental] on_mods_loaded()") +end) diff --git a/games/devtest/mods/experimental/items.lua b/games/devtest/mods/experimental/items.lua new file mode 100644 index 000000000..51b063ba2 --- /dev/null +++ b/games/devtest/mods/experimental/items.lua @@ -0,0 +1,103 @@ +minetest.register_node("experimental:callback_node", { + description = "Callback Test Node (construct/destruct/timer)", + tiles = {"experimental_callback_node.png"}, + groups = {dig_immediate=3}, + -- This was known to cause a bug in minetest.item_place_node() when used + -- via minetest.place_node(), causing a placer with no position + paramtype2 = "facedir", + drop = "", + + on_construct = function(pos) + experimental.print_to_everything("experimental:callback_node:on_construct("..minetest.pos_to_string(pos)..")") + local meta = minetest.get_meta(pos) + meta:set_string("mine", "test") + local timer = minetest.get_node_timer(pos) + timer:start(4, 3) + end, + + after_place_node = function(pos, placer) + experimental.print_to_everything("experimental:callback_node:after_place_node("..minetest.pos_to_string(pos)..")") + local meta = minetest.get_meta(pos) + if meta:get_string("mine") == "test" then + experimental.print_to_everything("correct metadata found") + else + experimental.print_to_everything("incorrect metadata found") + end + end, + + on_destruct = function(pos) + experimental.print_to_everything("experimental:callback_node:on_destruct("..minetest.pos_to_string(pos)..")") + end, + + after_destruct = function(pos) + experimental.print_to_everything("experimental:callback_node:after_destruct("..minetest.pos_to_string(pos)..")") + end, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + experimental.print_to_everything("experimental:callback_node:after_dig_node("..minetest.pos_to_string(pos)..")") + end, + + on_timer = function(pos, elapsed) + experimental.print_to_everything("on_timer(): elapsed="..dump(elapsed)) + return true + end, +}) + +minetest.register_tool("experimental:privatizer", { + description = "Node Meta Privatizer", + inventory_image = "experimental_tester_tool_1.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type == "node" then + local node = minetest.get_node(pointed_thing.under) + if node.name == "chest:chest" then + local p = pointed_thing.under + minetest.log("action", "Privatizer used at "..minetest.pos_to_string(p)) + minetest.get_meta(p):mark_as_private({"infotext", "formspec"}) + if user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), "Chest metadata (infotext, formspec) set private!") + end + return + end + end + if user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), "Privatizer can only be used on chest!") + end + end, +}) + +minetest.register_tool("experimental:particle_spawner", { + description = "Particle Spawner", + inventory_image = "experimental_tester_tool_1.png^[invert:g", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing, true) + if pos == nil then + if user then + pos = user:get_pos() + end + end + pos = vector.add(pos, {x=0, y=0.5, z=0}) + local tex, anim + if math.random(0, 1) == 0 then + tex = "experimental_particle_sheet.png" + anim = {type="sheet_2d", frames_w=3, frames_h=2, frame_length=0.5} + else + tex = "experimental_particle_vertical.png" + anim = {type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3} + end + + minetest.add_particle({ + pos = pos, + velocity = {x=0, y=0, z=0}, + acceleration = {x=0, y=0.04, z=0}, + expirationtime = 6, + collisiondetection = true, + texture = tex, + animation = anim, + size = 4, + glow = math.random(0, 5), + }) + end, +}) + diff --git a/games/devtest/mods/experimental/mod.conf b/games/devtest/mods/experimental/mod.conf new file mode 100644 index 000000000..cf0f9cb42 --- /dev/null +++ b/games/devtest/mods/experimental/mod.conf @@ -0,0 +1,2 @@ +name = experimental +description = Chaotic mod containing unstructured tests for testing out engine features. The features in this mod should be moved to other mods. diff --git a/games/devtest/mods/experimental/textures/experimental_callback_node.png b/games/devtest/mods/experimental/textures/experimental_callback_node.png new file mode 100644 index 000000000..e9d87434c Binary files /dev/null and b/games/devtest/mods/experimental/textures/experimental_callback_node.png differ diff --git a/games/devtest/mods/experimental/textures/experimental_particle_sheet.png b/games/devtest/mods/experimental/textures/experimental_particle_sheet.png new file mode 100644 index 000000000..6d70394e4 Binary files /dev/null and b/games/devtest/mods/experimental/textures/experimental_particle_sheet.png differ diff --git a/games/devtest/mods/experimental/textures/experimental_particle_vertical.png b/games/devtest/mods/experimental/textures/experimental_particle_vertical.png new file mode 100644 index 000000000..0320b7545 Binary files /dev/null and b/games/devtest/mods/experimental/textures/experimental_particle_vertical.png differ diff --git a/games/devtest/mods/experimental/textures/experimental_tester_tool_1.png b/games/devtest/mods/experimental/textures/experimental_tester_tool_1.png new file mode 100644 index 000000000..5df416a58 Binary files /dev/null and b/games/devtest/mods/experimental/textures/experimental_tester_tool_1.png differ diff --git a/games/devtest/mods/give_initial_stuff/init.lua b/games/devtest/mods/give_initial_stuff/init.lua new file mode 100644 index 000000000..491a531e4 --- /dev/null +++ b/games/devtest/mods/give_initial_stuff/init.lua @@ -0,0 +1,37 @@ +local give_if_not_gotten_already = function(inv, list, item) + if not inv:contains_item(list, item) then + inv:add_item(list, item) + end +end + +local give_initial_stuff = function(player) + local inv = player:get_inventory() + give_if_not_gotten_already(inv, "main", "basetools:pick_mese") + give_if_not_gotten_already(inv, "main", "basetools:axe_steel") + give_if_not_gotten_already(inv, "main", "basetools:shovel_steel") + give_if_not_gotten_already(inv, "main", "bucket:bucket") + give_if_not_gotten_already(inv, "main", "testnodes:light14") + give_if_not_gotten_already(inv, "main", "chest_of_everything:chest") + minetest.log("action", "[give_initial_stuff] Giving initial stuff to "..player:get_player_name()) +end + +minetest.register_on_newplayer(function(player) + if minetest.settings:get_bool("give_initial_stuff", true) then + give_initial_stuff(player) + end +end) + +minetest.register_chatcommand("stuff", { + params = "", + privs = { give = true }, + description = "Give yourself initial items", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player or not player:is_player() then + return false, "No player." + end + give_initial_stuff(player) + return true + end, +}) + diff --git a/games/devtest/mods/give_initial_stuff/mod.conf b/games/devtest/mods/give_initial_stuff/mod.conf new file mode 100644 index 000000000..1ba49f52a --- /dev/null +++ b/games/devtest/mods/give_initial_stuff/mod.conf @@ -0,0 +1,3 @@ +name = give_initial_stuff +description = Gives items to players on join +depends = basetools, bucket, chest_of_everything, testnodes diff --git a/games/devtest/mods/initial_message/init.lua b/games/devtest/mods/initial_message/init.lua new file mode 100644 index 000000000..59e9f5f4b --- /dev/null +++ b/games/devtest/mods/initial_message/init.lua @@ -0,0 +1,9 @@ +minetest.register_on_joinplayer(function(player) + local cb = function(player) + if not player or not player:is_player() then + return + end + minetest.chat_send_player(player:get_player_name(), "This is the \"Development Test\" [devtest], meant only for testing and development. Use Minetest Game for the real thing.") + end + minetest.after(2.0, cb, player) +end) diff --git a/games/devtest/mods/initial_message/mod.conf b/games/devtest/mods/initial_message/mod.conf new file mode 100644 index 000000000..32aa2ac4e --- /dev/null +++ b/games/devtest/mods/initial_message/mod.conf @@ -0,0 +1,2 @@ +name = initial_message +description = Show message to joining players explaining what this testing game is about diff --git a/games/devtest/mods/mapgen/init.lua b/games/devtest/mods/mapgen/init.lua new file mode 100644 index 000000000..13a186a50 --- /dev/null +++ b/games/devtest/mods/mapgen/init.lua @@ -0,0 +1,81 @@ +-- +-- Aliases for map generator outputs +-- + +-- ESSENTIAL node aliases +-- Basic nodes +minetest.register_alias("mapgen_stone", "basenodes:stone") +minetest.register_alias("mapgen_water_source", "basenodes:water_source") +minetest.register_alias("mapgen_river_water_source", "basenodes:river_water_source") + +-- Additional essential aliases for v6 +minetest.register_alias("mapgen_lava_source", "basenodes:lava_source") +minetest.register_alias("mapgen_dirt", "basenodes:dirt") +minetest.register_alias("mapgen_dirt_with_grass", "basenodes:dirt_with_grass") +minetest.register_alias("mapgen_sand", "basenodes:sand") +minetest.register_alias("mapgen_tree", "basenodes:tree") +minetest.register_alias("mapgen_leaves", "basenodes:leaves") +minetest.register_alias("mapgen_apple", "basenodes:apple") + +-- Essential alias for dungeons +minetest.register_alias("mapgen_cobble", "basenodes:cobble") + +-- Optional aliases for v6 (they all have fallback values in the engine) +if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then + minetest.register_alias("mapgen_gravel", "basenodes:gravel") + minetest.register_alias("mapgen_desert_stone", "basenodes:desert_stone") + minetest.register_alias("mapgen_desert_sand", "basenodes:desert_sand") + minetest.register_alias("mapgen_dirt_with_snow", "basenodes:dirt_with_snow") + minetest.register_alias("mapgen_snowblock", "basenodes:snowblock") + minetest.register_alias("mapgen_snow", "basenodes:snow") + minetest.register_alias("mapgen_ice", "basenodes:ice") + minetest.register_alias("mapgen_junglegrass", "basenodes:junglegrass") + minetest.register_alias("mapgen_jungletree", "basenodes:jungletree") + minetest.register_alias("mapgen_jungleleaves", "basenodes:jungleleaves") + minetest.register_alias("mapgen_pine_tree", "basenodes:pine_tree") + minetest.register_alias("mapgen_pine_needles", "basenodes:pine_needles") +end +-- Optional alias for mossycobble (should fall back to cobble) +if minetest.settings:get_bool("devtest_dungeon_mossycobble", false) then + minetest.register_alias("mapgen_mossycobble", "basenodes:mossycobble") +end +-- Optional aliases for dungeon stairs (should fall back to full nodes) +if minetest.settings:get_bool("devtest_dungeon_stairs", false) then + minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") + if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then + minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone") + end +end + +-- +-- Register biomes for biome API +-- + +minetest.clear_registered_biomes() +minetest.clear_registered_decorations() + +if minetest.settings:get_bool("devtest_register_biomes", true) then + minetest.register_biome({ + name = "mapgen:grassland", + node_top = "basenodes:dirt_with_grass", + depth_top = 1, + node_filler = "basenodes:dirt", + depth_filler = 1, + y_min = 5, + y_max = 31000, + heat_point = 50, + humidity_point = 50, + }) + + minetest.register_biome({ + name = "mapgen:grassland_ocean", + node_top = "basenodes:sand", + depth_top = 1, + node_filler = "basenodes:sand", + depth_filler = 2, + y_min = -31000, + y_max = 4, + heat_point = 50, + humidity_point = 50, + }) +end diff --git a/games/devtest/mods/mapgen/mod.conf b/games/devtest/mods/mapgen/mod.conf new file mode 100644 index 000000000..15750ccbe --- /dev/null +++ b/games/devtest/mods/mapgen/mod.conf @@ -0,0 +1,3 @@ +name = mapgen +description = Minimal map generator +depends = basenodes diff --git a/games/devtest/mods/modchannels/init.lua b/games/devtest/mods/modchannels/init.lua new file mode 100644 index 000000000..ee925f09b --- /dev/null +++ b/games/devtest/mods/modchannels/init.lua @@ -0,0 +1,14 @@ +-- +-- Mod channels experimental handlers +-- +local mod_channel = minetest.mod_channel_join("experimental_preview") + +minetest.register_on_modchannel_message(function(channel, sender, message) + minetest.log("action", "[modchannels] Server received message `" .. message + .. "` on channel `" .. channel .. "` from sender `" .. sender .. "`") + + if mod_channel:is_writeable() then + mod_channel:send_all("experimental answers to preview") + mod_channel:leave() + end +end) diff --git a/games/devtest/mods/modchannels/mod.conf b/games/devtest/mods/modchannels/mod.conf new file mode 100644 index 000000000..7c13aadfb --- /dev/null +++ b/games/devtest/mods/modchannels/mod.conf @@ -0,0 +1,2 @@ +name = modchannels +description = Add experimental mod channel handlers diff --git a/games/devtest/mods/soundstuff/init.lua b/games/devtest/mods/soundstuff/init.lua new file mode 100644 index 000000000..22012ba14 --- /dev/null +++ b/games/devtest/mods/soundstuff/init.lua @@ -0,0 +1,170 @@ +local simple_nodes = { + footstep = { "Footstep Sound Node", "soundstuff_node_footstep.png" }, + dig = { "Dig Sound Node", "soundstuff_node_dig.png" }, + dug = { "Dug Sound Node", "soundstuff_node_dug.png" }, + place = { "Place Sound Node", "soundstuff_node_place.png" }, + place_failed = { "Place Failed Sound Node", "soundstuff_node_place_failed.png" }, +} + +for k,v in pairs(simple_nodes) do + minetest.register_node("soundstuff:"..k, { + description = v[1], + tiles = {"soundstuff_node_sound.png","soundstuff_node_sound.png",v[2]}, + groups = {dig_immediate=2}, + sounds = { + [k] = { name = "soundstuff_mono", gain = 1.0 }, + } + }) +end + +minetest.register_node("soundstuff:place_failed_attached", { + description = "Attached Place Failed Sound Node", + tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_place_failed.png"}, + groups = {dig_immediate=2, attached_node=1}, + drawtype = "nodebox", + paramtype = "light", + node_box = { type = "fixed", fixed = { + { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 }, + { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 }, + }}, + sounds = { + place_failed = { name = "soundstuff_mono", gain = 1.0 }, + }, +}) + +minetest.register_node("soundstuff:fall", { + description = "Fall Sound Node", + tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"}, + groups = {dig_immediate=2, falling_node=1}, + sounds = { + fall = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + +minetest.register_node("soundstuff:fall_attached", { + description = "Attached Fall Sound Node", + tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"}, + groups = {dig_immediate=2, attached_node=1}, + drawtype = "nodebox", + paramtype = "light", + node_box = { type = "fixed", fixed = { + { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 }, + { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 }, + }}, + sounds = { + fall = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + +minetest.register_node("soundstuff:footstep_liquid", { + description = "Liquid Footstep Sound Node", + drawtype = "liquid", + tiles = { + "soundstuff_node_sound.png^[colorize:#0000FF:127", + }, + special_tiles = { + {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = false}, + {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = true}, + }, + liquids_pointable = true, + liquidtype = "source", + liquid_alternative_flowing = "soundstuff:footstep_liquid", + liquid_alternative_source = "soundstuff:footstep_liquid", + liquid_renewable = false, + liquid_range = 0, + liquid_viscosity = 0, + alpha = 190, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + post_effect_color = {a = 64, r = 0, g = 0, b = 200}, + sounds = { + footstep = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + +minetest.register_node("soundstuff:footstep_climbable", { + description = "Climbable Footstep Sound Node", + drawtype = "allfaces", + tiles = { + "soundstuff_node_climbable.png", + }, + alpha = 120, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + groups = { dig_immediate = 2 }, + sounds = { + footstep = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + + + +minetest.register_craftitem("soundstuff:eat", { + description = "Eat Sound Item", + inventory_image = "soundstuff_eat.png", + on_use = minetest.item_eat(0), + sound = { + eat = { name = "soundstuff_mono", gain = 1.0 }, + } +}) + +minetest.register_tool("soundstuff:breaks", { + description = "Break Sound Tool", + inventory_image = "soundstuff_node_dug.png", + sound = { + breaks = { name = "soundstuff_mono", gain = 1.0 }, + }, + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, + choppy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, + snappy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, + crumbly={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, + }, + }, +}) + +-- Plays sound repeatedly +minetest.register_node("soundstuff:positional", { + description = "Positional Sound Node", + on_construct = function(pos) + local timer = minetest.get_node_timer(pos) + timer:start(0) + end, + on_timer = function(pos, elapsed) + local node = minetest.get_node(pos) + local dist = node.param2 + if dist == 0 then + dist = nil + end + minetest.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist }) + local timer = minetest.get_node_timer(pos) + timer:start(0.7) + end, + on_rightclick = function(pos, node, clicker) + node.param2 = (node.param2 + 1) % 64 + minetest.set_node(pos, node) + if clicker and clicker:is_player() then + local dist = node.param2 + local diststr + if dist == 0 then + diststr = "" + else + diststr = tostring(dist) + end + minetest.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr) + end + end, + + groups = { dig_immediate = 2 }, + tiles = { "soundstuff_node_sound.png" }, +}) + diff --git a/games/devtest/mods/soundstuff/mod.conf b/games/devtest/mods/soundstuff/mod.conf new file mode 100644 index 000000000..2c631e2da --- /dev/null +++ b/games/devtest/mods/soundstuff/mod.conf @@ -0,0 +1,2 @@ +name = soundstuff +description = Example items and nodes for testing sound effects diff --git a/games/devtest/mods/soundstuff/sounds/soundstuff_mono.ogg b/games/devtest/mods/soundstuff/sounds/soundstuff_mono.ogg new file mode 100644 index 000000000..43428d566 Binary files /dev/null and b/games/devtest/mods/soundstuff/sounds/soundstuff_mono.ogg differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_eat.png b/games/devtest/mods/soundstuff/textures/soundstuff_eat.png new file mode 100644 index 000000000..aed205422 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_eat.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_blank.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_blank.png new file mode 100644 index 000000000..4dffacc4c Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_blank.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_climbable.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_climbable.png new file mode 100644 index 000000000..3888f793c Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_climbable.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_dig.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_dig.png new file mode 100644 index 000000000..67ba111d8 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_dig.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_dug.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_dug.png new file mode 100644 index 000000000..bab5fbe51 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_dug.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_fall.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_fall.png new file mode 100644 index 000000000..17b14f1e4 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_fall.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_footstep.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_footstep.png new file mode 100644 index 000000000..6367ae909 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_footstep.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_place.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_place.png new file mode 100644 index 000000000..d159ad533 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_place.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_place_failed.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_place_failed.png new file mode 100644 index 000000000..780ba946d Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_place_failed.png differ diff --git a/games/devtest/mods/soundstuff/textures/soundstuff_node_sound.png b/games/devtest/mods/soundstuff/textures/soundstuff_node_sound.png new file mode 100644 index 000000000..0592a0299 Binary files /dev/null and b/games/devtest/mods/soundstuff/textures/soundstuff_node_sound.png differ diff --git a/games/devtest/mods/stairs/init.lua b/games/devtest/mods/stairs/init.lua new file mode 100644 index 000000000..2701cabab --- /dev/null +++ b/games/devtest/mods/stairs/init.lua @@ -0,0 +1,65 @@ +stairs = {} + +-- Node will be called stairs:stair_ +function stairs.register_stair(subname, recipeitem, groups, images, description) + minetest.register_node(":stairs:stair_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + }) +end + +-- Node will be called stairs:slab_ +function stairs.register_slab(subname, recipeitem, groups, images, description) + minetest.register_node(":stairs:slab_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + is_ground_content = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + }) +end + +-- Nodes will be called stairs:{stair,slab}_ +function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab) + stairs.register_stair(subname, recipeitem, groups, images, desc_stair) + stairs.register_slab(subname, recipeitem, groups, images, desc_slab) +end + +stairs.register_stair_and_slab("stone", "basenodes:stone", + {cracky=3}, + {"default_stone.png"}, + "Stone Stair", + "Stone Slab") + +stairs.register_stair_and_slab("desert_stone", "basenodes:desert_stone", + {cracky=3}, + {"default_desert_stone.png"}, + "Desert Stone Stair", + "Desert Stone Slab") + +stairs.register_stair_and_slab("cobble", "basenodes:cobble", + {cracky=3}, + {"default_cobble.png"}, + "Cobblestone Stair", + "Cobblestone Slab") diff --git a/games/devtest/mods/stairs/mod.conf b/games/devtest/mods/stairs/mod.conf new file mode 100644 index 000000000..724bff881 --- /dev/null +++ b/games/devtest/mods/stairs/mod.conf @@ -0,0 +1,3 @@ +name = stairs +description = Adds stairs and slabs +depends = basenodes diff --git a/games/devtest/mods/testentities/armor.lua b/games/devtest/mods/testentities/armor.lua new file mode 100644 index 000000000..4c30cec8d --- /dev/null +++ b/games/devtest/mods/testentities/armor.lua @@ -0,0 +1,41 @@ +-- Armorball: Test entity for testing armor groups +-- Rightclick to change armor group + +local phasearmor = { + [0]={icy=100}, + [1]={firy=100}, + [2]={fleshy=100}, + [3]={immortal=1}, + [4]={punch_operable=1}, +} + +minetest.register_entity("testentities:armorball", { + initial_properties = { + hp_max = 20, + physical = false, + collisionbox = {-0.4,-0.4,-0.4, 0.4,0.4,0.4}, + visual = "sprite", + visual_size = {x=1, y=1}, + textures = {"testentities_armorball.png"}, + spritediv = {x=1, y=5}, + initial_sprite_basepos = {x=0, y=0}, + }, + + _phase = 2, + + on_activate = function(self, staticdata) + minetest.log("action", "[testentities] armorball.on_activate") + self.object:set_armor_groups(phasearmor[self._phase]) + self.object:set_sprite({x=0, y=self._phase}) + end, + + on_rightclick = function(self, clicker) + -- Change armor group and sprite + self._phase = self._phase + 1 + if self._phase >= 5 then + self._phase = 0 + end + self.object:set_sprite({x=0, y=self._phase}) + self.object:set_armor_groups(phasearmor[self._phase]) + end, +}) diff --git a/games/devtest/mods/testentities/callbacks.lua b/games/devtest/mods/testentities/callbacks.lua new file mode 100644 index 000000000..711079f87 --- /dev/null +++ b/games/devtest/mods/testentities/callbacks.lua @@ -0,0 +1,75 @@ +-- Entities that test their callbacks + +local message = function(msg) + minetest.log("action", msg) + minetest.chat_send_all(msg) +end + +local get_object_name = function(obj) + local name = "" + if obj then + if obj:is_player() then + name = obj:get_player_name() + else + name = "" + end + end + return name +end + +local spos = function(self) + return minetest.pos_to_string(vector.round(self.object:get_pos())) +end + +-- Callback test entity (all callbacks except on_step) +minetest.register_entity("testentities:callback", { + initial_properties = { + visual = "upright_sprite", + textures = { "testentities_callback.png" }, + }, + + on_activate = function(self, staticdata, dtime_s) + message("Callback entity: on_activate! pos="..spos(self).."; dtime_s="..dtime_s) + end, + on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) + local name = get_object_name(puncher) + message( + "Callback entity: on_punch! ".. + "pos="..spos(self).."; puncher="..name.."; ".. + "time_from_last_punch="..time_from_last_punch.."; ".. + "tool_capabilities="..tostring(dump(tool_capabilities)).."; ".. + "dir="..tostring(dump(dir)).."; damage="..damage) + end, + on_rightclick = function(self, clicker) + local name = get_object_name(clicker) + message("Callback entity: on_rightclick! pos="..spos(self).."; clicker="..name) + end, + on_death = function(self, killer) + local name = get_object_name(killer) + message("Callback entity: on_death! pos="..spos(self).."; killer="..name) + end, + on_attach_child = function(self, child) + local name = get_object_name(child) + message("Callback entity: on_attach_child! pos="..spos(self).."; child="..name) + end, + on_detach_child = function(self, child) + local name = get_object_name(child) + message("Callback entity: on_detach_child! pos="..spos(self).."; child="..name) + end, + on_detach = function(self, parent) + local name = get_object_name(parent) + message("Callback entity: on_detach! pos="..spos(self).."; parent="..name) + end, + get_staticdata = function(self) + message("Callback entity: get_staticdata! pos="..spos(self)) + end, +}) + +-- Only test on_step callback +minetest.register_entity("testentities:callback_step", { + visual = "upright_sprite", + textures = { "testentities_callback_step.png" }, + on_step = function(self, dtime) + message("on_step callback entity: on_step! pos="..spos(self).."; dtime="..dtime) + end, +}) diff --git a/games/devtest/mods/testentities/init.lua b/games/devtest/mods/testentities/init.lua new file mode 100644 index 000000000..df8c72ea7 --- /dev/null +++ b/games/devtest/mods/testentities/init.lua @@ -0,0 +1,3 @@ +dofile(minetest.get_modpath("testentities").."/visuals.lua") +dofile(minetest.get_modpath("testentities").."/armor.lua") +dofile(minetest.get_modpath("testentities").."/callbacks.lua") diff --git a/games/devtest/mods/testentities/mod.conf b/games/devtest/mods/testentities/mod.conf new file mode 100644 index 000000000..7a8cb5a3e --- /dev/null +++ b/games/devtest/mods/testentities/mod.conf @@ -0,0 +1,2 @@ +name = testentities +description = Example entities for testing diff --git a/games/devtest/mods/testentities/textures/testentities_armorball.png b/games/devtest/mods/testentities/textures/testentities_armorball.png new file mode 100644 index 000000000..88147bd1f Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_armorball.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_callback.png b/games/devtest/mods/testentities/textures/testentities_callback.png new file mode 100644 index 000000000..c4c9066d1 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_callback.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_callback_step.png b/games/devtest/mods/testentities/textures/testentities_callback_step.png new file mode 100644 index 000000000..b67506a97 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_callback_step.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube1.png b/games/devtest/mods/testentities/textures/testentities_cube1.png new file mode 100644 index 000000000..c667e425f Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube1.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube2.png b/games/devtest/mods/testentities/textures/testentities_cube2.png new file mode 100644 index 000000000..481823420 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube2.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube3.png b/games/devtest/mods/testentities/textures/testentities_cube3.png new file mode 100644 index 000000000..03b5daa15 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube3.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube4.png b/games/devtest/mods/testentities/textures/testentities_cube4.png new file mode 100644 index 000000000..639204896 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube4.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube5.png b/games/devtest/mods/testentities/textures/testentities_cube5.png new file mode 100644 index 000000000..d8acdf0b6 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube5.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_cube6.png b/games/devtest/mods/testentities/textures/testentities_cube6.png new file mode 100644 index 000000000..5f81a64d9 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_cube6.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_dungeon_master.png b/games/devtest/mods/testentities/textures/testentities_dungeon_master.png new file mode 100644 index 000000000..1e3107746 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_dungeon_master.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_sprite.png b/games/devtest/mods/testentities/textures/testentities_sprite.png new file mode 100644 index 000000000..a4b019699 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_sprite.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_upright_sprite1.png b/games/devtest/mods/testentities/textures/testentities_upright_sprite1.png new file mode 100644 index 000000000..6242511df Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_upright_sprite1.png differ diff --git a/games/devtest/mods/testentities/textures/testentities_upright_sprite2.png b/games/devtest/mods/testentities/textures/testentities_upright_sprite2.png new file mode 100644 index 000000000..a79a760e3 Binary files /dev/null and b/games/devtest/mods/testentities/textures/testentities_upright_sprite2.png differ diff --git a/games/devtest/mods/testentities/visuals.lua b/games/devtest/mods/testentities/visuals.lua new file mode 100644 index 000000000..de346fd68 --- /dev/null +++ b/games/devtest/mods/testentities/visuals.lua @@ -0,0 +1,74 @@ +-- Minimal test entities to test visuals + +minetest.register_entity("testentities:sprite", { + initial_properties = { + visual = "sprite", + textures = { "testentities_sprite.png" }, + }, +}) + +minetest.register_entity("testentities:upright_sprite", { + initial_properties = { + visual = "upright_sprite", + textures = { + "testentities_upright_sprite1.png", + "testentities_upright_sprite2.png", + }, + }, +}) + +minetest.register_entity("testentities:cube", { + initial_properties = { + visual = "cube", + textures = { + "testentities_cube1.png", + "testentities_cube2.png", + "testentities_cube3.png", + "testentities_cube4.png", + "testentities_cube5.png", + "testentities_cube6.png", + }, + }, +}) + +minetest.register_entity("testentities:item", { + initial_properties = { + visual = "item", + wield_item = "testnodes:normal", + }, +}) + +minetest.register_entity("testentities:wielditem", { + initial_properties = { + visual = "wielditem", + wield_item = "testnodes:normal", + }, +}) + +minetest.register_entity("testentities:mesh", { + initial_properties = { + visual = "mesh", + mesh = "testnodes_pyramid.obj", + textures = { + "testnodes_mesh_stripes2.png" + }, + }, +}) + +-- Advanced visual tests + +-- A test entity for testing animated and yaw-modulated sprites +minetest.register_entity("testentities:yawsprite", { + initial_properties = { + selectionbox = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}, + visual = "sprite", + visual_size = {x=0.6666, y=1}, + textures = {"testentities_dungeon_master.png^[makealpha:128,0,0^[makealpha:128,128,0"}, + spritediv = {x=6, y=5}, + initial_sprite_basepos = {x=0, y=0}, + on_activate = function(self, staticdata) + self.object:set_sprite({x=0, y=0}, 1, 0, true) + end, + }, +}) + diff --git a/games/devtest/mods/testfood/init.lua b/games/devtest/mods/testfood/init.lua new file mode 100644 index 000000000..a6236ff68 --- /dev/null +++ b/games/devtest/mods/testfood/init.lua @@ -0,0 +1,24 @@ +local S = minetest.get_translator("testfood") + +minetest.register_craftitem("testfood:good1", { + description = S("Good Food (+1)"), + inventory_image = "testfood_good.png", + on_use = minetest.item_eat(1), +}) +minetest.register_craftitem("testfood:good5", { + description = S("Good Food (+5)"), + inventory_image = "testfood_good2.png", + on_use = minetest.item_eat(5), +}) + +minetest.register_craftitem("testfood:bad1", { + description = S("Bad Food (-1)"), + inventory_image = "testfood_bad.png", + on_use = minetest.item_eat(-1), +}) +minetest.register_craftitem("testfood:bad5", { + description = S("Bad Food (-5)"), + inventory_image = "testfood_bad2.png", + on_use = minetest.item_eat(-5), +}) + diff --git a/games/devtest/mods/testfood/mod.conf b/games/devtest/mods/testfood/mod.conf new file mode 100644 index 000000000..7bff21b6e --- /dev/null +++ b/games/devtest/mods/testfood/mod.conf @@ -0,0 +1,2 @@ +name = testfood +description = For testing food items diff --git a/games/devtest/mods/testfood/textures/testfood_bad.png b/games/devtest/mods/testfood/textures/testfood_bad.png new file mode 100644 index 000000000..6e9251440 Binary files /dev/null and b/games/devtest/mods/testfood/textures/testfood_bad.png differ diff --git a/games/devtest/mods/testfood/textures/testfood_bad2.png b/games/devtest/mods/testfood/textures/testfood_bad2.png new file mode 100644 index 000000000..22b567890 Binary files /dev/null and b/games/devtest/mods/testfood/textures/testfood_bad2.png differ diff --git a/games/devtest/mods/testfood/textures/testfood_good.png b/games/devtest/mods/testfood/textures/testfood_good.png new file mode 100644 index 000000000..31df7f5dd Binary files /dev/null and b/games/devtest/mods/testfood/textures/testfood_good.png differ diff --git a/games/devtest/mods/testfood/textures/testfood_good2.png b/games/devtest/mods/testfood/textures/testfood_good2.png new file mode 100644 index 000000000..e43dda209 Binary files /dev/null and b/games/devtest/mods/testfood/textures/testfood_good2.png differ diff --git a/games/devtest/mods/testformspec/callbacks.lua b/games/devtest/mods/testformspec/callbacks.lua new file mode 100644 index 000000000..559380580 --- /dev/null +++ b/games/devtest/mods/testformspec/callbacks.lua @@ -0,0 +1,51 @@ +local callback_test = 0 + +local out = function(player, formname, fields, number) + local snum = "" + if number then + snum = " "..number + end + local msg = "Formspec callback"..snum..": player="..player:get_player_name()..", formname=\""..tostring(formname).."\", fields="..dump(fields) + minetest.chat_send_player(player:get_player_name(), msg) + minetest.log("action", msg) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if callback_test == 1 then + out(player, formname, fields) + elseif callback_test == 2 then + out(player, formname, fields, 1) + end +end) +minetest.register_on_player_receive_fields(function(player, formname, fields) + if callback_test == 2 then + out(player, formname, fields, 2) + return true -- Disable the first callback + end +end) +minetest.register_on_player_receive_fields(function(player, formname, fields) + if callback_test == 2 then + out(player, formname, fields, 3) + end +end) + +minetest.register_chatcommand("test_formspec_callbacks", { + params = "[ 0 | 1 | 2 ]", + description = "Test: Change formspec callbacks testing mode", + func = function(name, param) + local mode = tonumber(param) + if not mode then + callback_test = (callback_test + 1 % 3) + else + callback_test = mode + end + if callback_test == 1 then + minetest.chat_send_player(name, "Formspec callback test mode 1 enabled: Logging only") + elseif callback_test == 2 then + minetest.chat_send_player(name, "Formspec callback test mode 2 enabled: Three callbacks, disable pre-registered callbacks") + else + callback_test = 0 + minetest.chat_send_player(name, "Formspec callback test disabled!") + end + end +}) diff --git a/games/devtest/mods/testformspec/dummy_items.lua b/games/devtest/mods/testformspec/dummy_items.lua new file mode 100644 index 000000000..2037ae9cf --- /dev/null +++ b/games/devtest/mods/testformspec/dummy_items.lua @@ -0,0 +1,14 @@ +-- This code adds dummy items that are supposed to be used in formspecs +-- for testing item_image formspec elements. + +minetest.register_node("testformspec:node", { + description = "Formspec Test Node", + tiles = { "testformspec_node.png" }, + groups = { dig_immediate = 3, dummy = 1 }, +}) + +minetest.register_craftitem("testformspec:item", { + description = "Formspec Test Item", + inventory_image = "testformspec_item.png", + groups = { dummy = 1 }, +}) diff --git a/games/devtest/mods/testformspec/formspec.lua b/games/devtest/mods/testformspec/formspec.lua new file mode 100644 index 000000000..08c1b6dc0 --- /dev/null +++ b/games/devtest/mods/testformspec/formspec.lua @@ -0,0 +1,381 @@ +local color = minetest.colorize + +local clip_fs = [[ + style_type[label,button,image_button,item_image_button, + tabheader,scrollbar,table,animated_image + ,field,textarea,checkbox,dropdown;noclip=%c] + + label[0,0;A clipping test] + button[0,1;3,0.8;clip_button;A clipping test] + image_button[0,2;3,0.8;testformspec_button_image.png;clip_image_button;A clipping test] + item_image_button[0,3;3,0.8;testformspec:item;clip_item_image_button;A clipping test] + tabheader[0,4.7;3,0.63;clip_tabheader;Clip,Test,Text,Tabs;1;false;false] + field[0,5;3,0.8;clip_field;Title;] + textarea[0,6;3,1;clip_textarea;Title;] + checkbox[0,7.5;clip_checkbox;This is a test;true] + dropdown[0,8;3,0.8;clip_dropdown;Select An Item,One,Two,Three,Four,Five;1] + scrollbar[0,9;3,0.8;horizontal;clip_scrollbar;3] + tablecolumns[text;text] + table[0,10;3,1;clip_table;one,two,three,four;1] + animated_image[-0.5,11;4.5,1;clip_animated_image;testformspec_animation.png;4;100] +]] + +local tabheaders_fs = [[ + tabheader[0,0;10,0.63;tabs_opaque;Opaque,Without,Border;1;false;false] + tabheader[0,1;10,0.63;tabs_opaque_border;Opaque,With,Border;1;false;true] + tabheader[0,2;10,0.63;tabs_transparent;Transparent,Without,Border;1;true;false] + tabheader[0,3;10,0.63;tabs_transparent_border;Transparent,With,Border;1;true;true] + tabheader[0,4;tabs_default;Default,Tabs;1] + tabheader[0,6;10,0.5;tabs_size1;Height=0.5;1;false;false] + tabheader[2,6;10,0.75;tabs_size1;Height=0.75;1;false;false] + tabheader[4,6;10,1;tabs_size2;Height=1;1;false;false] + tabheader[6,6;10,1.25;tabs_size2;Height=1.25;1;false;false] + tabheader[8,6;10,1.5;tabs_size2;Height=1.5;1;false;false] +]] + +local hypertext_basic = [[ +Normal test +This is a normal text. + +style test + + . + + +Tag test +normal +mono +bold +italic +underlined +big +bigger +left +
center
+right +justify. Here comes a blind text: Lorem testum dolor sit amet consecutor celeron fiftifahivus e shadoninia e smalus jokus anrus relsocutoti rubenwardus. Erasputinus hara holisti dominus wusi. Grumarinsti erltusmuate ol fortitusti fla flo, blani burki e sfani fahif. Ultae ratii, e megus gigae don anonimus. Grinus dimondus krockus e nore. Endus finalus nowus comus endus o blindus tekstus. + +Custom tag test + + + + + +color=green +Action: color=green +Action: hovercolor=yellow +size=24 +font=mono +color=green font=mono size=24 + +action test +action + +img test +Normal: + +width=48 height=48: + +float=left: + +float=right: + + +item test +Normal: + +width=48 height=48 + +angle=30,0,0: + +angle=0,30,0: + +angle=0,0,30: + +rotate=yes: + +rotate=100,0,0: + +rotate=0,100,0: + +rotate=0,0,100: + +rotate=50,75,100: + +angle=-30,-45,90 rotate=100,150,-50: +]] + +local hypertext_global = [[ + +This is a test of the global tag. The parameters are: +background=gray margin=20 valign=bottom halign=right color=pink hovercolor=purple size=12 font=mono +action]] + +local hypertext_fs = "hypertext[0,0;11,9;hypertext;"..minetest.formspec_escape(hypertext_basic).."]".. + "hypertext[0,9.5;11,2.5;hypertext;"..minetest.formspec_escape(hypertext_global).."]" + +local style_fs = [[ + style[one_btn1;bgcolor=red;textcolor=yellow;bgcolor_hovered=orange; + bgcolor_pressed=purple] + button[0,0;2.5,0.8;one_btn1;Button] + + style[one_btn2;border=false;textcolor=cyan] ]].. + "button[0,1.05;2.5,0.8;one_btn2;Text " .. color("#FF0", "Yellow") .. [[] + + style[one_btn3;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; + bgimg_pressed=testformspec_pressed.png] + button[0,2.1;1,1;one_btn3;Border] + + style[one_btn4;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; + bgimg_pressed=testformspec_pressed.png;border=false] + button[1.25,2.1;1,1;one_btn4;NoBor] + + style[one_btn5;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; + bgimg_pressed=testformspec_pressed.png;border=false;alpha=false] + button[0,3.35;1,1;one_btn5;Alph] + + style[one_btn6;border=true] + image_button[0,4.6;1,1;testformspec_button_image.png;one_btn6;Border] + + style[one_btn7;border=false] + image_button[1.25,4.6;1,1;testformspec_button_image.png;one_btn7;NoBor] + + style[one_btn8;border=false] + image_button[0,5.85;1,1;testformspec_button_image.png;one_btn8;Border;false;true;testformspec_pressed.png] + + style[one_btn9;border=true] + image_button[1.25,5.85;1,1;testformspec_button_image.png;one_btn9;NoBor;false;false;testformspec_pressed.png] + + style[one_btn10;alpha=false] + image_button[0,7.1;1,1;testformspec_button_image.png;one_btn10;NoAlpha] + + style[one_btn11;alpha=true] + image_button[1.25,7.1;1,1;testformspec_button_image.png;one_btn11;Alpha] + + style[one_btn12;border=true] + item_image_button[0,8.35;1,1;testformspec:item;one_btn12;Border] + + style[one_btn13;border=false] + item_image_button[1.25,8.35;1,1;testformspec:item;one_btn13;NoBor] + + style[one_btn14;border=false;bgimg=testformspec_bg.png;fgimg=testformspec_button_image.png] + style[one_btn14:hovered;bgimg=testformspec_bg_hovered.png;fgimg=testformspec_hovered.png;textcolor=yellow] + style[one_btn14:pressed;bgimg=testformspec_bg_pressed.png;fgimg=testformspec_pressed.png;textcolor=blue] + style[one_btn14:hovered+pressed;textcolor=purple] + image_button[0,9.6;1,1;testformspec_button_image.png;one_btn14;Bg] + + style[one_btn15;border=false;bgimg=testformspec_bg.png;bgimg_hovered=testformspec_bg_hovered.png;bgimg_pressed=testformspec_bg_pressed.png] + item_image_button[1.25,9.6;1,1;testformspec:item;one_btn15;Bg] + + style[one_btn16;border=false;bgimg=testformspec_bg_9slice.png;bgimg_hovered=testformspec_bg_9slice_hovered.png;bgimg_pressed=testformspec_bg_9slice_pressed.png;bgimg_middle=4,6] + button[2.5,9.6;2,1;one_btn16;9-Slice Bg] + + + + container[2.75,0] + + style[one_tb1;textcolor=Yellow] + tabheader[0,3;2.5,0.63;one_tb1;Yellow,Text,Tabs;1;false;false] + + style[one_f1;textcolor=yellow] + field[0,4.25;2.5,0.8;one_f1;Field One;Yellow Text] + + style[one_f2;border=false;textcolor=cyan] + field[0,5.75;2.5,0.8;one_f2;Field Two;Borderless Cyan Text] + + style[one_f3;textcolor=yellow] + textarea[0,7.025;2.5,0.8;one_f3;Label;]] .. + minetest.formspec_escape("Yellow Text\nLine two") .. [[ ] + + style[one_f4;border=false;textcolor=cyan] + textarea[0,8.324999999999999;2.5,0.8;one_f4;Label;]] .. + minetest.formspec_escape("Borderless Cyan Text\nLine two") .. [[ ] + + container_end[] +]] + +local scroll_fs = + "button[8.5,1;4,1;outside;Outside of container]".. + "box[1,1;8,6;#00aa]".. + "scroll_container[1,1;8,6;scrbar;vertical]".. + "button[0,1;1,1;lorem;Lorem]".. + "button[0,10;1,1;ipsum;Ipsum]".. + "pwdfield[2,2;1,1;lorem2;Lorem]".. + "list[current_player;main;4,4;1,5;]".. + "box[2,5;3,2;#ffff00]".. + "image[1,10;3,2;testformspec_item.png]".. + "image[3,1;testformspec_item.png]".. + "item_image[2,6;3,2;testformspec:node]".. + "label[2,15;bla Bli\nfoo bar]".. + "item_image_button[2,3;1,1;testformspec:node;itemimagebutton;ItemImageButton]".. + "tooltip[0,11;3,2;Buz;#f00;#000]".. + "box[0,11;3,2;#00ff00]".. + "hypertext[3,13;3,3;;" .. hypertext_basic .. "]" .. + "container[0,18]".. + "box[1,2;3,2;#0a0a]".. + "scroll_container[1,2;3,2;scrbar2;horizontal;0.06]".. + "button[0,0;6,1;butnest;Nest]".. + "label[10,0.5;nest]".. + "scroll_container_end[]".. + "scrollbar[1,0;3.5,0.3;horizontal;scrbar2;0]".. + "container_end[]".. + "dropdown[0,6;2;hmdrpdwn;apple,bulb;1]".. + "image_button[0,4;2,2;testformspec_button_image.png;imagebutton;bbbbtt;false;true;testformspec_pressed.png]".. + "box[1,22.5;4,1;#a00a]".. + "scroll_container_end[]".. + "scrollbaroptions[max=170]".. -- lowest seen pos is: 0.1*170+6=23 (factor*max+height) + "scrollbar[7.5,0;0.3,4;vertical;scrbar;0]".. + "scrollbar[8,0;0.3,4;vertical;scrbarhmmm;0]".. + "dropdown[0,6;2;hmdrpdwnnn;Outside,of,container;1]" + +--style_type[label;textcolor=green] +--label[0,0;Green] +--style_type[label;textcolor=blue] +--label[0,1;Blue] +--style_type[label;textcolor=;border=true] +--label[1.2,0;Border] +--style_type[label;border=true;bgcolor=red] +--label[1.2,1;Background] +--style_type[label;border=;bgcolor=] +--label[0.75,2;Reset] + + +local pages = { + -- Real Coordinates + [[ + formspec_version[3] + size[12,13] + image_button[0,0;1,1;logo.png;rc_image_button_1x1;1x1] + image_button[1,0;2,2;logo.png;rc_image_button_2x2;2x2] + button[0,2;1,1;rc_button_1x1;1x1] + button[1,2;2,2;rc_button_2x2;2x2] + item_image[0,4;1,1;air] + item_image[1,4;2,2;air] + item_image_button[0,6;1,1;testformspec:node;rc_item_image_button_1x1;1x1] + item_image_button[1,6;2,2;testformspec:node;rc_item_image_button_2x2;2x2] + field[3,.5;3,.5;rc_field;Field;text] + pwdfield[6,.5;3,1;rc_pwdfield;Password Field] + field[3,1;3,1;;Read-Only Field;text] + textarea[3,2;3,.5;rc_textarea_small;Textarea;text] + textarea[6,2;3,2;rc_textarea_big;Textarea;text\nmore text] + textarea[3,3;3,1;;Read-Only Textarea;text\nmore text] + textlist[3,4;3,2;rc_textlist;Textlist,Perfect Coordinates;1;false] + tableoptions[highlight=#ABCDEF75;background=#00000055;border=false] + table[6,4;3,2;rc_table;Table,Cool Stuff,Foo,Bar;2] + dropdown[3,6;3,1;rc_dropdown_small;This,is,a,dropdown;1] + dropdown[6,6;3,2;rc_dropdown_big;I,am,a,bigger,dropdown;5] + image[0,8;3,2;ignore.png] + box[3,7;3,1;#00A3FF] + checkbox[3,8;rc_checkbox_1;Check me!;false] + checkbox[3,9;rc_checkbox_2;Uncheck me now!;true] + scrollbar[0,11.5;11.5,.5;horizontal;rc_scrollbar_horizontal;500] + scrollbar[11.5,0;.5,11.5;vertical;rc_scrollbar_vertical;0] + list[current_player;main;6,8;3,2;1] + button[9,0;2.5,1;rc_empty_button_1;] + button[9,1;2.5,1;rc_empty_button_2;] + button[9,2;2.5,1;rc_empty_button_3;] ]].. + "label[9,0.5;This is a label.\nLine\nLine\nLine\nEnd]".. + [[button[9,3;1,1;rc_empty_button_4;] + vertlabel[9,4;VERT] + label[10,3;HORIZ] + tabheader[8,0;6,0.65;rc_tabheader;Tab 1,Tab 2,Tab 3,Secrets;1;false;false] + ]], + -- Style + + "formspec_version[3]size[12,13]" .. + ("label[0.375,0.375;Styled - %s %s]"):format( + color("#F00", "red text"), + color("#77FF00CC", "green text")) .. + "label[6.375,0.375;Unstyled]" .. + "box[0,0.75;12,0.1;#999]" .. + "box[6,0.85;0.1,11.15;#999]" .. + "container[0.375,1.225]" .. + style_fs .. + "container_end[]container[6.375,1.225]" .. + style_fs:gsub("one_", "two_"):gsub("style%[[^%]]+%]", ""):gsub("style_type%[[^%]]+%]", "") .. + "container_end[]", + + -- Noclip + "formspec_version[3]size[12,13]" .. + "label[0.1,0.5;Clip]" .. + "container[-2.5,1]" .. clip_fs:gsub("%%c", "false") .. "container_end[]" .. + "label[11,0.5;Noclip]" .. + "container[11.5,1]" .. clip_fs:gsub("%%c", "true") .. "container_end[]", + + -- Hypertext + "size[12,13]real_coordinates[true]" .. + "container[0.5,0.5]" .. hypertext_fs .. "container_end[]", + + -- Tabheaders + "size[12,13]real_coordinates[true]" .. + "container[0.5,1.5]" .. tabheaders_fs .. "container_end[]", + + -- Animation + [[ + formspec_version[3] + size[12,13] + animated_image[0.5,0.5;1,1;;testformspec_animation.png;4;100] + animated_image[0.5,1.75;1,1;;testformspec_animation.jpg;4;100] + animated_image[1.75,0.5;1,1;;testformspec_animation.png;100;100] + animated_image[3,0.5;1,1;ani_img_1;testformspec_animation.png;4;1000] + button[4.25,0.5;1,1;ani_btn_1;Current +Number] + animated_image[3,1.75;1,1;ani_img_2;testformspec_animation.png;4;1000;2] + button[4.25,1.75;1,1;ani_btn_2;Current +Number] + animated_image[3,3;1,1;;testformspec_animation.png;4;0] + animated_image[3,4.25;1,1;;testformspec_animation.png;4;0;3] + animated_image[5.5,0.5;5,2;;testformspec_animation.png;4;100] + animated_image[5.5,2.75;5,2;;testformspec_animation.jpg;4;100] + ]], + + -- Scroll containers + "formspec_version[3]size[12,13]" .. + scroll_fs, +} + +local function show_test_formspec(pname, page_id) + page_id = page_id or 2 + + local fs = pages[page_id] .. "tabheader[0,0;8,0.65;maintabs;Real Coord,Styles,Noclip,Hypertext,Tabs,Anim,ScrollC;" .. page_id .. ";false;false]" + + minetest.show_formspec(pname, "testformspec:formspec", fs) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "testformspec:formspec" then + return false + end + + + if fields.maintabs then + show_test_formspec(player:get_player_name(), tonumber(fields.maintabs)) + return true + end + + if fields.ani_img_1 and fields.ani_btn_1 then + minetest.chat_send_player(player:get_player_name(), "ani_img_1 = " .. tostring(fields.ani_img_1)) + return true + elseif fields.ani_img_2 and fields.ani_btn_2 then + minetest.chat_send_player(player:get_player_name(), "ani_img_2 = " .. tostring(fields.ani_img_2)) + return true + end + + if fields.hypertext then + minetest.chat_send_player(player:get_player_name(), "Hypertext action received: " .. tostring(fields.hypertext)) + return true + end +end) + +minetest.register_chatcommand("test_formspec", { + params = "", + description = "Open the test formspec", + func = function(name) + if not minetest.get_player_by_name(name) then + return false, "You need to be online!" + end + + show_test_formspec(name) + return true + end, +}) diff --git a/games/devtest/mods/testformspec/init.lua b/games/devtest/mods/testformspec/init.lua new file mode 100644 index 000000000..23b565f08 --- /dev/null +++ b/games/devtest/mods/testformspec/init.lua @@ -0,0 +1,3 @@ +dofile(minetest.get_modpath("testformspec").."/dummy_items.lua") +dofile(minetest.get_modpath("testformspec").."/formspec.lua") +dofile(minetest.get_modpath("testformspec").."/callbacks.lua") diff --git a/games/devtest/mods/testformspec/mod.conf b/games/devtest/mods/testformspec/mod.conf new file mode 100644 index 000000000..00eac307a --- /dev/null +++ b/games/devtest/mods/testformspec/mod.conf @@ -0,0 +1,2 @@ +name = testformspec +description = Contains an example formspec to test all the features of formspecs diff --git a/games/devtest/mods/testformspec/textures/testformspec_animation.jpg b/games/devtest/mods/testformspec/textures/testformspec_animation.jpg new file mode 100644 index 000000000..b98ca2677 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_animation.jpg differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_animation.png b/games/devtest/mods/testformspec/textures/testformspec_animation.png new file mode 100644 index 000000000..b972e5dbb Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_animation.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg.png b/games/devtest/mods/testformspec/textures/testformspec_bg.png new file mode 100644 index 000000000..cd1e50900 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_9slice.png b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice.png new file mode 100644 index 000000000..34433ac82 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_hovered.png b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_hovered.png new file mode 100644 index 000000000..01c2dc777 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_hovered.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_pressed.png b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_pressed.png new file mode 100644 index 000000000..0cbac7536 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_9slice_pressed.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_hovered.png b/games/devtest/mods/testformspec/textures/testformspec_bg_hovered.png new file mode 100644 index 000000000..3ebbb988c Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_hovered.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_bg_pressed.png b/games/devtest/mods/testformspec/textures/testformspec_bg_pressed.png new file mode 100644 index 000000000..2fb5fc21e Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_bg_pressed.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_button_image.png b/games/devtest/mods/testformspec/textures/testformspec_button_image.png new file mode 100644 index 000000000..75c438a9a Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_button_image.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_hovered.png b/games/devtest/mods/testformspec/textures/testformspec_hovered.png new file mode 100644 index 000000000..3ccad30a2 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_hovered.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_item.png b/games/devtest/mods/testformspec/textures/testformspec_item.png new file mode 100644 index 000000000..4fd823b55 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_item.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_node.png b/games/devtest/mods/testformspec/textures/testformspec_node.png new file mode 100644 index 000000000..c107f28a3 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_node.png differ diff --git a/games/devtest/mods/testformspec/textures/testformspec_pressed.png b/games/devtest/mods/testformspec/textures/testformspec_pressed.png new file mode 100644 index 000000000..45c504f27 Binary files /dev/null and b/games/devtest/mods/testformspec/textures/testformspec_pressed.png differ diff --git a/games/devtest/mods/testnodes/README.md b/games/devtest/mods/testnodes/README.md new file mode 100644 index 000000000..13ed972c0 --- /dev/null +++ b/games/devtest/mods/testnodes/README.md @@ -0,0 +1,11 @@ +# Test Nodes + +This mod contains a bunch of basic nodes to test development stuff. +Most nodes are kept as minimal as possible in order to show off one particular feature of the engine, to make testing stuff easier. + +This mod includes tests for: + +* drawtypes +* paramtype2's +* node properties such as damage, drowning, falling, etc. +* other random stuff diff --git a/games/devtest/mods/testnodes/drawtypes.lua b/games/devtest/mods/testnodes/drawtypes.lua new file mode 100644 index 000000000..35fda960f --- /dev/null +++ b/games/devtest/mods/testnodes/drawtypes.lua @@ -0,0 +1,517 @@ +--[[ Drawtype Test: This file tests out and provides examples for +all drawtypes in Minetest. It is attempted to keep the node +definitions as simple and minimal as possible to keep +side-effects to a minimum. + +How to read the node definitions: +There are two parts which are separated by 2 newlines: +The first part contains the things that are more or less essential +for defining the drawtype (except description, which is +at the top for readability). +The second part (after the 2 newlines) contains stuff that are +unrelated to the drawtype, stuff that is mostly there to make +testing this node easier and more convenient. +]] + +local S = minetest.get_translator("testnodes") + +-- If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. +-- This is due to . +-- This is only added to make the items more visible to avoid confusion, but you will no longer see +-- the default inventory images for these items. When you want to test the default inventory image of drawtypes, +-- this should be turned off. +-- TODO: Remove support for fallback inventory image as soon #9209 is fixed. +local SHOW_FALLBACK_IMAGE = minetest.settings:get_bool("testnodes_show_fallback_image", false) + +local fallback_image = function(img) + if SHOW_FALLBACK_IMAGE then + return img + else + return nil + end +end + +-- A regular cube +minetest.register_node("testnodes:normal", { + description = S("Normal Drawtype Test Node"), + drawtype = "normal", + tiles = { "testnodes_normal.png" }, + + groups = { dig_immediate = 3 }, +}) + +-- Standard glasslike node +minetest.register_node("testnodes:glasslike", { + description = S("Glasslike Drawtype Test Node"), + drawtype = "glasslike", + paramtype = "light", + tiles = { "testnodes_glasslike.png" }, + + groups = { dig_immediate = 3 }, +}) + +-- Glasslike framed with the two textures (normal and "detail") +minetest.register_node("testnodes:glasslike_framed", { + description = S("Glasslike Framed Drawtype Test Node"), + drawtype = "glasslike_framed", + paramtype = "light", + tiles = { + "testnodes_glasslike_framed.png", + "testnodes_glasslike_detail.png", + }, + + + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + +-- Like the one above, but without the "detail" texture (texture 2). +-- This node was added to see how the engine behaves when the "detail" texture +-- is missing. +minetest.register_node("testnodes:glasslike_framed_no_detail", { + description = S("Glasslike Framed without Detail Drawtype Test Node"), + drawtype = "glasslike_framed", + paramtype = "light", + tiles = { "testnodes_glasslike_framed2.png" }, + + + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + + +minetest.register_node("testnodes:glasslike_framed_optional", { + description = S("Glasslike Framed Optional Drawtype Test Node"), + drawtype = "glasslike_framed_optional", + paramtype = "light", + tiles = { + "testnodes_glasslike_framed_optional.png", + "testnodes_glasslike_detail.png", + }, + + + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + + + +minetest.register_node("testnodes:allfaces", { + description = S("Allfaces Drawtype Test Node"), + drawtype = "allfaces", + paramtype = "light", + tiles = { "testnodes_allfaces.png" }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:allfaces_optional", { + description = S("Allfaces Optional Drawtype Test Node"), + drawtype = "allfaces_optional", + paramtype = "light", + tiles = { "testnodes_allfaces_optional.png" }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:allfaces_optional_waving", { + description = S("Waving Allfaces Optional Drawtype Test Node"), + drawtype = "allfaces_optional", + paramtype = "light", + tiles = { "testnodes_allfaces_optional.png^[brighten" }, + waving = 2, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:firelike", { + description = S("Firelike Drawtype Test Node"), + drawtype = "firelike", + paramtype = "light", + tiles = { "testnodes_firelike.png" }, + + + walkable = false, + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:fencelike", { + description = S("Fencelike Drawtype Test Node"), + drawtype = "fencelike", + paramtype = "light", + tiles = { "testnodes_fencelike.png" }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:torchlike", { + description = S("Wallmounted Torchlike Drawtype Test Node"), + drawtype = "torchlike", + paramtype = "light", + paramtype2 = "wallmounted", + tiles = { + "testnodes_torchlike_floor.png", + "testnodes_torchlike_ceiling.png", + "testnodes_torchlike_wall.png", + }, + + + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, + inventory_image = fallback_image("testnodes_torchlike_floor.png"), +}) + +minetest.register_node("testnodes:signlike", { + description = S("Wallmounted Signlike Drawtype Test Node"), + drawtype = "signlike", + paramtype = "light", + paramtype2 = "wallmounted", + tiles = { "testnodes_signlike.png" }, + + + walkable = false, + groups = { dig_immediate = 3 }, + sunlight_propagates = true, + inventory_image = fallback_image("testnodes_signlike.png"), +}) + +minetest.register_node("testnodes:plantlike", { + description = S("Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + tiles = { "testnodes_plantlike.png" }, + + + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:plantlike_waving", { + description = S("Waving Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + tiles = { "testnodes_plantlike_waving.png" }, + waving = 1, + + + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + + + +-- param2 will rotate +minetest.register_node("testnodes:plantlike_degrotate", { + description = S("Degrotate Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + paramtype2 = "degrotate", + tiles = { "testnodes_plantlike_degrotate.png" }, + + + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + +-- param2 will change height +minetest.register_node("testnodes:plantlike_leveled", { + description = S("Leveled Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + paramtype2 = "leveled", + tiles = { + { name = "testnodes_plantlike_leveled.png", tileable_vertical = true }, + }, + + + -- We set a default param2 here only for convenience, to make the "plant" visible after placement + place_param2 = 8, + walkable = false, + sunlight_propagates = true, + groups = { dig_immediate = 3 }, +}) + +-- param2 changes shape +minetest.register_node("testnodes:plantlike_meshoptions", { + description = S("Meshoptions Plantlike Drawtype Test Node"), + drawtype = "plantlike", + paramtype = "light", + paramtype2 = "meshoptions", + tiles = { "testnodes_plantlike_meshoptions.png" }, + + + walkable = false, + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:plantlike_rooted", { + description = S("Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + tiles = { "testnodes_plantlike_rooted_base.png" }, + special_tiles = { "testnodes_plantlike_rooted.png" }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:plantlike_rooted_waving", { + description = S("Waving Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + tiles = { + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base_side_waving.png", + }, + special_tiles = { "testnodes_plantlike_rooted_waving.png" }, + waving = 1, + + groups = { dig_immediate = 3 }, +}) + +-- param2 changes height +minetest.register_node("testnodes:plantlike_rooted_leveled", { + description = S("Leveled Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + paramtype2 = "leveled", + tiles = { + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base_side_leveled.png", + }, + special_tiles = { + { name = "testnodes_plantlike_rooted_leveled.png", tileable_vertical = true }, + }, + + + -- We set a default param2 here only for convenience, to make the "plant" visible after placement + place_param2 = 8, + groups = { dig_immediate = 3 }, +}) + +-- param2 changes shape +minetest.register_node("testnodes:plantlike_rooted_meshoptions", { + description = S("Meshoptions Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + paramtype2 = "meshoptions", + tiles = { + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base_side_meshoptions.png", + }, + special_tiles = { + "testnodes_plantlike_rooted_meshoptions.png", + }, + + groups = { dig_immediate = 3 }, +}) + +-- param2 changes rotation +minetest.register_node("testnodes:plantlike_rooted_degrotate", { + description = S("Degrotate Rooted Plantlike Drawtype Test Node"), + drawtype = "plantlike_rooted", + paramtype = "light", + paramtype2 = "degrotate", + tiles = { + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base.png", + "testnodes_plantlike_rooted_base_side_degrotate.png", + }, + special_tiles = { + "testnodes_plantlike_rooted_degrotate.png", + }, + + groups = { dig_immediate = 3 }, +}) + +-- Demonstrative liquid nodes, source and flowing form. This is only the +-- drawtype, no physical liquid properties are used +minetest.register_node("testnodes:liquid", { + description = S("Source Liquid Drawtype Test Node"), + drawtype = "liquid", + paramtype = "light", + tiles = { + "testnodes_liquidsource.png", + }, + special_tiles = { + {name="testnodes_liquidsource.png", backface_culling=false}, + {name="testnodes_liquidsource.png", backface_culling=true}, + }, + use_texture_alpha = true, + + + walkable = false, + liquid_alternative_flowing = "testnodes:liquid_flowing", + liquid_alternative_source = "testnodes:liquid", + groups = { dig_immediate = 3 }, +}) +minetest.register_node("testnodes:liquid_flowing", { + description = S("Flowing Liquid Drawtype Test Node"), + drawtype = "flowingliquid", + paramtype = "light", + paramtype2 = "flowingliquid", + tiles = { + "testnodes_liquidflowing.png", + }, + special_tiles = { + {name="testnodes_liquidflowing.png", backface_culling=false}, + {name="testnodes_liquidflowing.png", backface_culling=false}, + }, + use_texture_alpha = true, + + + walkable = false, + liquid_alternative_flowing = "testnodes:liquid_flowing", + liquid_alternative_source = "testnodes:liquid", + groups = { dig_immediate = 3 }, +}) +minetest.register_node("testnodes:liquid_waving", { + description = S("Waving Source Liquid Drawtype Test Node"), + drawtype = "liquid", + paramtype = "light", + tiles = { + "testnodes_liquidsource.png^[brighten", + }, + special_tiles = { + {name="testnodes_liquidsource.png^[brighten", backface_culling=false}, + {name="testnodes_liquidsource.png^[brighten", backface_culling=true}, + }, + use_texture_alpha = true, + waving = 3, + + + walkable = false, + liquid_alternative_flowing = "testnodes:liquid_flowing", + liquid_alternative_source = "testnodes:liquid", + groups = { dig_immediate = 3 }, +}) +minetest.register_node("testnodes:liquid_flowing_waving", { + description = S("Waving Flowing Liquid Drawtype Test Node"), + drawtype = "flowingliquid", + paramtype = "light", + paramtype2 = "flowingliquid", + tiles = { + "testnodes_liquidflowing.png^[brighten", + }, + special_tiles = { + {name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, + {name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, + }, + use_texture_alpha = true, + waving = 3, + + + walkable = false, + liquid_alternative_flowing = "testnodes:liquid_flowing", + liquid_alternative_source = "testnodes:liquid", + groups = { dig_immediate = 3 }, +}) + + + +-- Invisible node +minetest.register_node("testnodes:airlike", { + description = S("Airlike Drawtype Test Node"), + drawtype = "airlike", + paramtype = "light", + + + walkable = false, + groups = { dig_immediate = 3 }, + sunlight_propagates = true, + inventory_image = fallback_image("testnodes_airlike.png"), +}) + +-- param2 changes liquid height +minetest.register_node("testnodes:glassliquid", { + description = S("Glasslike Liquid Level Drawtype Test Node"), + drawtype = "glasslike_framed", + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + tiles = { + "testnodes_glasslikeliquid.png", + }, + special_tiles = { + "testnodes_liquid.png", + }, + + groups = { dig_immediate = 3 }, +}) + +-- Adding many raillike examples, primarily to demonstrate the behavior of +-- "raillike groups". Nodes of the same type (rail, groupless, line, street) +-- should connect to nodes of the same "rail type" (=same shape, different +-- color) only. +local rails = { + { "rail", {"testnodes_rail_straight.png", "testnodes_rail_curved.png", "testnodes_rail_t_junction.png", "testnodes_rail_crossing.png"} }, + { "line", {"testnodes_line_straight.png", "testnodes_line_curved.png", "testnodes_line_t_junction.png", "testnodes_line_crossing.png"}, }, + { "street", {"testnodes_street_straight.png", "testnodes_street_curved.png", "testnodes_street_t_junction.png", "testnodes_street_crossing.png"}, }, + -- the "groupless" nodes are nodes in which the "connect_to_raillike" group is not set + { "groupless", {"testnodes_rail2_straight.png", "testnodes_rail2_curved.png", "testnodes_rail2_t_junction.png", "testnodes_rail2_crossing.png"} }, +} +local colors = { "", "cyan", "red" } + +for r=1, #rails do + local id = rails[r][1] + local tiles = rails[r][2] + local raillike_group + if id ~= "groupless" then + raillike_group = minetest.raillike_group(id) + end + for c=1, #colors do + local color + if colors[c] ~= "" then + color = colors[c] + end + minetest.register_node("testnodes:raillike_"..id..c, { + description = S("Raillike Drawtype Test Node: @1 @2", id, c), + drawtype = "raillike", + paramtype = "light", + tiles = tiles, + groups = { connect_to_raillike = raillike_group, dig_immediate = 3 }, + + + color = color, + selection_box = { + type = "fixed", + fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}}, + }, + sunlight_propagates = true, + walkable = false, + }) + end +end + + + +-- Add visual_scale variants of previous nodes for half and double size +local scale = function(subname, desc_double, desc_half) + local original = "testnodes:"..subname + local def = table.copy(minetest.registered_items[original]) + def.visual_scale = 2.0 + def.description = desc_double + minetest.register_node("testnodes:"..subname.."_double", def) + def = table.copy(minetest.registered_items[original]) + def.visual_scale = 0.5 + def.description = desc_half + minetest.register_node("testnodes:"..subname.."_half", def) +end + +scale("plantlike", + S("Double-sized Plantlike Drawtype Test Node"), + S("Half-sized Plantlike Drawtype Test Node")) +scale("torchlike", + S("Double-sized Wallmounted Torchlike Drawtype Test Node"), + S("Half-sized Wallmounted Torchlike Drawtype Test Node")) +scale("signlike", + S("Double-sized Wallmounted Signlike Drawtype Test Node"), + S("Half-sized Wallmounted Signlike Drawtype Test Node")) +scale("firelike", + S("Double-sized Firelike Drawtype Test Node"), + S("Half-sized Firelike Drawtype Test Node")) diff --git a/games/devtest/mods/testnodes/init.lua b/games/devtest/mods/testnodes/init.lua new file mode 100644 index 000000000..92e2c5630 --- /dev/null +++ b/games/devtest/mods/testnodes/init.lua @@ -0,0 +1,10 @@ +local path = minetest.get_modpath(minetest.get_current_modname()) + +dofile(path.."/drawtypes.lua") +dofile(path.."/meshes.lua") +dofile(path.."/nodeboxes.lua") +dofile(path.."/param2.lua") +dofile(path.."/properties.lua") +dofile(path.."/liquids.lua") +dofile(path.."/light.lua") +dofile(path.."/textures.lua") diff --git a/games/devtest/mods/testnodes/light.lua b/games/devtest/mods/testnodes/light.lua new file mode 100644 index 000000000..94409e83f --- /dev/null +++ b/games/devtest/mods/testnodes/light.lua @@ -0,0 +1,48 @@ +-- Test Nodes: Light test + +local S = minetest.get_translator("testnodes") + +-- All possible light levels +for i=1, minetest.LIGHT_MAX do + minetest.register_node("testnodes:light"..i, { + description = S("Light Source (@1)", i), + paramtype = "light", + light_source = i, + + + tiles ={"testnodes_light_"..i..".png"}, + drawtype = "glasslike", + walkable = false, + sunlight_propagates = true, + is_ground_content = false, + groups = {dig_immediate=3}, + }) +end + +-- Lets light through, but not sunlight, leading to a +-- reduction in light level when light passes through +minetest.register_node("testnodes:sunlight_filter", { + description = S("Sunlight Filter"), + paramtype = "light", + + + drawtype = "glasslike", + tiles = { + "testnodes_sunlight_filter.png", + }, + groups = { dig_immediate = 3 }, +}) + +-- Lets light and sunlight through without obstruction +minetest.register_node("testnodes:sunlight_propagator", { + description = S("Sunlight Propagator"), + paramtype = "light", + sunlight_propagates = true, + + + drawtype = "glasslike", + tiles = { + "testnodes_sunlight_filter.png^[brighten", + }, + groups = { dig_immediate = 3 }, +}) diff --git a/games/devtest/mods/testnodes/liquids.lua b/games/devtest/mods/testnodes/liquids.lua new file mode 100644 index 000000000..e316782ad --- /dev/null +++ b/games/devtest/mods/testnodes/liquids.lua @@ -0,0 +1,91 @@ +-- Add liquids for ranges and viscosity levels 0-8 + +for d=0, 8 do + minetest.register_node("testnodes:rliquid_"..d, { + description = "Test Liquid Source, Range "..d, + drawtype = "liquid", + tiles = {"testnodes_liquidsource_r"..d..".png"}, + special_tiles = { + {name = "testnodes_liquidsource_r"..d..".png", backface_culling = false}, + {name = "testnodes_liquidsource_r"..d..".png", backface_culling = true}, + }, + alpha = 192, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + liquidtype = "source", + liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d, + liquid_alternative_source = "testnodes:rliquid_"..d, + liquid_range = d, + }) + + minetest.register_node("testnodes:rliquid_flowing_"..d, { + description = "Flowing Test Liquid, Range "..d, + drawtype = "flowingliquid", + tiles = {"testnodes_liquidflowing_r"..d..".png"}, + special_tiles = { + {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false}, + {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false}, + }, + alpha = 192, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + liquidtype = "flowing", + liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d, + liquid_alternative_source = "testnodes:rliquid_"..d, + liquid_range = d, + }) + + local mod = "^[colorize:#000000:127" + minetest.register_node("testnodes:vliquid_"..d, { + description = "Test Liquid Source, Viscosity "..d, + drawtype = "liquid", + tiles = {"testnodes_liquidsource_r"..d..".png"..mod}, + special_tiles = { + {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = false}, + {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = true}, + }, + alpha = 192, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + liquidtype = "source", + liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d, + liquid_alternative_source = "testnodes:vliquid_"..d, + liquid_viscosity = d, + }) + + minetest.register_node("testnodes:vliquid_flowing_"..d, { + description = "Flowing Test Liquid, Viscosity "..d, + drawtype = "flowingliquid", + tiles = {"testnodes_liquidflowing_r"..d..".png"..mod}, + special_tiles = { + {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false}, + {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false}, + }, + alpha = 192, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + liquidtype = "flowing", + liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d, + liquid_alternative_source = "testnodes:vliquid_"..d, + liquid_viscosity = d, + }) + +end diff --git a/games/devtest/mods/testnodes/meshes.lua b/games/devtest/mods/testnodes/meshes.lua new file mode 100644 index 000000000..900abc180 --- /dev/null +++ b/games/devtest/mods/testnodes/meshes.lua @@ -0,0 +1,145 @@ +-- Meshes + +local S = minetest.get_translator("testnodes") + +local ocorner_cbox = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + {-0.5, -0.25, -0.25, 0.25, 0, 0.5}, + {-0.5, 0, 0, 0, 0.25, 0.5}, + {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5} + } +} + +local tall_pyr_cbox = { + type = "fixed", + fixed = { + { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, + { -0.375, -0.25, -0.375, 0.375, 0, 0.375}, + { -0.25, 0, -0.25, 0.25, 0.25, 0.25}, + { -0.125, 0.25, -0.125, 0.125, 0.5, 0.125} + } +} + +-- Normal mesh +minetest.register_node("testnodes:mesh", { + description = S("Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes2.png"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + + groups = {dig_immediate=3}, +}) + +-- Facedir mesh: outer corner slope +minetest.register_node("testnodes:mesh_facedir", { + description = S("Facedir Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_ocorner.obj", + tiles = {"testnodes_mesh_stripes.png"}, + paramtype = "light", + paramtype2 = "facedir", + collision_box = ocorner_cbox, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:mesh_colorfacedir", { + description = S("Color Facedir Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_ocorner.obj", + tiles = {"testnodes_mesh_stripes3.png"}, + paramtype = "light", + paramtype2 = "colorfacedir", + palette = "testnodes_palette_facedir.png", + collision_box = ocorner_cbox, + + groups = {dig_immediate=3}, +}) + +-- Wallmounted mesh: pyramid +minetest.register_node("testnodes:mesh_wallmounted", { + description = S("Wallmounted Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes2.png"}, + paramtype = "light", + paramtype2 = "wallmounted", + collision_box = tall_pyr_cbox, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:mesh_colorwallmounted", { + description = S("Color Wallmounted Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes3.png"}, + paramtype = "light", + paramtype2 = "colorwallmounted", + palette = "testnodes_palette_wallmounted.png", + collision_box = tall_pyr_cbox, + + groups = {dig_immediate=3}, +}) + + +minetest.register_node("testnodes:mesh_double", { + description = S("Double-sized Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes2.png"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + visual_scale = 2, + + groups = {dig_immediate=3}, +}) +minetest.register_node("testnodes:mesh_half", { + description = S("Half-sized Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes2.png"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + visual_scale = 0.5, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:mesh_waving1", { + description = S("Plantlike-waving Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0FFB0"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + waving = 1, + + groups = {dig_immediate=3}, +}) +minetest.register_node("testnodes:mesh_waving2", { + description = S("Leaflike-waving Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes4.png^[multiply:#FFFFB0"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + waving = 2, + + groups = {dig_immediate=3}, +}) +minetest.register_node("testnodes:mesh_waving3", { + description = S("Liquidlike-waving Mesh Test Node"), + drawtype = "mesh", + mesh = "testnodes_pyramid.obj", + tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0B0FF"}, + paramtype = "light", + collision_box = tall_pyr_cbox, + waving = 3, + + groups = {dig_immediate=3}, +}) diff --git a/games/devtest/mods/testnodes/mod.conf b/games/devtest/mods/testnodes/mod.conf new file mode 100644 index 000000000..4824c6ed0 --- /dev/null +++ b/games/devtest/mods/testnodes/mod.conf @@ -0,0 +1,2 @@ +name = testnodes +description = Contains a bunch of basic example nodes for demonstrative purposes, development and testing diff --git a/games/devtest/mods/testnodes/models/testnodes_ocorner.obj b/games/devtest/mods/testnodes/models/testnodes_ocorner.obj new file mode 100644 index 000000000..231d7056b --- /dev/null +++ b/games/devtest/mods/testnodes/models/testnodes_ocorner.obj @@ -0,0 +1,23 @@ +# Blender v2.73 (sub 0) OBJ File: 'slope_test_ocorner_onetexture.blend' +# www.blender.org +o Cube_Cube.002 +v 0.500000 0.500000 0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 -0.500000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vn 0.000000 -1.000000 -0.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 -0.000000 1.000000 +vn -0.707100 0.707100 0.000000 +vn 0.000000 0.707100 -0.707100 +s off +f 3/1/1 2/2/1 4/3/1 5/4/1 +f 1/2/2 3/3/2 5/4/2 +f 1/1/3 2/3/3 3/4/3 +f 1/1/4 4/3/4 2/4/4 +f 1/2/5 5/3/5 4/4/5 diff --git a/games/devtest/mods/testnodes/models/testnodes_pyramid.obj b/games/devtest/mods/testnodes/models/testnodes_pyramid.obj new file mode 100644 index 000000000..b305af2f8 --- /dev/null +++ b/games/devtest/mods/testnodes/models/testnodes_pyramid.obj @@ -0,0 +1,24 @@ +# Blender v2.73 (sub 0) OBJ File: 'slope_test_pyramid_onetexture.blend' +# www.blender.org +o Cube +v 0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.000000 0.500000 -0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.500000 1.000000 +vn 0.000000 -1.000000 0.000000 +vn -0.894400 0.447200 -0.000000 +vn 0.000000 0.447200 -0.894400 +vn 0.894400 0.447200 0.000000 +vn -0.000000 0.447200 0.894400 +s off +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 3/4/2 5/5/2 4/3/2 +f 5/5/3 1/3/3 4/4/3 +f 1/4/4 5/5/4 2/3/4 +f 2/4/5 5/5/5 3/3/5 diff --git a/games/devtest/mods/testnodes/nodeboxes.lua b/games/devtest/mods/testnodes/nodeboxes.lua new file mode 100644 index 000000000..ebd858337 --- /dev/null +++ b/games/devtest/mods/testnodes/nodeboxes.lua @@ -0,0 +1,80 @@ +local S = minetest.get_translator("testnodes") + +-- Nodebox examples and tests. + +-- An simple example nodebox with one centered box +minetest.register_node("testnodes:nodebox_fixed", { + description = S("Fixed Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, + }, + + groups = {dig_immediate=3}, +}) + +-- 50% higher than a regular node +minetest.register_node("testnodes:nodebox_overhigh", { + description = S("Overhigh Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 1, 0.5}, + }, + + groups = {dig_immediate=3}, +}) + +-- 100% higher than a regular node +minetest.register_node("testnodes:nodebox_overhigh2", { + description = S("Double-height Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}, + }, + + groups = {dig_immediate=3}, +}) + +-- Height of nodebox changes with its param2 value +minetest.register_node("testnodes:nodebox_leveled", { + description = S("Leveled Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "leveled", + node_box = { + type = "leveled", + fixed = {-0.5, 0.0, -0.5, 0.5, -0.499, 0.5}, + }, + + groups = {dig_immediate=3}, +}) + +-- Wall-like nodebox that connects to neighbors +minetest.register_node("testnodes:nodebox_connected", { + description = S("Connected Nodebox Test Node"), + tiles = {"testnodes_nodebox.png"}, + groups = {connected_nodebox=1, dig_immediate=3}, + drawtype = "nodebox", + paramtype = "light", + connects_to = {"group:connected_nodebox"}, + connect_sides = {"front", "back", "left", "right"}, + node_box = { + type = "connected", + fixed = {-0.125, -0.500, -0.125, 0.125, 0.500, 0.125}, + connect_front = {-0.125, -0.500, -0.500, 0.125, 0.400, -0.125}, + connect_back = {-0.125, -0.500, 0.125, 0.125, 0.400, 0.500}, + connect_left = {-0.500, -0.500, -0.125, -0.125, 0.400, 0.125}, + connect_right = {0.125, -0.500, -0.125, 0.500, 0.400, 0.125}, + }, +}) + diff --git a/games/devtest/mods/testnodes/param2.lua b/games/devtest/mods/testnodes/param2.lua new file mode 100644 index 000000000..5d64376fa --- /dev/null +++ b/games/devtest/mods/testnodes/param2.lua @@ -0,0 +1,168 @@ +-- This file is for misc. param2 tests that aren't covered in drawtypes.lua already. + +local S = minetest.get_translator("testnodes") + +minetest.register_node("testnodes:facedir", { + description = S("Facedir Test Node"), + paramtype2 = "facedir", + tiles = { + "testnodes_1.png", + "testnodes_2.png", + "testnodes_3.png", + "testnodes_4.png", + "testnodes_5.png", + "testnodes_6.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:facedir_nodebox", { + description = S("Facedir Nodebox Test Node"), + tiles = { + "testnodes_1.png", + "testnodes_2.png", + "testnodes_3.png", + "testnodes_4.png", + "testnodes_5.png", + "testnodes_6.png", + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2}, + }, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:wallmounted", { + description = S("Wallmounted Test Node"), + paramtype2 = "wallmounted", + tiles = { + "testnodes_1w.png", + "testnodes_2w.png", + "testnodes_3w.png", + "testnodes_4w.png", + "testnodes_5w.png", + "testnodes_6w.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:wallmounted_nodebox", { + description = S("Wallmounted Nodebox Test Node"), + paramtype2 = "wallmounted", + paramtype = "light", + tiles = { + "testnodes_1w.png", + "testnodes_2w.png", + "testnodes_3w.png", + "testnodes_4w.png", + "testnodes_5w.png", + "testnodes_6w.png", + }, + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, + wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, + wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:color", { + description = S("Color Test Node"), + paramtype2 = "color", + palette = "testnodes_palette_full.png", + tiles = { + "testnodes_node.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:colorfacedir", { + description = S("Color Facedir Test Node"), + paramtype2 = "colorfacedir", + palette = "testnodes_palette_facedir.png", + tiles = { + "testnodes_1g.png", + "testnodes_2g.png", + "testnodes_3g.png", + "testnodes_4g.png", + "testnodes_5g.png", + "testnodes_6g.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:colorfacedir_nodebox", { + description = S("Color Facedir Nodebox Test Node"), + tiles = { + "testnodes_1g.png", + "testnodes_2g.png", + "testnodes_3g.png", + "testnodes_4g.png", + "testnodes_5g.png", + "testnodes_6g.png", + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "colorfacedir", + palette = "testnodes_palette_facedir.png", + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2}, + }, + + groups = {dig_immediate=3}, +}) + +minetest.register_node("testnodes:colorwallmounted", { + description = S("Color Wallmounted Test Node"), + paramtype2 = "colorwallmounted", + paramtype = "light", + palette = "testnodes_palette_wallmounted.png", + tiles = { + "testnodes_1wg.png", + "testnodes_2wg.png", + "testnodes_3wg.png", + "testnodes_4wg.png", + "testnodes_5wg.png", + "testnodes_6wg.png", + }, + + groups = { dig_immediate = 3 }, +}) + +minetest.register_node("testnodes:colorwallmounted_nodebox", { + description = S("Color Wallmounted Nodebox Test Node"), + paramtype2 = "colorwallmounted", + paramtype = "light", + palette = "testnodes_palette_wallmounted.png", + tiles = { + "testnodes_1wg.png", + "testnodes_2wg.png", + "testnodes_3wg.png", + "testnodes_4wg.png", + "testnodes_5wg.png", + "testnodes_6wg.png", + }, + drawtype = "nodebox", + node_box = { + type = "wallmounted", + wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, + wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, + wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, + }, + + groups = { dig_immediate = 3 }, +}) + diff --git a/games/devtest/mods/testnodes/properties.lua b/games/devtest/mods/testnodes/properties.lua new file mode 100644 index 000000000..e169d4b08 --- /dev/null +++ b/games/devtest/mods/testnodes/properties.lua @@ -0,0 +1,270 @@ +-- Test Nodes: Node property tests + +local S = minetest.get_translator("testnodes") + +-- Is supposed to fall when it doesn't rest on solid ground +minetest.register_node("testnodes:falling", { + description = S("Falling Node"), + tiles = { + "testnodes_node.png", + "testnodes_node.png", + "testnodes_node_falling.png", + }, + groups = { falling_node = 1, dig_immediate = 3 }, +}) + +-- Same as falling node, but will stop falling on top of liquids +minetest.register_node("testnodes:falling_float", { + description = S("Falling+Floating Node"), + groups = { falling_node = 1, float = 1, dig_immediate = 3 }, + + + tiles = { + "testnodes_node.png", + "testnodes_node.png", + "testnodes_node_falling.png", + }, + color = "cyan", +}) + +-- This node attaches to the floor and drops as item +-- when the floor is gone. +minetest.register_node("testnodes:attached", { + description = S("Floor-Attached Node"), + tiles = { + "testnodes_attached_top.png", + "testnodes_attached_bottom.png", + "testnodes_attached_side.png", + }, + groups = { attached_node = 1, dig_immediate = 3 }, +}) + +-- This node attaches to the side of a node and drops as item +-- when the node it attaches to is gone. +minetest.register_node("testnodes:attached_wallmounted", { + description = S("Wallmounted Attached Node"), + paramtype2 = "wallmounted", + tiles = { + "testnodes_attachedw_top.png", + "testnodes_attachedw_bottom.png", + "testnodes_attachedw_side.png", + }, + groups = { attached_node = 1, dig_immediate = 3 }, +}) + +-- Jump disabled +minetest.register_node("testnodes:nojump", { + description = S("Non-jumping Node"), + groups = {disable_jump=1, dig_immediate=3}, + + + tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"}, +}) + +-- Climbable up and down with jump and sneak keys +minetest.register_node("testnodes:climbable", { + description = S("Climbable Node"), + climbable = true, + walkable = false, + + + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + tiles ={"testnodes_climbable_side.png"}, + drawtype = "glasslike", + groups = {dig_immediate=3}, +}) + +-- Climbable only downwards with sneak key +minetest.register_node("testnodes:climbable_nojump", { + description = S("Downwards-climbable Node"), + climbable = true, + walkable = false, + + groups = {disable_jump=1, dig_immediate=3}, + drawtype = "glasslike", + tiles ={"testnodes_climbable_nojump_side.png"}, + paramtype = "light", + sunlight_propagates = true, +}) + +-- A liquid in which you can't rise +minetest.register_node("testnodes:liquid_nojump", { + description = S("Non-jumping Liquid Source Node"), + liquidtype = "source", + liquid_range = 1, + liquid_viscosity = 0, + liquid_alternative_flowing = "testnodes:liquidflowing_nojump", + liquid_alternative_source = "testnodes:liquid_nojump", + liquid_renewable = false, + groups = {disable_jump=1, dig_immediate=3}, + walkable = false, + + drawtype = "liquid", + tiles = {"testnodes_liquidsource.png^[colorize:#FF0000:127"}, + special_tiles = { + {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false}, + {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = true}, + }, + use_texture_alpha = true, + paramtype = "light", + pointable = false, + liquids_pointable = true, + diggable = false, + buildable_to = true, + is_ground_content = false, + post_effect_color = {a = 70, r = 255, g = 0, b = 200}, +}) + +-- A liquid in which you can't rise (flowing variant) +minetest.register_node("testnodes:liquidflowing_nojump", { + description = S("Non-jumping Flowing Liquid Node"), + liquidtype = "flowing", + liquid_range = 1, + liquid_viscosity = 0, + liquid_alternative_flowing = "testnodes:liquidflowing_nojump", + liquid_alternative_source = "testnodes:liquid_nojump", + liquid_renewable = false, + groups = {disable_jump=1, dig_immediate=3}, + walkable = false, + + + drawtype = "flowingliquid", + tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"}, + special_tiles = { + {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false}, + {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false}, + }, + use_texture_alpha = true, + paramtype = "light", + paramtype2 = "flowingliquid", + pointable = false, + liquids_pointable = true, + diggable = false, + buildable_to = true, + is_ground_content = false, + post_effect_color = {a = 70, r = 255, g = 0, b = 200}, +}) + +-- Nodes that modify fall damage (various damage modifiers) +for i=-100, 100, 25 do + if i ~= 0 then + local subname, descnum + if i < 0 then + subname = "m"..math.abs(i) + descnum = tostring(i) + else + subname = tostring(i) + descnum = S("+@1", i) + end + local tex, color, desc + if i > 0 then + local val = math.floor((i/100)*255) + tex = "testnodes_fall_damage_plus.png" + color = { b=0, g=255-val, r=255, a=255 } + desc = S("Fall Damage Node (+@1%)", i) + else + tex = "testnodes_fall_damage_minus.png" + if i == -100 then + color = { r=0, b=0, g=255, a=255 } + else + local val = math.floor((math.abs(i)/100)*255) + color = { r=0, b=255, g=255-val, a=255 } + end + desc = S("Fall Damage Node (-@1%)", math.abs(i)) + end + minetest.register_node("testnodes:damage"..subname, { + description = desc, + groups = {fall_damage_add_percent=i, dig_immediate=3}, + + + tiles = { tex }, + is_ground_content = false, + color = color, + }) + end +end + +-- Bouncy nodes (various bounce levels) +for i=20, 180, 20 do + local val = math.floor(((i-20)/200)*255) + minetest.register_node("testnodes:bouncy"..i, { + description = S("Bouncy Node (@1%)", i), + groups = {bouncy=i, dig_immediate=3}, + + + tiles ={"testnodes_bouncy.png"}, + is_ground_content = false, + color = { r=255, g=255-val, b=val, a=255 }, + }) +end + +-- Slippery nodes (various slippery levels) +for i=1, 5 do + minetest.register_node("testnodes:slippery"..i, { + description = S("Slippery Node (@1)", i), + tiles ={"testnodes_slippery.png"}, + is_ground_content = false, + groups = {slippery=i, dig_immediate=3}, + color = { r=0, g=255, b=math.floor((i/5)*255), a=255 }, + }) +end + +-- By placing something on the node, the node itself will be replaced +minetest.register_node("testnodes:buildable_to", { + description = S("Replacable Node"), + buildable_to = true, + tiles = {"testnodes_buildable_to.png"}, + is_ground_content = false, + groups = {dig_immediate=3}, +}) + +-- Nodes that deal damage to players that are inside them. +-- Negative damage nodes should heal. +for d=-3,3 do + if d ~= 0 then + local sub, tile + if d > 0 then + sub = tostring(d) + tile = "testnodes_damage.png" + else + sub = "m" .. tostring(math.abs(d)) + tile = "testnodes_damage_neg.png" + end + if math.abs(d) == 2 then + tile = tile .. "^[colorize:#000000:70" + elseif math.abs(d) == 3 then + tile = tile .. "^[colorize:#000000:140" + end + minetest.register_node("testnodes:damage_"..sub, { + description = S("Damage Node (@1 damage per second)", d), + damage_per_second = d, + + + walkable = false, + is_ground_content = false, + drawtype = "allfaces", + paramtype = "light", + sunlight_propagates = true, + tiles = { tile }, + groups = {dig_immediate=3}, + }) + end +end + +-- Causes drowning damage +minetest.register_node("testnodes:drowning_1", { + description = S("Drowning Node (@1 damage)", 1), + drowning = 1, + + + walkable = false, + is_ground_content = false, + drawtype = "allfaces", + paramtype = "light", + sunlight_propagates = true, + tiles = { "testnodes_drowning.png" }, + groups = {dig_immediate=3}, +}) + diff --git a/games/devtest/mods/testnodes/settingtypes.txt b/games/devtest/mods/testnodes/settingtypes.txt new file mode 100644 index 000000000..7f753bf3e --- /dev/null +++ b/games/devtest/mods/testnodes/settingtypes.txt @@ -0,0 +1,4 @@ +# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. +# This is due to . +# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off. +testnodes_show_fallback_image (Use fallback inventory images) bool false diff --git a/games/devtest/mods/testnodes/textures.lua b/games/devtest/mods/testnodes/textures.lua new file mode 100644 index 000000000..f5db9ccbf --- /dev/null +++ b/games/devtest/mods/testnodes/textures.lua @@ -0,0 +1,67 @@ +-- Node texture tests + +local S = minetest.get_translator("testnodes") + +minetest.register_node("testnodes:6sides", { + description = S("Six Textures Test Node"), + tiles = { + "testnodes_normal1.png", + "testnodes_normal2.png", + "testnodes_normal3.png", + "testnodes_normal4.png", + "testnodes_normal5.png", + "testnodes_normal6.png", + }, + + groups = { dig_immediate = 2 }, +}) + +minetest.register_node("testnodes:anim", { + description = S("Animated Test Node"), + tiles = { + { name = "testnodes_anim.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 4.0, + }, }, + }, + + groups = { dig_immediate = 2 }, +}) + +-- Node texture transparency test + +local alphas = { 64, 128, 191 } + +for a=1,#alphas do + local alpha = alphas[a] + + -- Transparency taken from texture + minetest.register_node("testnodes:alpha_texture_"..alpha, { + description = S("Texture Alpha Test Node (@1)", alpha), + drawtype = "glasslike", + paramtype = "light", + tiles = { + "testnodes_alpha"..alpha..".png", + }, + use_texture_alpha = true, + + groups = { dig_immediate = 3 }, + }) + + -- Transparency set via "alpha" parameter + minetest.register_node("testnodes:alpha_"..alpha, { + description = S("Alpha Test Node (@1)", alpha), + -- It seems that only the liquid drawtype supports the alpha parameter + drawtype = "liquid", + paramtype = "light", + tiles = { + "testnodes_alpha.png", + }, + alpha = alpha, + + groups = { dig_immediate = 3 }, + }) +end diff --git a/games/devtest/mods/testnodes/textures/testnodes_1.png b/games/devtest/mods/testnodes/textures/testnodes_1.png new file mode 100644 index 000000000..6730997e2 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_1g.png b/games/devtest/mods/testnodes/textures/testnodes_1g.png new file mode 100644 index 000000000..529298ece Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_1g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_1w.png b/games/devtest/mods/testnodes/textures/testnodes_1w.png new file mode 100644 index 000000000..d24e571cc Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_1w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_1wg.png b/games/devtest/mods/testnodes/textures/testnodes_1wg.png new file mode 100644 index 000000000..b2eba0e9a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_1wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_2.png b/games/devtest/mods/testnodes/textures/testnodes_2.png new file mode 100644 index 000000000..6c87c868d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_2g.png b/games/devtest/mods/testnodes/textures/testnodes_2g.png new file mode 100644 index 000000000..cb9060f7b Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_2g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_2w.png b/games/devtest/mods/testnodes/textures/testnodes_2w.png new file mode 100644 index 000000000..b56874ee1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_2w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_2wg.png b/games/devtest/mods/testnodes/textures/testnodes_2wg.png new file mode 100644 index 000000000..108dc87bb Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_2wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_3.png b/games/devtest/mods/testnodes/textures/testnodes_3.png new file mode 100644 index 000000000..05b45629a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_3g.png b/games/devtest/mods/testnodes/textures/testnodes_3g.png new file mode 100644 index 000000000..5c84f5882 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_3g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_3w.png b/games/devtest/mods/testnodes/textures/testnodes_3w.png new file mode 100644 index 000000000..8b435cf01 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_3w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_3wg.png b/games/devtest/mods/testnodes/textures/testnodes_3wg.png new file mode 100644 index 000000000..9ee900667 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_3wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_4.png b/games/devtest/mods/testnodes/textures/testnodes_4.png new file mode 100644 index 000000000..15e6ffec7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_4g.png b/games/devtest/mods/testnodes/textures/testnodes_4g.png new file mode 100644 index 000000000..8f144fae0 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_4g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_4w.png b/games/devtest/mods/testnodes/textures/testnodes_4w.png new file mode 100644 index 000000000..214e0df9d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_4w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_4wg.png b/games/devtest/mods/testnodes/textures/testnodes_4wg.png new file mode 100644 index 000000000..888b3d482 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_4wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_5.png b/games/devtest/mods/testnodes/textures/testnodes_5.png new file mode 100644 index 000000000..1ef1c728c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_5g.png b/games/devtest/mods/testnodes/textures/testnodes_5g.png new file mode 100644 index 000000000..30da4793a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_5g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_5w.png b/games/devtest/mods/testnodes/textures/testnodes_5w.png new file mode 100644 index 000000000..b4cb42426 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_5w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_5wg.png b/games/devtest/mods/testnodes/textures/testnodes_5wg.png new file mode 100644 index 000000000..fac9db28e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_5wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_6.png b/games/devtest/mods/testnodes/textures/testnodes_6.png new file mode 100644 index 000000000..805813e57 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_6g.png b/games/devtest/mods/testnodes/textures/testnodes_6g.png new file mode 100644 index 000000000..a88f4c9f8 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_6g.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_6w.png b/games/devtest/mods/testnodes/textures/testnodes_6w.png new file mode 100644 index 000000000..e6bbf97d9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_6w.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_6wg.png b/games/devtest/mods/testnodes/textures/testnodes_6wg.png new file mode 100644 index 000000000..29ca933e0 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_6wg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_airlike.png b/games/devtest/mods/testnodes/textures/testnodes_airlike.png new file mode 100644 index 000000000..5a5664a2a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_airlike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_allfaces.png b/games/devtest/mods/testnodes/textures/testnodes_allfaces.png new file mode 100644 index 000000000..c0a7dc550 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_allfaces.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_allfaces_optional.png b/games/devtest/mods/testnodes/textures/testnodes_allfaces_optional.png new file mode 100644 index 000000000..1f6a17313 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_allfaces_optional.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha.png b/games/devtest/mods/testnodes/textures/testnodes_alpha.png new file mode 100644 index 000000000..157fa7386 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_alpha.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha128.png b/games/devtest/mods/testnodes/textures/testnodes_alpha128.png new file mode 100644 index 000000000..16babf6c7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_alpha128.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha191.png b/games/devtest/mods/testnodes/textures/testnodes_alpha191.png new file mode 100644 index 000000000..f165d2887 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_alpha191.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_alpha64.png b/games/devtest/mods/testnodes/textures/testnodes_alpha64.png new file mode 100644 index 000000000..c343c32c3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_alpha64.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_anim.png b/games/devtest/mods/testnodes/textures/testnodes_anim.png new file mode 100644 index 000000000..d321fe857 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_anim.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attached_bottom.png b/games/devtest/mods/testnodes/textures/testnodes_attached_bottom.png new file mode 100644 index 000000000..e01ae576f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attached_bottom.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attached_side.png b/games/devtest/mods/testnodes/textures/testnodes_attached_side.png new file mode 100644 index 000000000..9459cbb05 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attached_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attached_top.png b/games/devtest/mods/testnodes/textures/testnodes_attached_top.png new file mode 100644 index 000000000..0148b41e0 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attached_top.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attachedw_bottom.png b/games/devtest/mods/testnodes/textures/testnodes_attachedw_bottom.png new file mode 100644 index 000000000..488ad23a9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attachedw_bottom.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attachedw_side.png b/games/devtest/mods/testnodes/textures/testnodes_attachedw_side.png new file mode 100644 index 000000000..a02facbc7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attachedw_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_attachedw_top.png b/games/devtest/mods/testnodes/textures/testnodes_attachedw_top.png new file mode 100644 index 000000000..1f4fc7b85 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_attachedw_top.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_bouncy.png b/games/devtest/mods/testnodes/textures/testnodes_bouncy.png new file mode 100644 index 000000000..eabbbdfe4 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_bouncy.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_buildable_to.png b/games/devtest/mods/testnodes/textures/testnodes_buildable_to.png new file mode 100644 index 000000000..23b5e54d2 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_buildable_to.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_climbable_nojump_side.png b/games/devtest/mods/testnodes/textures/testnodes_climbable_nojump_side.png new file mode 100644 index 000000000..d5ca13033 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_climbable_nojump_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_climbable_side.png b/games/devtest/mods/testnodes/textures/testnodes_climbable_side.png new file mode 100644 index 000000000..c56ea90d7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_climbable_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_damage.png b/games/devtest/mods/testnodes/textures/testnodes_damage.png new file mode 100644 index 000000000..9de2ab5e8 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_damage.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_damage_neg.png b/games/devtest/mods/testnodes/textures/testnodes_damage_neg.png new file mode 100644 index 000000000..85811bc8e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_damage_neg.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_drowning.png b/games/devtest/mods/testnodes/textures/testnodes_drowning.png new file mode 100644 index 000000000..57ffc8fcf Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_drowning.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_fall_damage_minus.png b/games/devtest/mods/testnodes/textures/testnodes_fall_damage_minus.png new file mode 100644 index 000000000..88d3bdf58 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_fall_damage_minus.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_fall_damage_plus.png b/games/devtest/mods/testnodes/textures/testnodes_fall_damage_plus.png new file mode 100644 index 000000000..61fdec2e3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_fall_damage_plus.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_fencelike.png b/games/devtest/mods/testnodes/textures/testnodes_fencelike.png new file mode 100644 index 000000000..84dea1b7c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_fencelike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_firelike.png b/games/devtest/mods/testnodes/textures/testnodes_firelike.png new file mode 100644 index 000000000..ee59b0db1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_firelike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike.png new file mode 100644 index 000000000..cf3e35414 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike_detail.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike_detail.png new file mode 100644 index 000000000..30c9586e8 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike_detail.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed.png new file mode 100644 index 000000000..8a513f21c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed2.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed2.png new file mode 100644 index 000000000..4ea839c8b Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed_optional.png b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed_optional.png new file mode 100644 index 000000000..37de77dd1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslike_framed_optional.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_glasslikeliquid.png b/games/devtest/mods/testnodes/textures/testnodes_glasslikeliquid.png new file mode 100644 index 000000000..e1e96ffb9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_glasslikeliquid.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light.png b/games/devtest/mods/testnodes/textures/testnodes_light.png new file mode 100644 index 000000000..4ba0081c3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_1.png b/games/devtest/mods/testnodes/textures/testnodes_light_1.png new file mode 100644 index 000000000..57adf5a4a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_10.png b/games/devtest/mods/testnodes/textures/testnodes_light_10.png new file mode 100644 index 000000000..483834770 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_10.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_11.png b/games/devtest/mods/testnodes/textures/testnodes_light_11.png new file mode 100644 index 000000000..4c423d9b4 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_11.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_12.png b/games/devtest/mods/testnodes/textures/testnodes_light_12.png new file mode 100644 index 000000000..bc7946d09 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_12.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_13.png b/games/devtest/mods/testnodes/textures/testnodes_light_13.png new file mode 100644 index 000000000..0b63c84a6 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_13.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_14.png b/games/devtest/mods/testnodes/textures/testnodes_light_14.png new file mode 100644 index 000000000..a817bd394 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_14.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_2.png b/games/devtest/mods/testnodes/textures/testnodes_light_2.png new file mode 100644 index 000000000..852eaeff1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_3.png b/games/devtest/mods/testnodes/textures/testnodes_light_3.png new file mode 100644 index 000000000..79fc834cc Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_4.png b/games/devtest/mods/testnodes/textures/testnodes_light_4.png new file mode 100644 index 000000000..75f8c6136 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_5.png b/games/devtest/mods/testnodes/textures/testnodes_light_5.png new file mode 100644 index 000000000..b6eede0ae Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_6.png b/games/devtest/mods/testnodes/textures/testnodes_light_6.png new file mode 100644 index 000000000..ef54addec Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_7.png b/games/devtest/mods/testnodes/textures/testnodes_light_7.png new file mode 100644 index 000000000..4a885b0f6 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_7.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_8.png b/games/devtest/mods/testnodes/textures/testnodes_light_8.png new file mode 100644 index 000000000..b283301e3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_8.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_light_9.png b/games/devtest/mods/testnodes/textures/testnodes_light_9.png new file mode 100644 index 000000000..2aa902358 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_light_9.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_line_crossing.png b/games/devtest/mods/testnodes/textures/testnodes_line_crossing.png new file mode 100644 index 000000000..e566f2793 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_line_crossing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_line_curved.png b/games/devtest/mods/testnodes/textures/testnodes_line_curved.png new file mode 100644 index 000000000..ab9f8e720 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_line_curved.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_line_straight.png b/games/devtest/mods/testnodes/textures/testnodes_line_straight.png new file mode 100644 index 000000000..4f33d9c6d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_line_straight.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_line_t_junction.png b/games/devtest/mods/testnodes/textures/testnodes_line_t_junction.png new file mode 100644 index 000000000..5668f6ea3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_line_t_junction.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquid.png b/games/devtest/mods/testnodes/textures/testnodes_liquid.png new file mode 100644 index 000000000..98ab270c2 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquid.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing.png new file mode 100644 index 000000000..1736b89ba Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r0.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r0.png new file mode 100644 index 000000000..e8a61039d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r0.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r1.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r1.png new file mode 100644 index 000000000..b4e45b42f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r2.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r2.png new file mode 100644 index 000000000..e064b8f2d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r3.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r3.png new file mode 100644 index 000000000..bef773968 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r4.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r4.png new file mode 100644 index 000000000..de1001b2d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r5.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r5.png new file mode 100644 index 000000000..97b422e9a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r6.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r6.png new file mode 100644 index 000000000..4cd8e4e8e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r7.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r7.png new file mode 100644 index 000000000..711dd961c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r7.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r8.png b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r8.png new file mode 100644 index 000000000..9cf22b8ca Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidflowing_r8.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource.png new file mode 100644 index 000000000..b3f29b702 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r0.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r0.png new file mode 100644 index 000000000..da0a99623 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r0.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r1.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r1.png new file mode 100644 index 000000000..66bf2be8f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r2.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r2.png new file mode 100644 index 000000000..fc5f65cb6 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r3.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r3.png new file mode 100644 index 000000000..0f46e291e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r4.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r4.png new file mode 100644 index 000000000..0693a04d7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r5.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r5.png new file mode 100644 index 000000000..cc9d03992 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r6.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r6.png new file mode 100644 index 000000000..e276a07ae Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r7.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r7.png new file mode 100644 index 000000000..3534a4b15 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r7.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r8.png b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r8.png new file mode 100644 index 000000000..ee1a8b169 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_liquidsource_r8.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes.png b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes.png new file mode 100644 index 000000000..51b8e0025 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes2.png b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes2.png new file mode 100644 index 000000000..9ea65c1ec Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes3.png b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes3.png new file mode 100644 index 000000000..96bc55ac5 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes4.png b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes4.png new file mode 100644 index 000000000..fca33727d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_mesh_stripes4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_node.png b/games/devtest/mods/testnodes/textures/testnodes_node.png new file mode 100644 index 000000000..145099b3a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_node.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_node_falling.png b/games/devtest/mods/testnodes/textures/testnodes_node_falling.png new file mode 100644 index 000000000..44153185c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_node_falling.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_nodebox.png b/games/devtest/mods/testnodes/textures/testnodes_nodebox.png new file mode 100644 index 000000000..66e8dd663 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_nodebox.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_nojump_side.png b/games/devtest/mods/testnodes/textures/testnodes_nojump_side.png new file mode 100644 index 000000000..6a64cfff0 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_nojump_side.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_nojump_top.png b/games/devtest/mods/testnodes/textures/testnodes_nojump_top.png new file mode 100644 index 000000000..fe770838f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_nojump_top.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal.png b/games/devtest/mods/testnodes/textures/testnodes_normal.png new file mode 100644 index 000000000..a1acfd9fd Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal1.png b/games/devtest/mods/testnodes/textures/testnodes_normal1.png new file mode 100644 index 000000000..edaba77e4 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal1.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal2.png b/games/devtest/mods/testnodes/textures/testnodes_normal2.png new file mode 100644 index 000000000..0080a9ee7 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal2.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal3.png b/games/devtest/mods/testnodes/textures/testnodes_normal3.png new file mode 100644 index 000000000..0426ab216 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal3.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal4.png b/games/devtest/mods/testnodes/textures/testnodes_normal4.png new file mode 100644 index 000000000..0d1922eb6 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal4.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal5.png b/games/devtest/mods/testnodes/textures/testnodes_normal5.png new file mode 100644 index 000000000..0b7dcd2da Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal5.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_normal6.png b/games/devtest/mods/testnodes/textures/testnodes_normal6.png new file mode 100644 index 000000000..f34a67d71 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_normal6.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_palette_facedir.png b/games/devtest/mods/testnodes/textures/testnodes_palette_facedir.png new file mode 100644 index 000000000..8cf47bbbe Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_palette_facedir.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_palette_full.png b/games/devtest/mods/testnodes/textures/testnodes_palette_full.png new file mode 100644 index 000000000..e0a5f8b34 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_palette_full.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_palette_wallmounted.png b/games/devtest/mods/testnodes/textures/testnodes_palette_wallmounted.png new file mode 100644 index 000000000..682f3ac84 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_palette_wallmounted.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike.png new file mode 100644 index 000000000..cc464444d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_degrotate.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_degrotate.png new file mode 100644 index 000000000..01c81da8e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_degrotate.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_leveled.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_leveled.png new file mode 100644 index 000000000..53504dbcd Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_leveled.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_meshoptions.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_meshoptions.png new file mode 100644 index 000000000..d504d459f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_meshoptions.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted.png new file mode 100644 index 000000000..79cf2125e Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base.png new file mode 100644 index 000000000..b9ee9e5be Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png new file mode 100644 index 000000000..85311cb2c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png new file mode 100644 index 000000000..bc602bafe Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png new file mode 100644 index 000000000..d10002375 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png new file mode 100644 index 000000000..527817bc1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png new file mode 100644 index 000000000..45e75bdd3 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png new file mode 100644 index 000000000..8954b2c34 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png new file mode 100644 index 000000000..a782d4874 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png new file mode 100644 index 000000000..112a0540f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_waving.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_waving.png new file mode 100644 index 000000000..b584a8dc9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_plantlike_waving.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail2_crossing.png b/games/devtest/mods/testnodes/textures/testnodes_rail2_crossing.png new file mode 100644 index 000000000..530bbba7a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail2_crossing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail2_curved.png b/games/devtest/mods/testnodes/textures/testnodes_rail2_curved.png new file mode 100644 index 000000000..4ed1ca00f Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail2_curved.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail2_straight.png b/games/devtest/mods/testnodes/textures/testnodes_rail2_straight.png new file mode 100644 index 000000000..8749330d8 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail2_straight.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail2_t_junction.png b/games/devtest/mods/testnodes/textures/testnodes_rail2_t_junction.png new file mode 100644 index 000000000..0517f6570 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail2_t_junction.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail_crossing.png b/games/devtest/mods/testnodes/textures/testnodes_rail_crossing.png new file mode 100644 index 000000000..3916ce1ef Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail_crossing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail_curved.png b/games/devtest/mods/testnodes/textures/testnodes_rail_curved.png new file mode 100644 index 000000000..e44419848 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail_curved.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail_straight.png b/games/devtest/mods/testnodes/textures/testnodes_rail_straight.png new file mode 100644 index 000000000..872d04fb9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail_straight.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_rail_t_junction.png b/games/devtest/mods/testnodes/textures/testnodes_rail_t_junction.png new file mode 100644 index 000000000..7e4af5182 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_rail_t_junction.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_signlike.png b/games/devtest/mods/testnodes/textures/testnodes_signlike.png new file mode 100644 index 000000000..33ffcba6c Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_signlike.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_slippery.png b/games/devtest/mods/testnodes/textures/testnodes_slippery.png new file mode 100644 index 000000000..b990468a1 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_slippery.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_street_crossing.png b/games/devtest/mods/testnodes/textures/testnodes_street_crossing.png new file mode 100644 index 000000000..d6e35ad7a Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_street_crossing.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_street_curved.png b/games/devtest/mods/testnodes/textures/testnodes_street_curved.png new file mode 100644 index 000000000..251b7fb71 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_street_curved.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_street_straight.png b/games/devtest/mods/testnodes/textures/testnodes_street_straight.png new file mode 100644 index 000000000..639e24b93 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_street_straight.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_street_t_junction.png b/games/devtest/mods/testnodes/textures/testnodes_street_t_junction.png new file mode 100644 index 000000000..713621e06 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_street_t_junction.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_sunlight_filter.png b/games/devtest/mods/testnodes/textures/testnodes_sunlight_filter.png new file mode 100644 index 000000000..b38ea4072 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_sunlight_filter.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_torchlike_ceiling.png b/games/devtest/mods/testnodes/textures/testnodes_torchlike_ceiling.png new file mode 100644 index 000000000..5d9862cc9 Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_torchlike_ceiling.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_torchlike_floor.png b/games/devtest/mods/testnodes/textures/testnodes_torchlike_floor.png new file mode 100644 index 000000000..adf1e002d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_torchlike_floor.png differ diff --git a/games/devtest/mods/testnodes/textures/testnodes_torchlike_wall.png b/games/devtest/mods/testnodes/textures/testnodes_torchlike_wall.png new file mode 100644 index 000000000..cb442b22d Binary files /dev/null and b/games/devtest/mods/testnodes/textures/testnodes_torchlike_wall.png differ diff --git a/games/devtest/mods/testpathfinder/README.md b/games/devtest/mods/testpathfinder/README.md new file mode 100644 index 000000000..2b9d46e70 --- /dev/null +++ b/games/devtest/mods/testpathfinder/README.md @@ -0,0 +1,15 @@ +# Pathfinder Tester + +Usage: + +Use the Pathfinder Tester tool (`testpathfinder:testpathfinder`). +Here's how it works: + +* Place on node: Set destination position +* Punch: Find path +* Sneak+punch: Select pathfinding algorithm + +Information will be shown in chat. If a path was found, all waypoints +will be shown for a few seconds. + +See `init.lua` for config variables. diff --git a/games/devtest/mods/testpathfinder/init.lua b/games/devtest/mods/testpathfinder/init.lua new file mode 100644 index 000000000..f94848236 --- /dev/null +++ b/games/devtest/mods/testpathfinder/init.lua @@ -0,0 +1,132 @@ +local S = minetest.get_translator("testpathfinder") + +-- Config parameters + +-- Maximum direct distance between start and end +local MAX_DIRECT_DISTANCE = 64 +-- Maximum search distance +local MAX_SEARCH_DISTANCE = 32 +-- Maximum permitted jump height +local MAX_JUMP = 1 +-- Maximum permitted drop height +local MAX_DROP = 5 +-- If true, mod won't refuse to run pathfinder even at long distances +local IGNORE_MAX_DISTANCE_SAFEGUARD = false + +-- End of config parameters + +local timer = 0 +local algorithms = { + "A*_noprefetch", + "A*", + "Dijkstra", +} + +local function find_path_for_player(player, itemstack) + local meta = itemstack:get_meta() + if not meta then + return + end + local x = meta:get_int("pos_x") + local y = meta:get_int("pos_y") + local z = meta:get_int("pos_z") + local algo = meta:get_int("algorithm") + if x and y and z then + local pos2 = {x=x, y=y, z=z} + algo = algorithms[algo+1] + local pos1 = vector.round(player:get_pos()) + -- Don't bother calling pathfinder for high distance to avoid freezing + if (not IGNORE_MAX_DISTANCE_SAFEGUARD) and (vector.distance(pos1, pos2) > MAX_DIRECT_DISTANCE) then + minetest.chat_send_player(player:get_player_name(), S("Destination too far away! Set a destination (via placing) within a distance of @1 and try again!", MAX_DIRECT_DISTANCE)) + return + end + local str = S("Path from @1 to @2:", + minetest.pos_to_string(pos1), + minetest.pos_to_string(pos2)) + + minetest.chat_send_player(player:get_player_name(), str) + local time_start = minetest.get_us_time() + local path = minetest.find_path(pos1, pos2, MAX_SEARCH_DISTANCE, MAX_JUMP, MAX_DROP, algo) + local time_end = minetest.get_us_time() + local time_diff = time_end - time_start + str = "" + if not path then + minetest.chat_send_player(player:get_player_name(), S("No path!")) + minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000)) + return + end + for s=1, #path do + str = str .. minetest.pos_to_string(path[s]) .. "\n" + local t + if s == #path then + t = "testpathfinder_waypoint_end.png" + elseif s == 1 then + t = "testpathfinder_waypoint_start.png" + else + local c = math.floor(((#path-s)/#path)*255) + t = string.format("testpathfinder_waypoint.png^[multiply:#%02x%02x00", 0xFF-c, c) + end + minetest.add_particle({ + pos = path[s], + expirationtime = 5 + 0.2 * s, + playername = player:get_player_name(), + glow = minetest.LIGHT_MAX, + texture = t, + size = 3, + }) + end + minetest.chat_send_player(player:get_player_name(), str) + minetest.chat_send_player(player:get_player_name(), S("Path length: @1", #path)) + minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000)) + end +end + +local function set_destination(itemstack, user, pointed_thing) + if not (user and user:is_player()) then + return + end + local name = user:get_player_name() + local obj + local meta = itemstack:get_meta() + if pointed_thing.type == "node" then + local pos = pointed_thing.above + meta:set_int("pos_x", pos.x) + meta:set_int("pos_y", pos.y) + meta:set_int("pos_z", pos.z) + minetest.chat_send_player(user:get_player_name(), S("Destination set to @1", minetest.pos_to_string(pos))) + return itemstack + end +end + +local function find_path_or_set_algorithm(itemstack, user, pointed_thing) + if not (user and user:is_player()) then + return + end + local ctrl = user:get_player_control() + -- No sneak: Find path + if not ctrl.sneak then + find_path_for_player(user, itemstack) + else + -- Sneak: Set algorithm + local meta = itemstack:get_meta() + local algo = meta:get_int("algorithm") + algo = (algo + 1) % #algorithms + meta:set_int("algorithm", algo) + minetest.chat_send_player(user:get_player_name(), S("Algorithm: @1", algorithms[algo+1])) + return itemstack + end +end + +-- Punch: Find path +-- Sneak+punch: Select pathfinding algorithm +-- Place: Select destination node +minetest.register_tool("testpathfinder:testpathfinder", { + description = S("Pathfinder Tester"), + inventory_image = "testpathfinder_testpathfinder.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = find_path_or_set_algorithm, + on_secondary_use = set_destination, + on_place = set_destination, +}) + + diff --git a/games/devtest/mods/testpathfinder/mod.conf b/games/devtest/mods/testpathfinder/mod.conf new file mode 100644 index 000000000..e6034ae8c --- /dev/null +++ b/games/devtest/mods/testpathfinder/mod.conf @@ -0,0 +1,2 @@ +name = testpathfinder +description = Tool to test Minetest's pathfinder function diff --git a/games/devtest/mods/testpathfinder/textures/testpathfinder_testpathfinder.png b/games/devtest/mods/testpathfinder/textures/testpathfinder_testpathfinder.png new file mode 100644 index 000000000..37eef0565 Binary files /dev/null and b/games/devtest/mods/testpathfinder/textures/testpathfinder_testpathfinder.png differ diff --git a/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint.png b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint.png new file mode 100644 index 000000000..661dcf906 Binary files /dev/null and b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint.png differ diff --git a/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_end.png b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_end.png new file mode 100644 index 000000000..41a1cc549 Binary files /dev/null and b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_end.png differ diff --git a/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_start.png b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_start.png new file mode 100644 index 000000000..a22e31c3b Binary files /dev/null and b/games/devtest/mods/testpathfinder/textures/testpathfinder_waypoint_start.png differ diff --git a/games/devtest/mods/testtools/README.md b/games/devtest/mods/testtools/README.md new file mode 100644 index 000000000..9cfe29ea4 --- /dev/null +++ b/games/devtest/mods/testtools/README.md @@ -0,0 +1,99 @@ +# Test Tools readme + +Test Tools is a mod for developers that adds a bunch of tools to directly manipulate nodes and entities. This is great for quickly testing out stuff. + +Here's the list of tools: + +## Remover +Removes nodes and non-player entities that you punch. + +## Node Setter +Replace a node with another one. + +First, punch a node you want to remember. +Then rightclick any other node to replace it with the node you remembered. + +If you rightclick while pointing nothing, you can manually enter the node and param2. + +## Param2 Tool +Change the value param2 of nodes. + +* Punch: Add 1 to param2 +* Sneak+Punch: Add 8 to param2 +* Place: Subtract 1 from param2 +* Sneak+Place: Subtract 8 from param2 + +Note: Use the debug screen (F5) to see the param2 of the pointed node. + +## Falling Node Tool +Turns nodes into falling nodes. + +Usage: + +* Punch node: Make it fall +* Place: Try to teleport up to 2 units upwards, then make it fall + +## Entity Rotator +Changes the entity rotation (with `set_rotation`). + +Usage: + +* Punch entity: Rotate yaw +* Punch entity while holding down “Sneak” key: Rotate pitch +* Punch entity while holding down “Special” key (aka “Aux”): Rotate roll + +Each usage rotates the entity by 22.5°. + +## Entity Spawner +Spawns entities. + +Usage: + +* Punch to select entity or spawn one directly +* Place to place selected entity + +## Object Property Editor +Edits properties of objects. + +Usage: + +* Punch object to open a formspec that allows you to view and edit properties +* Punch air to edit properties of your own player object + +To edit a property, select it in the list, enter a new value (in Lua syntax) +and hit “Submit”. + +## Object Attacher +Allows you to attach an object to another one. + +Basic usage: +* First select the parent object, then the child object that should be attached +* Selecting an object is done by punching it +* Sneak+punch to detach selected object +* If you punch air, you select yourself + +Configuration: +* Place: Increase attachment Y position +* Sneak+place: decrease attachment Y position +* Aux+place: Increase attachment X rotation +* Aux+Sneak+Rightclick: Decrease attachment X rotation + +Hint: To detach all objects nearby you (including on yourself), use the +`/detach` server command. + +## Object Mover +Move an object by a given distance. + +Usage: +* Punch object into the direction you want to move it +* Sneak+punch: Move object towards you +* Place: Increase move distance +* Sneak+place: Decrease move distance + +## Entity Visual Scaler +Change visual size of entities + +Usage: + +* Punch entity to increase visual size +* Sneak+punch entity to decrease visual size diff --git a/games/devtest/mods/testtools/init.lua b/games/devtest/mods/testtools/init.lua new file mode 100644 index 000000000..a63c98377 --- /dev/null +++ b/games/devtest/mods/testtools/init.lua @@ -0,0 +1,691 @@ +local S = minetest.get_translator("testtools") +local F = minetest.formspec_escape + +-- TODO: Add a Node Metadata tool + +-- Param 2 Tool: Set param2 value of tools +-- Punch: +1 +-- Punch+Shift: +8 +-- Place: -1 +-- Place+Shift: -8 +minetest.register_tool("testtools:param2tool", { + description = S("Param2 Tool"), + inventory_image = "testtools_param2tool.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type ~= "node" or (not pos) then + return + end + local add = 1 + if user then + local ctrl = user:get_player_control() + if ctrl.sneak then + add = 8 + end + end + local node = minetest.get_node(pos) + node.param2 = node.param2 + add + minetest.swap_node(pos, node) + end, + on_place = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type ~= "node" or (not pos) then + return + end + local add = -1 + if user then + local ctrl = user:get_player_control() + if ctrl.sneak then + add = -8 + end + end + local node = minetest.get_node(pos) + node.param2 = node.param2 + add + minetest.swap_node(pos, node) + end, +}) + +minetest.register_tool("testtools:node_setter", { + description = S("Node Setter"), + inventory_image = "testtools_node_setter.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type == "nothing" then + local meta = itemstack:get_meta() + meta:set_string("node", "air") + meta:set_int("node_param2", 0) + if user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", "air", 0)) + end + return itemstack + elseif pointed_thing.type ~= "node" or (not pos) then + return + end + local node = minetest.get_node(pos) + local meta = itemstack:get_meta() + meta:set_string("node", node.name) + meta:set_int("node_param2", node.param2) + if user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", node.name, node.param2)) + end + return itemstack + end, + on_secondary_use = function(itemstack, user, pointed_thing) + local meta = itemstack:get_meta() + local nodename = meta:get_string("node") or "" + local param2 = meta:get_int("node_param2") or 0 + + minetest.show_formspec(user:get_player_name(), "testtools:node_setter", + "size[4,4]".. + "field[0.5,1;3,1;nodename;"..F(S("Node name (itemstring):"))..";"..F(nodename).."]".. + "field[0.5,2;3,1;param2;"..F(S("param2:"))..";"..F(tostring(param2)).."]".. + "button_exit[0.5,3;3,1;submit;"..F(S("Submit")).."]" + ) + end, + on_place = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + local meta = itemstack:get_meta() + local nodename = meta:get_string("node") + if nodename == "" and user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Punch a node first!")) + return + end + local param2 = meta:get_int("node_param2") + if not param2 then + param2 = 0 + end + local node = { name = nodename, param2 = param2 } + if not minetest.registered_nodes[nodename] then + minetest.chat_send_player(user:get_player_name(), S("Cannot set unknown node: @1", nodename)) + return + end + minetest.set_node(pos, node) + end, +}) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname == "testtools:node_setter" then + local playername = player:get_player_name() + local witem = player:get_wielded_item() + if witem:get_name() == "testtools:node_setter" then + if fields.nodename and fields.param2 then + local param2 = tonumber(fields.param2) + if not param2 then + return + end + local meta = witem:get_meta() + meta:set_string("node", fields.nodename) + meta:set_int("node_param2", param2) + player:set_wielded_item(witem) + end + end + end +end) + +minetest.register_tool("testtools:remover", { + description = S("Remover"), + inventory_image = "testtools_remover.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type == "node" and pos ~= nil then + minetest.remove_node(pos) + elseif pointed_thing.type == "object" then + local obj = pointed_thing.ref + if not obj:is_player() then + obj:remove() + end + end + end, +}) + +minetest.register_tool("testtools:falling_node_tool", { + description = S("Falling Node Tool"), + inventory_image = "testtools_falling_node_tool.png", + groups = { testtool = 1, disable_repair = 1 }, + on_place = function(itemstack, user, pointed_thing) + -- Teleport node 1-2 units upwards (if possible) and make it fall + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type ~= "node" or (not pos) then + return + end + local ok = false + local highest + for i=1,2 do + local above = {x=pos.x,y=pos.y+i,z=pos.z} + local n2 = minetest.get_node(above) + local def2 = minetest.registered_nodes[n2.name] + if def2 and (not def2.walkable) then + highest = above + else + break + end + end + if highest then + local node = minetest.get_node(pos) + local metatable = minetest.get_meta(pos):to_table() + minetest.remove_node(pos) + minetest.set_node(highest, node) + local meta_highest = minetest.get_meta(highest) + meta_highest:from_table(metatable) + ok = minetest.spawn_falling_node(highest) + else + ok = minetest.spawn_falling_node(pos) + end + if not ok and user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!")) + end + end, + on_use = function(itemstack, user, pointed_thing) + local pos = minetest.get_pointed_thing_position(pointed_thing) + if pointed_thing.type ~= "node" or (not pos) then + return + end + local ok = minetest.spawn_falling_node(pos) + if not ok and user and user:is_player() then + minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!")) + end + end, +}) + +minetest.register_tool("testtools:rotator", { + description = S("Entity Rotator"), + inventory_image = "testtools_entity_rotator.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "object" then + return + end + local obj = pointed_thing.ref + if obj:is_player() then + -- No player rotation + return + else + local axis = "y" + if user and user:is_player() then + local ctrl = user:get_player_control() + if ctrl.sneak then + axis = "x" + elseif ctrl.aux1 then + axis = "z" + end + end + local rot = obj:get_rotation() + rot[axis] = rot[axis] + math.pi/8 + if rot[axis] > math.pi*2 then + rot[axis] = rot[axis] - math.pi*2 + end + obj:set_rotation(rot) + end + end, +}) + +local mover_config = function(itemstack, user, pointed_thing) + if not (user and user:is_player()) then + return + end + local name = user:get_player_name() + local ctrl = user:get_player_control() + local meta = itemstack:get_meta() + local dist = 1.0 + if meta:contains("distance") then + dist = meta:get_int("distance") + end + if ctrl.sneak then + dist = dist - 1 + else + dist = dist + 1 + end + meta:set_int("distance", dist) + minetest.chat_send_player(user:get_player_name(), S("distance=@1/10", dist*2)) + return itemstack +end + +minetest.register_tool("testtools:object_mover", { + description = S("Object Mover"), + inventory_image = "testtools_object_mover.png", + groups = { testtool = 1, disable_repair = 1 }, + on_place = mover_config, + on_secondary_use = mover_config, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "object" then + return + end + local obj = pointed_thing.ref + if not (user and user:is_player()) then + return + end + local yaw = user:get_look_horizontal() + local dir = minetest.yaw_to_dir(yaw) + local pos = obj:get_pos() + local pitch = user:get_look_vertical() + if pitch > 0.25 * math.pi then + dir.y = -1 + dir.x = 0 + dir.z = 0 + elseif pitch < -0.25 * math.pi then + dir.y = 1 + dir.x = 0 + dir.z = 0 + end + local ctrl = user:get_player_control() + if ctrl.sneak then + dir = vector.multiply(dir, -1) + end + local meta = itemstack:get_meta() + if meta:contains("distance") then + local dist = meta:get_int("distance") + dir = vector.multiply(dir, dist*0.2) + end + pos = vector.add(pos, dir) + obj:set_pos(pos) + end, +}) + + + +minetest.register_tool("testtools:entity_scaler", { + description = S("Entity Visual Scaler"), + inventory_image = "testtools_entity_scaler.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "object" then + return + end + local obj = pointed_thing.ref + if obj:is_player() then + -- No player scaling + return + else + local diff = 0.1 + if user and user:is_player() then + local ctrl = user:get_player_control() + if ctrl.sneak then + diff = -0.1 + end + end + local prop = obj:get_properties() + if not prop.visual_size then + prop.visual_size = { x=1, y=1, z=1 } + else + prop.visual_size = { x=prop.visual_size.x+diff, y=prop.visual_size.y+diff, z=prop.visual_size.z+diff } + if prop.visual_size.x <= 0.1 then + prop.visual_size.x = 0.1 + end + if prop.visual_size.y <= 0.1 then + prop.visual_size.y = 0.1 + end + if prop.visual_size.z <= 0.1 then + prop.visual_size.z = 0.1 + end + end + obj:set_properties(prop) + end + end, +}) + +local selections = {} +local entity_list +local function get_entity_list() + if entity_list then + return entity_list + end + local ents = minetest.registered_entities + local list = {} + for k,_ in pairs(ents) do + table.insert(list, k) + end + table.sort(list) + entity_list = list + return entity_list +end +minetest.register_tool("testtools:entity_spawner", { + description = S("Entity Spawner"), + inventory_image = "testtools_entity_spawner.png", + groups = { testtool = 1, disable_repair = 1 }, + on_place = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + if selections[name] and pointed_thing.type == "node" then + local pos = pointed_thing.above + minetest.add_entity(pos, get_entity_list()[selections[name]]) + end + end, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type == "object" then + return + end + if user and user:is_player() then + local list = table.concat(get_entity_list(), ",") + local name = user:get_player_name() + local sel = selections[name] or "" + minetest.show_formspec(name, "testtools:entity_list", + "size[9,9]".. + "textlist[0,0;9,8;entity_list;"..list..";"..sel..";false]".. + "button[0,8;4,1;spawn;Spawn entity]" + ) + end + end, +}) + +local function prop_to_string(property) + if type(property) == "string" then + return "\"" .. property .. "\"" + elseif type(property) == "table" then + return tostring(dump(property)):gsub("\n", "") + else + return tostring(property) + end +end + +local property_formspec_data = {} +local property_formspec_index = {} +local selected_objects = {} +local function get_object_properties_form(obj, playername) + if not playername then return "" end + local props = obj:get_properties() + local str = "" + property_formspec_data[playername] = {} + local proplist = {} + for k,_ in pairs(props) do + table.insert(proplist, k) + end + table.sort(proplist) + for p=1, #proplist do + local k = proplist[p] + local v = props[k] + local newline = "" + newline = k .. " = " + newline = newline .. prop_to_string(v) + str = str .. F(newline) + if p < #proplist then + str = str .. "," + end + table.insert(property_formspec_data[playername], k) + end + return str +end + +local editor_formspec_selindex = {} + +local editor_formspec = function(playername, obj, value, sel) + if not value then + value = "" + end + if not sel then + sel = "" + end + local list = get_object_properties_form(obj, playername) + local title + if obj:is_player() then + title = S("Object properties of player “@1”", obj:get_player_name()) + else + local ent = obj:get_luaentity() + title = S("Object properties of @1", ent.name) + end + minetest.show_formspec(playername, "testtools:object_editor", + "size[9,9]".. + "label[0,0;"..F(title).."]".. + "textlist[0,0.5;9,7.5;object_props;"..list..";"..sel..";false]".. + "field[0.2,8.75;8,1;value;"..F(S("Value"))..";"..F(value).."]".. + "button[8,8.5;1,1;submit;"..F(S("Submit")).."]" + ) +end + +minetest.register_tool("testtools:object_editor", { + description = S("Object Property Editor"), + inventory_image = "testtools_object_editor.png", + groups = { testtool = 1, disable_repair = 1 }, + on_use = function(itemstack, user, pointed_thing) + if user and user:is_player() then + local name = user:get_player_name() + + if pointed_thing.type == "object" then + selected_objects[name] = pointed_thing.ref + elseif pointed_thing.type == "nothing" then + -- Use on yourself if pointing nothing + selected_objects[name] = user + else + -- Unsupported pointed thing + return + end + + local sel = editor_formspec_selindex[name] + local val + if selected_objects[name] and selected_objects[name]:get_properties() then + local props = selected_objects[name]:get_properties() + local keys = property_formspec_data[name] + if property_formspec_index[name] and props then + local key = keys[property_formspec_index[name]] + val = prop_to_string(props[key]) + end + end + + editor_formspec(name, selected_objects[name], val, sel) + end + end, +}) + +local ent_parent = {} +local ent_child = {} +local DEFAULT_ATTACH_OFFSET_Y = 11 + +local attacher_config = function(itemstack, user, pointed_thing) + if not (user and user:is_player()) then + return + end + if pointed_thing.type == "object" then + return + end + local name = user:get_player_name() + local ctrl = user:get_player_control() + local meta = itemstack:get_meta() + if ctrl.aux1 then + local rot_x = meta:get_float("rot_x") + if ctrl.sneak then + rot_x = rot_x - math.pi/8 + else + rot_x = rot_x + math.pi/8 + end + if rot_x > 6.2 then + rot_x = 0 + elseif rot_x < 0 then + rot_x = math.pi * (15/8) + end + minetest.chat_send_player(name, S("rotation=@1", minetest.pos_to_string({x=rot_x,y=0,z=0}))) + meta:set_float("rot_x", rot_x) + else + local pos_y + if meta:contains("pos_y") then + pos_y = meta:get_int("pos_y") + else + pos_y = DEFAULT_ATTACH_OFFSET_Y + end + if ctrl.sneak then + pos_y = pos_y - 1 + else + pos_y = pos_y + 1 + end + minetest.chat_send_player(name, S("position=@1", minetest.pos_to_string({x=0,y=pos_y,z=0}))) + meta:set_int("pos_y", pos_y) + end + return itemstack +end + +minetest.register_tool("testtools:object_attacher", { + description = S("Object Attacher"), + inventory_image = "testtools_object_attacher.png", + groups = { testtool = 1, disable_repair = 1 }, + on_place = attacher_config, + on_secondary_use = attacher_config, + on_use = function(itemstack, user, pointed_thing) + if user and user:is_player() then + local name = user:get_player_name() + local selected_object + if pointed_thing.type == "object" then + selected_object = pointed_thing.ref + elseif pointed_thing.type == "nothing" then + selected_object = user + else + return + end + local ctrl = user:get_player_control() + if ctrl.sneak then + if selected_object:get_attach() then + selected_object:set_detach() + minetest.chat_send_player(name, S("Object detached!")) + else + minetest.chat_send_player(name, S("Object is not attached!")) + end + return + end + local parent = ent_parent[name] + local child = ent_child[name] + local ename = S("") + if not parent then + parent = selected_object + ent_parent[name] = parent + elseif not child then + child = selected_object + ent_child[name] = child + end + local entity = selected_object:get_luaentity() + if entity then + ename = entity.name + elseif selected_object:is_player() then + ename = selected_object:get_player_name() + end + if selected_object == parent then + minetest.chat_send_player(name, S("Parent object selected: @1", ename)) + elseif selected_object == child then + minetest.chat_send_player(name, S("Child object selected: @1", ename)) + end + if parent and child then + if parent == child then + minetest.chat_send_player(name, S("Can't attach an object to itself!")) + ent_parent[name] = nil + ent_child[name] = nil + return + end + local meta = itemstack:get_meta() + local y + if meta:contains("pos_y") then + y = meta:get_int("pos_y") + else + y = DEFAULT_ATTACH_OFFSET_Y + end + local rx = meta:get_float("rot_x") or 0 + local offset = {x=0,y=y,z=0} + local angle = {x=rx,y=0,z=0} + child:set_attach(parent, "", offset, angle) + local check_parent = child:get_attach() + if check_parent then + minetest.chat_send_player(name, S("Object attached! position=@1, rotation=@2", + minetest.pos_to_string(offset), minetest.pos_to_string(angle))) + else + minetest.chat_send_player(name, S("Attachment failed!")) + end + ent_parent[name] = nil + ent_child[name] = nil + end + end + end, +}) + +-- Use loadstring to parse param as a Lua value +local function use_loadstring(param, player) + -- For security reasons, require 'server' priv, just in case + -- someone is actually crazy enough to run this on a public server. + local privs = minetest.get_player_privs(player:get_player_name()) + if not privs.server then + return false, "You need 'server' privilege to change object properties!" + end + if not param then + return false, "Failed: parameter is nil" + end + --[[ DANGER ZONE ]] + -- Interpret string as Lua value + local func, errormsg = loadstring("return (" .. param .. ")") + if not func then + return false, "Failed: " .. errormsg + end + + -- Apply sandbox here using setfenv + setfenv(func, {}) + + -- Run it + local good, errOrResult = pcall(func) + if not good then + -- A Lua error was thrown + return false, "Failed: " .. errOrResult + end + + -- errOrResult will be the value + return true, errOrResult +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if not (player and player:is_player()) then + return + end + if formname == "testtools:entity_list" then + local name = player:get_player_name() + if fields.entity_list then + local expl = minetest.explode_textlist_event(fields.entity_list) + if expl.type == "DCL" then + local pos = vector.add(player:get_pos(), {x=0,y=1,z=0}) + selections[name] = expl.index + minetest.add_entity(pos, get_entity_list()[expl.index]) + return + elseif expl.type == "CHG" then + selections[name] = expl.index + return + end + elseif fields.spawn and selections[name] then + local pos = vector.add(player:get_pos(), {x=0,y=1,z=0}) + minetest.add_entity(pos, get_entity_list()[selections[name]]) + return + end + elseif formname == "testtools:object_editor" then + local name = player:get_player_name() + if fields.object_props then + local expl = minetest.explode_textlist_event(fields.object_props) + if expl.type == "DCL" or expl.type == "CHG" then + property_formspec_index[name] = expl.index + + local props = selected_objects[name]:get_properties() + local keys = property_formspec_data[name] + if (not property_formspec_index[name]) or (not props) then + return + end + local key = keys[property_formspec_index[name]] + editor_formspec_selindex[name] = expl.index + editor_formspec(name, selected_objects[name], prop_to_string(props[key]), expl.index) + return + end + end + if fields.submit then + local props = selected_objects[name]:get_properties() + local keys = property_formspec_data[name] + if (not property_formspec_index[name]) or (not props) then + return + end + local key = keys[property_formspec_index[name]] + if not key then + return + end + local success, str = use_loadstring(fields.value, player) + if success then + props[key] = str + else + minetest.chat_send_player(name, str) + return + end + selected_objects[name]:set_properties(props) + local sel = editor_formspec_selindex[name] + editor_formspec(name, selected_objects[name], prop_to_string(props[key]), sel) + return + end + end +end) diff --git a/games/devtest/mods/testtools/mod.conf b/games/devtest/mods/testtools/mod.conf new file mode 100644 index 000000000..cde1b2685 --- /dev/null +++ b/games/devtest/mods/testtools/mod.conf @@ -0,0 +1,2 @@ +name = testtools +description = Some tools to directly manipulate nodes and entities. Great for development and testing diff --git a/games/devtest/mods/testtools/textures/testtools_entity_rotator.png b/games/devtest/mods/testtools/textures/testtools_entity_rotator.png new file mode 100644 index 000000000..17ebb2d35 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_entity_rotator.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_entity_scaler.png b/games/devtest/mods/testtools/textures/testtools_entity_scaler.png new file mode 100644 index 000000000..4909c25b0 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_entity_scaler.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_entity_spawner.png b/games/devtest/mods/testtools/textures/testtools_entity_spawner.png new file mode 100644 index 000000000..6199e0145 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_entity_spawner.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_falling_node_tool.png b/games/devtest/mods/testtools/textures/testtools_falling_node_tool.png new file mode 100644 index 000000000..30099a7ef Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_falling_node_tool.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_node_setter.png b/games/devtest/mods/testtools/textures/testtools_node_setter.png new file mode 100644 index 000000000..8599438de Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_node_setter.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_object_attacher.png b/games/devtest/mods/testtools/textures/testtools_object_attacher.png new file mode 100644 index 000000000..4d9bf6fd1 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_object_attacher.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_object_editor.png b/games/devtest/mods/testtools/textures/testtools_object_editor.png new file mode 100644 index 000000000..d1ce9cecd Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_object_editor.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_object_mover.png b/games/devtest/mods/testtools/textures/testtools_object_mover.png new file mode 100644 index 000000000..8b14e9fb2 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_object_mover.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_param2tool.png b/games/devtest/mods/testtools/textures/testtools_param2tool.png new file mode 100644 index 000000000..dbc663575 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_param2tool.png differ diff --git a/games/devtest/mods/testtools/textures/testtools_remover.png b/games/devtest/mods/testtools/textures/testtools_remover.png new file mode 100644 index 000000000..73f14cd54 Binary files /dev/null and b/games/devtest/mods/testtools/textures/testtools_remover.png differ diff --git a/games/devtest/mods/tiled/init.lua b/games/devtest/mods/tiled/init.lua new file mode 100644 index 000000000..68ead8e3a --- /dev/null +++ b/games/devtest/mods/tiled/init.lua @@ -0,0 +1,33 @@ +minetest.register_node("tiled:tiled", { + description = "Tiled Node (world-aligned)", + tiles = {{ + name = "tiled_tiled.png", + align_style = "world", + scale = 8, + }}, + groups = {cracky=3}, +}) + +minetest.register_node("tiled:tiled_n", { + description = "Tiled Node (node-aligned)", + tiles = {{ + name = "tiled_tiled.png", + align_style = "node", + scale = 8, + }}, + groups = {cracky=3}, +}) + +stairs.register_stair_and_slab("tiled_n", "tiled:tiled", + {cracky=3}, + {{name="tiled_tiled.png", align_style="node", scale=8}}, + "Tiled Stair (node-aligned)", + "Tiled Slab (node-aligned)") + +stairs.register_stair_and_slab("tiled", "tiled:tiled", + {cracky=3}, + {{name="tiled_tiled.png", align_style="world", scale=8}}, + "Tiled Stair (world-aligned)", + "Tiled Slab (world-aligned)") + + diff --git a/games/devtest/mods/tiled/mod.conf b/games/devtest/mods/tiled/mod.conf new file mode 100644 index 000000000..78b19f93b --- /dev/null +++ b/games/devtest/mods/tiled/mod.conf @@ -0,0 +1,3 @@ +name = tiled +description = Add nodes with a special texture that spans multiple nodes (aka "world-aligned") +depends = stairs diff --git a/games/devtest/mods/tiled/textures/tiled_tiled.png b/games/devtest/mods/tiled/textures/tiled_tiled.png new file mode 100644 index 000000000..363a26487 Binary files /dev/null and b/games/devtest/mods/tiled/textures/tiled_tiled.png differ diff --git a/games/devtest/mods/unittests/crafting.lua b/games/devtest/mods/unittests/crafting.lua new file mode 100644 index 000000000..eff13ce09 --- /dev/null +++ b/games/devtest/mods/unittests/crafting.lua @@ -0,0 +1,120 @@ +-- Test minetest.clear_craft function +local function test_clear_craft() + minetest.log("info", "[unittests] Testing minetest.clear_craft") + -- Clearing by output + minetest.register_craft({ + output = "foo", + recipe = {{"bar"}} + }) + minetest.register_craft({ + output = "foo 4", + recipe = {{"foo", "bar"}} + }) + assert(#minetest.get_all_craft_recipes("foo") == 2) + minetest.clear_craft({output="foo"}) + assert(minetest.get_all_craft_recipes("foo") == nil) + -- Clearing by input + minetest.register_craft({ + output = "foo 4", + recipe = {{"foo", "bar"}} + }) + assert(#minetest.get_all_craft_recipes("foo") == 1) + minetest.clear_craft({recipe={{"foo", "bar"}}}) + assert(minetest.get_all_craft_recipes("foo") == nil) +end + +-- Test minetest.get_craft_result function +local function test_get_craft_result() + minetest.log("info", "[unittests] Testing minetest.get_craft_result") + + -- normal + local input = { + method = "normal", + width = 2, + items = {"", "unittests:coal_lump", "", "unittests:stick"} + } + minetest.log("info", "[unittests] torch crafting input: "..dump(input)) + local output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] torch crafting output: "..dump(output)) + minetest.log("info", "[unittests] torch crafting decremented input: "..dump(decremented_input)) + assert(output.item) + minetest.log("info", "[unittests] torch crafting output.item:to_table(): "..dump(output.item:to_table())) + assert(output.item:get_name() == "unittests:torch") + assert(output.item:get_count() == 4) + + -- fuel + input = { + method = "fuel", + width = 1, + items = {"unittests:coal_lump"} + } + minetest.log("info", "[unittests] coal fuel input: "..dump(input)) + output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] coal fuel output: "..dump(output)) + minetest.log("info", "[unittests] coal fuel decremented input: "..dump(decremented_input)) + assert(output.time) + assert(output.time > 0) + + -- cooking + input = { + method = "cooking", + width = 1, + items = {"unittests:iron_lump"} + } + minetest.log("info", "[unittests] iron lump cooking input: "..dump(output)) + output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] iron lump cooking output: "..dump(output)) + minetest.log("info", "[unittests] iron lump cooking decremented input: "..dump(decremented_input)) + assert(output.time) + assert(output.time > 0) + assert(output.item) + minetest.log("info", "[unittests] iron lump cooking output.item:to_table(): "..dump(output.item:to_table())) + assert(output.item:get_name() == "unittests:steel_ingot") + assert(output.item:get_count() == 1) + + -- tool repair (repairable) + input = { + method = "normal", + width = 2, + -- Using a wear of 60000 + items = {"unittests:repairable_tool 1 60000", "unittests:repairable_tool 1 60000"} + } + minetest.log("info", "[unittests] repairable tool crafting input: "..dump(input)) + output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] repairable tool crafting output: "..dump(output)) + minetest.log("info", "[unittests] repairable tool crafting decremented input: "..dump(decremented_input)) + assert(output.item) + minetest.log("info", "[unittests] repairable tool crafting output.item:to_table(): "..dump(output.item:to_table())) + assert(output.item:get_name() == "unittests:repairable_tool") + -- Test the wear value. + -- See src/craftdef.cpp in Minetest source code for the formula. The formula to calculate + -- the value 51187 is: + -- 65536 - ((65536-60000)+(65536-60000)) + floor(additonal_wear * 65536 + 0.5) = 51187 + -- where additional_wear = 0.05 + assert(output.item:get_wear() == 51187) + assert(output.item:get_count() == 1) + + -- failing tool repair (unrepairable) + input = { + method = "normal", + width = 2, + items = {"unittests:unrepairable_tool 1 60000", "unittests:unrepairable_tool 1 60000"} + } + minetest.log("info", "[unittests] unrepairable tool crafting input: "..dump(input)) + output, decremented_input = minetest.get_craft_result(input) + minetest.log("info", "[unittests] unrepairable tool crafting output: "..dump(output)) + minetest.log("info", "[unittests] unrepairable tool crafting decremented input: "..dump(decremented_input)) + assert(output.item) + minetest.log("info", "[unittests] unrepairable tool crafting output.item:to_table(): "..dump(output.item:to_table())) + -- unrepairable tool must not yield any output + assert(output.item:get_name() == "") + +end + +function unittests.test_crafting() + test_clear_craft() + test_get_craft_result() + minetest.log("action", "[unittests] Crafting tests passed!") + return true +end + diff --git a/games/devtest/mods/unittests/crafting_prepare.lua b/games/devtest/mods/unittests/crafting_prepare.lua new file mode 100644 index 000000000..a09734827 --- /dev/null +++ b/games/devtest/mods/unittests/crafting_prepare.lua @@ -0,0 +1,88 @@ +-- Registering some dummy items and recipes for the crafting tests + +minetest.register_craftitem("unittests:torch", { + description = "Crafting Test Item: Torch", + inventory_image = "unittests_torch.png", + + groups = { dummy = 1 }, +}) +minetest.register_craftitem("unittests:coal_lump", { + description = "Crafting Test Item: Coal Lump", + inventory_image = "unittests_coal_lump.png", + + groups = { dummy = 1 }, +}) +minetest.register_craftitem("unittests:stick", { + description = "Crafting Test Item: Stick", + inventory_image = "unittests_stick.png", + + groups = { dummy = 1 }, +}) +minetest.register_craftitem("unittests:iron_lump", { + description = "Crafting Test Item: Iron Lump", + inventory_image = "unittests_iron_lump.png", + + groups = { dummy = 1 }, +}) +minetest.register_craftitem("unittests:steel_ingot", { + description = "Crafting Test Item: Steel Ingot", + inventory_image = "unittests_steel_ingot.png", + + groups = { dummy = 1 }, +}) + +-- Recipes for tests: Normal crafting, cooking and fuel + +minetest.register_craft({ + output = 'unittests:torch 4', + recipe = { + {'unittests:coal_lump'}, + {'unittests:stick'}, + } +}) + +minetest.register_craft({ + type = "cooking", + output = "unittests:steel_ingot", + recipe = "unittests:iron_lump", +}) + +minetest.register_craft({ + type = "fuel", + recipe = "unittests:coal_lump", + burntime = 40, +}) + +-- Test tool repair +minetest.register_craft({ + type = "toolrepair", + additional_wear = -0.05, +}) + +-- Test the disable_repair=1 group +minetest.register_tool("unittests:unrepairable_tool", { + description = "Crafting Test Item: Unrepairable Tool", + inventory_image = "unittests_unrepairable_tool.png", + tool_capabilities = { + groupcaps = { + cracky = { + times = {3, 2, 1}, + } + } + }, + groups = { disable_repair = 1, dummy = 1 } +}) + +minetest.register_tool("unittests:repairable_tool", { + description = "Crafting Test Item: Repairable Tool", + inventory_image = "unittests_repairable_tool.png", + tool_capabilities = { + groupcaps = { + cracky = { + times = {3, 2, 1}, + } + } + }, + + groups = { dummy = 1 }, +}) diff --git a/games/devtest/mods/unittests/init.lua b/games/devtest/mods/unittests/init.lua new file mode 100644 index 000000000..6c1728420 --- /dev/null +++ b/games/devtest/mods/unittests/init.lua @@ -0,0 +1,16 @@ +unittests = {} + +local modpath = minetest.get_modpath("unittests") +dofile(modpath .. "/random.lua") +dofile(modpath .. "/player.lua") +dofile(modpath .. "/crafting_prepare.lua") +dofile(modpath .. "/crafting.lua") + +if minetest.settings:get_bool("devtest_unittests_autostart", false) then + unittests.test_random() + unittests.test_crafting() + minetest.register_on_joinplayer(function(player) + unittests.test_player(player) + end) +end + diff --git a/games/devtest/mods/unittests/mod.conf b/games/devtest/mods/unittests/mod.conf new file mode 100644 index 000000000..0d5e3c959 --- /dev/null +++ b/games/devtest/mods/unittests/mod.conf @@ -0,0 +1,2 @@ +name = unittests +description = Adds automated unit tests for the engine diff --git a/games/devtest/mods/unittests/player.lua b/games/devtest/mods/unittests/player.lua new file mode 100644 index 000000000..10781a95f --- /dev/null +++ b/games/devtest/mods/unittests/player.lua @@ -0,0 +1,73 @@ +-- +-- HP Change Reasons +-- +local expect = nil +local function run_hpchangereason_tests(player) + expect = { type = "set_hp", from = "mod" } + player:set_hp(3) + assert(expect == nil) + + expect = { a = 234, type = "set_hp", from = "mod" } + player:set_hp(7, { a= 234 }) + assert(expect == nil) + + expect = { df = 3458973454, type = "fall", from = "mod" } + player:set_hp(10, { type = "fall", df = 3458973454 }) + assert(expect == nil) + + player:set_hp(20) +end + +local function run_player_meta_tests(player) + local meta = player:get_meta() + meta:set_string("foo", "bar") + assert(meta:contains("foo")) + assert(meta:get_string("foo") == "bar") + assert(meta:get("foo") == "bar") + + local meta2 = player:get_meta() + assert(meta2:get_string("foo") == "bar") + assert(meta2:get("foo") == "bar") + assert(meta:equals(meta2)) + + meta:set_string("bob", "dillan") + assert(meta:get_string("foo") == "bar") + assert(meta:get_string("bob") == "dillan") + assert(meta:get("bob") == "dillan") + assert(meta2:get_string("foo") == "bar") + assert(meta2:get_string("bob") == "dillan") + assert(meta2:get("bob") == "dillan") + assert(meta:equals(meta2)) + + meta:set_string("foo", "") + assert(not meta:contains("foo")) + assert(meta:get("foo") == nil) + assert(meta:get_string("foo") == "") + assert(meta:equals(meta2)) +end + +function unittests.test_player(player) + minetest.register_on_player_hpchange(function(player, hp, reason) + if not expect then + return + end + + for key, value in pairs(reason) do + assert(expect[key] == value) + end + + for key, value in pairs(expect) do + assert(reason[key] == value) + end + + expect = nil + end) + + run_hpchangereason_tests(player) + run_player_meta_tests(player) + local msg = "Player tests passed for player '"..player:get_player_name().."'!" + minetest.chat_send_all(msg) + minetest.log("action", "[unittests] "..msg) + return true +end + diff --git a/games/devtest/mods/unittests/random.lua b/games/devtest/mods/unittests/random.lua new file mode 100644 index 000000000..f94f0a88e --- /dev/null +++ b/games/devtest/mods/unittests/random.lua @@ -0,0 +1,10 @@ +function unittests.test_random() + -- Try out PseudoRandom + minetest.log("action", "[unittests] Testing PseudoRandom ...") + local pseudo = PseudoRandom(13) + assert(pseudo:next() == 22290) + assert(pseudo:next() == 13854) + minetest.log("action", "[unittests] PseudoRandom test passed!") + return true +end + diff --git a/games/devtest/mods/unittests/textures/unittests_coal_lump.png b/games/devtest/mods/unittests/textures/unittests_coal_lump.png new file mode 100644 index 000000000..f460d909e Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_coal_lump.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_iron_lump.png b/games/devtest/mods/unittests/textures/unittests_iron_lump.png new file mode 100644 index 000000000..22f43e9cc Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_iron_lump.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_repairable_tool.png b/games/devtest/mods/unittests/textures/unittests_repairable_tool.png new file mode 100644 index 000000000..46fbbaa74 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_repairable_tool.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_steel_ingot.png b/games/devtest/mods/unittests/textures/unittests_steel_ingot.png new file mode 100644 index 000000000..6977696a2 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_steel_ingot.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_stick.png b/games/devtest/mods/unittests/textures/unittests_stick.png new file mode 100644 index 000000000..ffdce70d4 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_stick.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_torch.png b/games/devtest/mods/unittests/textures/unittests_torch.png new file mode 100644 index 000000000..ba5eebef0 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_torch.png differ diff --git a/games/devtest/mods/unittests/textures/unittests_unrepairable_tool.png b/games/devtest/mods/unittests/textures/unittests_unrepairable_tool.png new file mode 100644 index 000000000..c676213a5 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_unrepairable_tool.png differ diff --git a/games/devtest/mods/util_commands/init.lua b/games/devtest/mods/util_commands/init.lua new file mode 100644 index 000000000..ad8d3f9ba --- /dev/null +++ b/games/devtest/mods/util_commands/init.lua @@ -0,0 +1,137 @@ +minetest.register_chatcommand("hotbar", { + params = "", + description = "Set hotbar size", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local size = tonumber(param) + if not size then + return false, "Missing or incorrect size parameter!" + end + local ok = player:hud_set_hotbar_itemcount(size) + if ok then + return true + else + return false, "Invalid item count!" + end + end, +}) + +minetest.register_chatcommand("hp", { + params = "", + description = "Set your health", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local hp = tonumber(param) + if not hp then + return false, "Missing or incorrect hp parameter!" + end + player:set_hp(hp) + return true + end, +}) + +minetest.register_chatcommand("zoom", { + params = "[]", + description = "Set or display your zoom_fov", + func = function(name, param) + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + if param == "" then + local fov = player:get_properties().zoom_fov + return true, "zoom_fov = "..tostring(fov) + end + local fov = tonumber(param) + if not fov then + return false, "Missing or incorrect zoom_fov parameter!" + end + player:set_properties({zoom_fov = fov}) + fov = player:get_properties().zoom_fov + return true, "zoom_fov = "..tostring(fov) + end, +}) + + + +local s_infplace = minetest.settings:get("devtest_infplace") +if s_infplace == "true" then + infplace = true +elseif s_infplace == "false" then + infplace = false +else + infplace = minetest.settings:get_bool("creative_mode", false) +end + +minetest.register_chatcommand("infplace", { + params = "", + description = "Toggle infinite node placement", + func = function(name, param) + infplace = not infplace + if infplace then + minetest.chat_send_all("Infinite node placement enabled!") + minetest.log("action", "Infinite node placement enabled") + else + minetest.chat_send_all("Infinite node placement disabled!") + minetest.log("action", "Infinite node placement disabled") + end + return true + end, +}) + +minetest.register_chatcommand("detach", { + params = "[]", + description = "Detach all objects nearby", + func = function(name, param) + local radius = tonumber(param) + if type(radius) ~= "number" then + radius = 8 + end + if radius < 1 then + radius = 1 + end + local player = minetest.get_player_by_name(name) + if not player then + return false, "No player." + end + local objs = minetest.get_objects_inside_radius(player:get_pos(), radius) + local num = 0 + for o=1, #objs do + if objs[o]:get_attach() then + objs[o]:set_detach() + num = num + 1 + end + end + return true, string.format("%d object(s) detached.", num) + end, +}) + + +-- Unlimited node placement +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) + if placer and placer:is_player() then + return infplace + end +end) + +-- Don't pick up if the item is already in the inventory +local old_handle_node_drops = minetest.handle_node_drops +function minetest.handle_node_drops(pos, drops, digger) + if not digger or not digger:is_player() or not infplace then + return old_handle_node_drops(pos, drops, digger) + end + local inv = digger:get_inventory() + if inv then + for _, item in ipairs(drops) do + if not inv:contains_item("main", item, true) then + inv:add_item("main", item) + end + end + end +end diff --git a/games/devtest/mods/util_commands/mod.conf b/games/devtest/mods/util_commands/mod.conf new file mode 100644 index 000000000..fea6dd3e9 --- /dev/null +++ b/games/devtest/mods/util_commands/mod.conf @@ -0,0 +1,2 @@ +name = util_commands +description = Random server commands to make testing easier and more convenient diff --git a/games/devtest/screenshot.png b/games/devtest/screenshot.png new file mode 100644 index 000000000..7324883f6 Binary files /dev/null and b/games/devtest/screenshot.png differ diff --git a/games/devtest/settingtypes.txt b/games/devtest/settingtypes.txt new file mode 100644 index 000000000..40ee5845b --- /dev/null +++ b/games/devtest/settingtypes.txt @@ -0,0 +1,37 @@ +# If enabled, nodes won't be used up when placed. +# Note: This behavior can also be toggled in-game with the /infplace command. +# +# - true: enabled +# - false: disabled +# - auto: only enabled when Creative Mode is enabled (default) +devtest_infplace (Infinite node placement) enum auto true,false,auto + +# If enabled, new players receive some initial items when joining for the first time. +give_initial_stuff (Give initial stuff) bool true + +# If enabled, automated tests of the Lua API such as player health, crafting and PseudoRandom will be performed on startup. +devtest_unittests_autostart (Perform unit tests) bool false + +# If enabled, the game will use all mapgen aliases for the v6 mapgen. +# If disabled, it will only use a minimal set of mapgen aliases. +# If enabled, there should be biome-specific tree, leaves and ground nodes. If disabled, stuff should use fallback nodes (like stone instead of desert stone). +# +# Many mapgen aliases have fallback values when no value is provided. Having this setting disabled can be useful to test whether those fallback values are functional. +devtest_v6_mapgen_aliases (Use all v6 mapgen aliases) bool false + +# If enabled, the game will use dungeon stairs by enabling the corresponding mapgen aliases. +# +# Disabling this setting can be useful to test whether dungeons still work when stairs are not defined. +devtest_dungeon_stairs (Generate dungeon stairs) bool false + +# If enabled, the mapgen alias 'mapgen_mossycobble' will be used. This should enable random mossy cobblestone in dungeons. +# If disabled, it won't be used. The engine should fall back to cobble instead. +devtest_dungeon_mossycobble (Generate mossy cobblestone) bool false + +# If enabled, some very basic biomes will be registered. +devtest_register_biomes (Register biomes) bool true + +# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. +# This is due to . +# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off. +testnodes_show_fallback_image (Use fallback inventory images) bool false diff --git a/games/minimal/LICENSE.txt b/games/minimal/LICENSE.txt deleted file mode 100644 index 108c66abf..000000000 --- a/games/minimal/LICENSE.txt +++ /dev/null @@ -1,4 +0,0 @@ -License information for Developer Test --------------------------------------- - -The same license as for Minetest applies. diff --git a/games/minimal/README.md b/games/minimal/README.md deleted file mode 100644 index a94530498..000000000 --- a/games/minimal/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# Minimal development test - -This is a basic testing environment that contains a bunch of things to test the engine, but it could also be used as a minimal testbed for testing out mods. - -## Features - -* Basic nodes for mapgen -* Basic, minimal map generator -* Lots of example nodes for testing drawtypes, param2, light level, and many other node properties -* Example entities -* Other example items -* Formspec test (via `/test_formspec` command) -* Automated unit tests (disabled by default) -* Tools for manipulating nodes and entities, like the "Param2 Tool" - -## Getting started - -Basically, just create a world and start. A few important things to note: - -* Items are gotten from the “Chest of Everything” (`chest_of_everything:chest`) -* When you lost your initial items, type in `/stuff` command to get them back -* By default, Creative Mode activates infinite node placement. This behavior can be changed with the `devtest_infplace` setting -* Use the `/infplace` command to toggle infinite node placement in-game -* Use the Param2 Tool to change the param2 of nodes; it's useful to experiment with the various drawtype test nodes -* Check out the game settings and server commands for additional tests and features -* Creative Mode does nothing (apart from default engine behavior) - -Confused by a certain node or item? Check out for inline code comments. - -### Example tests - -* You can use this to test what happens if a player is simultaneously in 2 nodes with `damage_per_second` but with a different value. -* Or use the Falling Node Tool on various test nodes to see how they behave when falling. -* You could also use this as a testbed for dependency-free mods, e.g. to test out how your formspecs behave without theming. - -## Random notes - -* Experimental/strange/unstructured tests can be found in the `experimental` mod -* Textures of drawtype test nodes have a red dot at the top left corner. This is to see whether the textures are oriented properly - -## Design philosophy - -This should loosely follow the following principles: - -* Engine testing: The main focus of this is to aid testing of *engine* features, such as mapgen or node drawtypes -* Mod testing: The secondary focus is to help modders as well, either as a minimal testbed for mods or even as a code example -* Minimal interference: Under default settings, it shall not interfere with APIs except on explicit user wish. Non-trivial tests and features need to be enabled by a setting first -* Convenience: Have various tools to make usage easier and more convenient -* Reproducing engine bugs: When an engine bug was found, consider creating a test case -* Clarity: Textures and names need to be designed to keep different things clearly visually apart at a glance -* Low loading time: It must load blazing-fast so stuff can be tested quickly - diff --git a/games/minimal/game.conf b/games/minimal/game.conf deleted file mode 100644 index ae76cf7ad..000000000 --- a/games/minimal/game.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = Minimal development test -description = Testing environment to help with testing the engine features of Minetest. It can also be helpful in mod development. diff --git a/games/minimal/menu/background.png b/games/minimal/menu/background.png deleted file mode 100644 index 415bb3d14..000000000 Binary files a/games/minimal/menu/background.png and /dev/null differ diff --git a/games/minimal/menu/header.png b/games/minimal/menu/header.png deleted file mode 100644 index db864d6b7..000000000 Binary files a/games/minimal/menu/header.png and /dev/null differ diff --git a/games/minimal/menu/icon.png b/games/minimal/menu/icon.png deleted file mode 100644 index f854b9c31..000000000 Binary files a/games/minimal/menu/icon.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/init.lua b/games/minimal/mods/basenodes/init.lua deleted file mode 100644 index 8156c4bec..000000000 --- a/games/minimal/mods/basenodes/init.lua +++ /dev/null @@ -1,334 +0,0 @@ -local WATER_ALPHA = 160 -local WATER_VISC = 1 -local LAVA_VISC = 7 - --- --- Node definitions --- - --- Register nodes - -minetest.register_node("basenodes:stone", { - description = "Stone", - tiles = {"default_stone.png"}, - groups = {cracky=3}, -}) - -minetest.register_node("basenodes:desert_stone", { - description = "Desert Stone", - tiles = {"default_desert_stone.png"}, - groups = {cracky=3}, -}) - -minetest.register_node("basenodes:dirt_with_grass", { - description = "Dirt with Grass", - tiles ={"default_grass.png", - -- a little dot on the bottom to distinguish it from dirt - "default_dirt.png^basenodes_dirt_with_grass_bottom.png", - {name = "default_dirt.png^default_grass_side.png", - tileable_vertical = false}}, - groups = {crumbly=3, soil=1}, -}) - -minetest.register_node("basenodes:dirt_with_snow", { - description = "Dirt with Snow", - tiles ={"basenodes_dirt_with_snow.png", - -- a little dot on the bottom to distinguish it from dirt - "default_dirt.png^basenodes_dirt_with_snow_bottom.png", - {name = "default_dirt.png^default_snow_side.png", - tileable_vertical = false}}, - groups = {crumbly=3, soil=1}, -}) - -minetest.register_node("basenodes:dirt", { - description = "Dirt", - tiles ={"default_dirt.png"}, - groups = {crumbly=3, soil=1}, -}) - -minetest.register_node("basenodes:sand", { - description = "Sand", - tiles ={"default_sand.png"}, - groups = {crumbly=3}, -}) - -minetest.register_node("basenodes:desert_sand", { - description = "Desert Sand", - tiles ={"default_desert_sand.png"}, - groups = {crumbly=3}, -}) - -minetest.register_node("basenodes:gravel", { - description = "Gravel", - tiles ={"default_gravel.png"}, - groups = {crumbly=2}, -}) - -minetest.register_node("basenodes:junglegrass", { - description = "Jungle Grass", - drawtype = "plantlike", - tiles ={"default_junglegrass.png"}, - inventory_image = "default_junglegrass.png", - wield_image = "default_junglegrass.png", - paramtype = "light", - walkable = false, - groups = {snappy=3}, -}) - -minetest.register_node("basenodes:tree", { - description = "Normal Tree Trunk", - tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, - is_ground_content = false, - groups = {choppy=2,oddly_breakable_by_hand=1}, -}) - -minetest.register_node("basenodes:leaves", { - description = "Normal Leaves", - drawtype = "allfaces_optional", - tiles = {"default_leaves.png"}, - paramtype = "light", - is_ground_content = false, - groups = {snappy=3}, -}) - -minetest.register_node("basenodes:jungletree", { - description = "Jungle Tree Trunk", - tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, - is_ground_content = false, - groups = {choppy=2,oddly_breakable_by_hand=1}, -}) - -minetest.register_node("basenodes:jungleleaves", { - description = "Jungle Leaves", - drawtype = "allfaces_optional", - tiles = {"default_jungleleaves.png"}, - paramtype = "light", - is_ground_content = false, - groups = {snappy=3}, -}) - -minetest.register_node("basenodes:pine_tree", { - description = "Pine Tree Trunk", - tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", "default_pine_tree.png"}, - is_ground_content = false, - groups = {choppy=2,oddly_breakable_by_hand=1}, -}) - -minetest.register_node("basenodes:pine_needles", { - description = "Pine Needles", - drawtype = "allfaces_optional", - tiles = {"default_pine_needles.png"}, - paramtype = "light", - is_ground_content = false, - groups = {snappy=3}, -}) - -minetest.register_node("basenodes:water_source", { - description = "Water Source", - drawtype = "liquid", - tiles = {"default_water.png"}, - special_tiles = { - {name = "default_water.png", backface_culling = false}, - {name = "default_water.png", backface_culling = true}, - }, - alpha = WATER_ALPHA, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - liquidtype = "source", - liquid_alternative_flowing = "basenodes:water_flowing", - liquid_alternative_source = "basenodes:water_source", - liquid_viscosity = WATER_VISC, - post_effect_color = {a = 64, r = 100, g = 100, b = 200}, - groups = {water = 3, liquid = 3}, -}) - -minetest.register_node("basenodes:water_flowing", { - description = "Flowing Water", - drawtype = "flowingliquid", - tiles = {"default_water_flowing.png"}, - special_tiles = { - {name = "default_water_flowing.png", backface_culling = false}, - {name = "default_water_flowing.png", backface_culling = false}, - }, - alpha = WATER_ALPHA, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "basenodes:water_flowing", - liquid_alternative_source = "basenodes:water_source", - liquid_viscosity = WATER_VISC, - post_effect_color = {a = 64, r = 100, g = 100, b = 200}, - groups = {water = 3, liquid = 3}, -}) - -minetest.register_node("basenodes:river_water_source", { - description = "River Water Source", - drawtype = "liquid", - tiles = { "default_river_water.png" }, - special_tiles = { - {name = "default_river_water.png", backface_culling = false}, - {name = "default_river_water.png", backface_culling = true}, - }, - alpha = WATER_ALPHA, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - liquidtype = "source", - liquid_alternative_flowing = "basenodes:river_water_flowing", - liquid_alternative_source = "basenodes:river_water_source", - liquid_viscosity = 1, - liquid_renewable = false, - liquid_range = 2, - post_effect_color = {a = 103, r = 30, g = 76, b = 90}, - groups = {water = 3, liquid = 3, }, -}) - -minetest.register_node("basenodes:river_water_flowing", { - description = "Flowing River Water", - drawtype = "flowingliquid", - tiles = {"default_river_water_flowing.png"}, - special_tiles = { - {name = "default_river_water_flowing.png", backface_culling = false}, - {name = "default_river_water_flowing.png", backface_culling = false}, - }, - alpha = WATER_ALPHA, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - liquidtype = "flowing", - liquid_alternative_flowing = "basenodes:river_water_flowing", - liquid_alternative_source = "basenodes:river_water_source", - liquid_viscosity = 1, - liquid_renewable = false, - liquid_range = 2, - post_effect_color = {a = 103, r = 30, g = 76, b = 90}, - groups = {water = 3, liquid = 3, }, -}) - -minetest.register_node("basenodes:lava_flowing", { - description = "Flowing Lava", - drawtype = "flowingliquid", - tiles = {"default_lava_flowing.png"}, - special_tiles = { - {name="default_lava_flowing.png", backface_culling = false}, - {name="default_lava_flowing.png", backface_culling = false}, - }, - paramtype = "light", - light_source = minetest.LIGHT_MAX, - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - damage_per_second = 4, - liquidtype = "flowing", - liquid_alternative_flowing = "basenodes:lava_flowing", - liquid_alternative_source = "basenodes:lava_source", - liquid_viscosity = LAVA_VISC, - post_effect_color = {a=192, r=255, g=64, b=0}, - groups = {lava=3, liquid=1}, -}) - -minetest.register_node("basenodes:lava_source", { - description = "Lava Source", - drawtype = "liquid", - tiles = { "default_lava.png" }, - special_tiles = { - {name = "default_lava.png", backface_culling = false}, - {name = "default_lava.png", backface_culling = true}, - }, - paramtype = "light", - light_source = minetest.LIGHT_MAX, - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - drowning = 1, - damage_per_second = 4, - liquidtype = "source", - liquid_alternative_flowing = "basenodes:lava_flowing", - liquid_alternative_source = "basenodes:lava_source", - liquid_viscosity = LAVA_VISC, - post_effect_color = {a=192, r=255, g=64, b=0}, - groups = {lava=3, liquid=1}, -}) - -minetest.register_node("basenodes:cobble", { - description = "Cobblestone", - tiles ={"default_cobble.png"}, - is_ground_content = false, - groups = {cracky=3}, -}) - -minetest.register_node("basenodes:mossycobble", { - description = "Mossy Cobblestone", - tiles ={"default_mossycobble.png"}, - is_ground_content = false, - groups = {cracky=3}, -}) - -minetest.register_node("basenodes:apple", { - description = "Apple", - drawtype = "plantlike", - tiles ={"default_apple.png"}, - inventory_image = "default_apple.png", - paramtype = "light", - is_ground_content = false, - sunlight_propagates = true, - walkable = false, - groups = {dig_immediate=3}, - - -- Make eatable because why not? - on_use = minetest.item_eat(2), -}) - -minetest.register_node("basenodes:ice", { - description = "Ice", - tiles ={"default_ice.png"}, - groups = {cracky=3}, -}) - --- The snow nodes intentionally have different tints to make them more --- distinguishable -minetest.register_node("basenodes:snow", { - description = "Snow Sheet", - tiles = {"basenodes_snow_sheet.png"}, - groups = {crumbly=3}, - walkable = false, - paramtype = "light", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - }, -}) - -minetest.register_node("basenodes:snowblock", { - description = "Snow Block", - tiles ={"default_snow.png"}, - groups = {crumbly=3}, -}) - - diff --git a/games/minimal/mods/basenodes/mod.conf b/games/minimal/mods/basenodes/mod.conf deleted file mode 100644 index 25024dc63..000000000 --- a/games/minimal/mods/basenodes/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = basenodes -description = Contains basic nodes for mapgen diff --git a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png b/games/minimal/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png deleted file mode 100644 index 5e8fc41a9..000000000 Binary files a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_grass_bottom.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow.png b/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow.png deleted file mode 100644 index 7ea2d8d31..000000000 Binary files a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png b/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png deleted file mode 100644 index 447c94e98..000000000 Binary files a/games/minimal/mods/basenodes/textures/basenodes_dirt_with_snow_bottom.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png b/games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png deleted file mode 100644 index 455332093..000000000 Binary files a/games/minimal/mods/basenodes/textures/basenodes_snow_sheet.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_apple.png b/games/minimal/mods/basenodes/textures/default_apple.png deleted file mode 100644 index 9c115dae4..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_apple.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_cobble.png b/games/minimal/mods/basenodes/textures/default_cobble.png deleted file mode 100644 index 5b859e9c2..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_cobble.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_desert_sand.png b/games/minimal/mods/basenodes/textures/default_desert_sand.png deleted file mode 100644 index 19ec87dc0..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_desert_sand.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_desert_stone.png b/games/minimal/mods/basenodes/textures/default_desert_stone.png deleted file mode 100644 index 5126fb61c..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_desert_stone.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_dirt.png b/games/minimal/mods/basenodes/textures/default_dirt.png deleted file mode 100644 index 58670305d..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_dirt.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_grass.png b/games/minimal/mods/basenodes/textures/default_grass.png deleted file mode 100644 index 3d6397186..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_grass.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_grass_side.png b/games/minimal/mods/basenodes/textures/default_grass_side.png deleted file mode 100644 index 04770b6f6..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_grass_side.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_gravel.png b/games/minimal/mods/basenodes/textures/default_gravel.png deleted file mode 100644 index 7e5ff616f..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_gravel.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_ice.png b/games/minimal/mods/basenodes/textures/default_ice.png deleted file mode 100644 index c4bddd223..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_ice.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_junglegrass.png b/games/minimal/mods/basenodes/textures/default_junglegrass.png deleted file mode 100644 index d64e33abc..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_junglegrass.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_jungleleaves.png b/games/minimal/mods/basenodes/textures/default_jungleleaves.png deleted file mode 100644 index 1fa67e83a..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_jungleleaves.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_jungletree.png b/games/minimal/mods/basenodes/textures/default_jungletree.png deleted file mode 100644 index 053850fa7..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_jungletree.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_jungletree_top.png b/games/minimal/mods/basenodes/textures/default_jungletree_top.png deleted file mode 100644 index e80de8a69..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_jungletree_top.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_lava.png b/games/minimal/mods/basenodes/textures/default_lava.png deleted file mode 100644 index a4cf649f1..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_lava.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_lava_flowing.png b/games/minimal/mods/basenodes/textures/default_lava_flowing.png deleted file mode 100644 index 07066a6e3..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_lava_flowing.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_leaves.png b/games/minimal/mods/basenodes/textures/default_leaves.png deleted file mode 100644 index c0475d4d2..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_leaves.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_mossycobble.png b/games/minimal/mods/basenodes/textures/default_mossycobble.png deleted file mode 100644 index 69585e37b..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_mossycobble.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_pine_needles.png b/games/minimal/mods/basenodes/textures/default_pine_needles.png deleted file mode 100644 index 137caa2a3..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_pine_needles.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_pine_tree.png b/games/minimal/mods/basenodes/textures/default_pine_tree.png deleted file mode 100644 index 5743183c0..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_pine_tree.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_pine_tree_top.png b/games/minimal/mods/basenodes/textures/default_pine_tree_top.png deleted file mode 100644 index cc18f3462..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_pine_tree_top.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_river_water.png b/games/minimal/mods/basenodes/textures/default_river_water.png deleted file mode 100644 index e1074d2ef..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_river_water.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_river_water_flowing.png b/games/minimal/mods/basenodes/textures/default_river_water_flowing.png deleted file mode 100644 index 4a756b2bd..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_river_water_flowing.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_sand.png b/games/minimal/mods/basenodes/textures/default_sand.png deleted file mode 100644 index 0ed0e4ceb..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_sand.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_snow.png b/games/minimal/mods/basenodes/textures/default_snow.png deleted file mode 100644 index c42e0eecb..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_snow.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_snow_side.png b/games/minimal/mods/basenodes/textures/default_snow_side.png deleted file mode 100644 index f34d10991..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_snow_side.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_stone.png b/games/minimal/mods/basenodes/textures/default_stone.png deleted file mode 100644 index 763b4396a..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_stone.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_tree.png b/games/minimal/mods/basenodes/textures/default_tree.png deleted file mode 100644 index 189ec1593..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_tree.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_tree_top.png b/games/minimal/mods/basenodes/textures/default_tree_top.png deleted file mode 100644 index d1a4fa704..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_tree_top.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_water.png b/games/minimal/mods/basenodes/textures/default_water.png deleted file mode 100644 index 3e385ae8b..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_water.png and /dev/null differ diff --git a/games/minimal/mods/basenodes/textures/default_water_flowing.png b/games/minimal/mods/basenodes/textures/default_water_flowing.png deleted file mode 100644 index 7cdafd51d..000000000 Binary files a/games/minimal/mods/basenodes/textures/default_water_flowing.png and /dev/null differ diff --git a/games/minimal/mods/basetools/init.lua b/games/minimal/mods/basetools/init.lua deleted file mode 100644 index d9d9afb07..000000000 --- a/games/minimal/mods/basetools/init.lua +++ /dev/null @@ -1,295 +0,0 @@ --- --- Tool definitions --- - ---[[ TOOLS SUMMARY: - -Tool types: - -* Hand: basic tool/weapon (just for convenience, not optimized for testing) -* Pickaxe: dig cracky -* Axe: dig choppy -* Shovel: dig crumbly -* Shears: dig snappy -* Sword: deal damage -* Dagger: deal damage, but faster - -Tool materials: - -* Dirt: dig nodes of rating 3, one use only -* Wood: dig nodes of rating 3 -* Stone: dig nodes of rating 3 or 2 -* Steel: dig nodes of rating 3, 2 or 1 -* Mese: dig "everything" instantly -]] - --- The hand -minetest.register_item(":", { - type = "none", - wield_image = "wieldhand.png", - wield_scale = {x=1,y=1,z=2.5}, - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level = 0, - groupcaps = { - crumbly = {times={[3]=1.50}, uses=0, maxlevel=0}, - snappy = {times={[3]=1.50}, uses=0, maxlevel=0}, - oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=2.00}, uses=0, maxlevel=0}, - }, - damage_groups = {fleshy=1}, - } -}) - --- Mese Pickaxe: special tool that digs "everything" instantly -minetest.register_tool("basetools:pick_mese", { - description = "Mese Pickaxe", - inventory_image = "basetools_mesepick.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=3, - groupcaps={ - cracky={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - crumbly={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - snappy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - choppy={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - dig_immediate={times={[1]=0.0, [2]=0.0, [3]=0.0}, maxlevel=255}, - }, - }, -}) - - --- --- Pickaxes: Dig cracky --- - --- This should break after only 1 use -minetest.register_tool("basetools:pick_dirt", { - description = "Dirt Pickaxe", - inventory_image = "basetools_dirtpick.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[3]=2.00}, uses=1, maxlevel=0} - }, - }, -}) - -minetest.register_tool("basetools:pick_wood", { - description = "Wooden Pickaxe", - inventory_image = "basetools_woodpick.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[3]=2.00}, uses=30, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:pick_stone", { - description = "Stone Pickaxe", - inventory_image = "basetools_stonepick.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[2]=1.20, [3]=0.80}, uses=60, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:pick_steel", { - description = "Steel Pickaxe", - inventory_image = "basetools_steelpick.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:pick_steel_l1", { - description = "Steel Pickaxe Level 1", - inventory_image = "basetools_steelpick_l1.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=1} - }, - }, -}) -minetest.register_tool("basetools:pick_steel_l2", { - description = "Steel Pickaxe Level 2", - inventory_image = "basetools_steelpick_l2.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=90, maxlevel=2} - }, - }, -}) - --- --- Shovels (dig crumbly) --- - -minetest.register_tool("basetools:shovel_wood", { - description = "Wooden Shovel", - inventory_image = "basetools_woodshovel.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - crumbly={times={[3]=0.50}, uses=30, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:shovel_stone", { - description = "Stone Shovel", - inventory_image = "basetools_stoneshovel.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - crumbly={times={[2]=0.50, [3]=0.30}, uses=60, maxlevel=0} - }, - }, -}) -minetest.register_tool("basetools:shovel_steel", { - description = "Steel Shovel", - inventory_image = "basetools_steelshovel.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - crumbly={times={[1]=1.00, [2]=0.70, [3]=0.60}, uses=90, maxlevel=0} - }, - }, -}) - --- --- Axes (dig choppy) --- - -minetest.register_tool("basetools:axe_wood", { - description = "Wooden Axe", - inventory_image = "basetools_woodaxe.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - choppy={times={[3]=0.80}, uses=30, maxlevel=0}, - }, - }, -}) -minetest.register_tool("basetools:axe_stone", { - description = "Stone Axe", - inventory_image = "basetools_stoneaxe.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - choppy={times={[2]=1.00, [3]=0.60}, uses=60, maxlevel=0}, - }, - }, -}) -minetest.register_tool("basetools:axe_steel", { - description = "Steel Axe", - inventory_image = "basetools_steelaxe.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - choppy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=90, maxlevel=0}, - }, - }, -}) - --- --- Shears (dig snappy) --- - -minetest.register_tool("basetools:shears_wood", { - description = "Wooden Shears", - inventory_image = "basetools_woodshears.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - snappy={times={[3]=1.00}, uses=30, maxlevel=0}, - }, - }, -}) -minetest.register_tool("basetools:shears_stone", { - description = "Stone Shears", - inventory_image = "basetools_stoneshears.png", - tool_capabilities = { - max_drop_level=0, - groupcaps={ - snappy={times={[2]=1.00, [3]=0.50}, uses=60, maxlevel=0}, - }, - }, -}) -minetest.register_tool("basetools:shears_steel", { - description = "Steel Shears", - inventory_image = "basetools_steelshears.png", - tool_capabilities = { - max_drop_level=1, - groupcaps={ - snappy={times={[1]=1.00, [2]=0.50, [3]=0.25}, uses=90, maxlevel=0}, - }, - }, -}) - --- --- Swords (deal damage) --- - -minetest.register_tool("basetools:sword_wood", { - description = "Wooden Sword", - inventory_image = "basetools_woodsword.png", - tool_capabilities = { - full_punch_interval = 1.0, - damage_groups = {fleshy=2}, - } -}) -minetest.register_tool("basetools:sword_stone", { - description = "Stone Sword", - inventory_image = "basetools_stonesword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=0, - damage_groups = {fleshy=4}, - } -}) -minetest.register_tool("basetools:sword_steel", { - description = "Steel Sword", - inventory_image = "basetools_steelsword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - damage_groups = {fleshy=6}, - } -}) - --- Fire/Ice sword: Deal damage to non-fleshy damage groups -minetest.register_tool("basetools:sword_fire", { - description = "Fire Sword", - inventory_image = "basetools_firesword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=0, - damage_groups = {icy=6}, - } -}) -minetest.register_tool("basetools:sword_ice", { - description = "Ice Sword", - inventory_image = "basetools_icesword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=0, - damage_groups = {firy=6}, - } -}) - --- --- Dagger: Low damage, fast punch interval --- -minetest.register_tool("basetools:dagger_steel", { - description = "Steel Dagger", - inventory_image = "basetools_steeldagger.png", - tool_capabilities = { - full_punch_interval = 0.5, - max_drop_level=0, - damage_groups = {fleshy=2}, - } -}) diff --git a/games/minimal/mods/basetools/mod.conf b/games/minimal/mods/basetools/mod.conf deleted file mode 100644 index f0d9f657d..000000000 --- a/games/minimal/mods/basetools/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = basetools -description = Contains basic digging tools diff --git a/games/minimal/mods/basetools/textures/basetools_dirtpick.png b/games/minimal/mods/basetools/textures/basetools_dirtpick.png deleted file mode 100644 index 20a021d72..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_dirtpick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_firesword.png b/games/minimal/mods/basetools/textures/basetools_firesword.png deleted file mode 100644 index ee2809ab7..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_firesword.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_icesword.png b/games/minimal/mods/basetools/textures/basetools_icesword.png deleted file mode 100644 index 35ba8214b..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_icesword.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_mesepick.png b/games/minimal/mods/basetools/textures/basetools_mesepick.png deleted file mode 100644 index 2b5e12cdb..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_mesepick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelaxe.png b/games/minimal/mods/basetools/textures/basetools_steelaxe.png deleted file mode 100644 index aac594d84..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelaxe.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steeldagger.png b/games/minimal/mods/basetools/textures/basetools_steeldagger.png deleted file mode 100644 index 4c9173094..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steeldagger.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelpick.png b/games/minimal/mods/basetools/textures/basetools_steelpick.png deleted file mode 100644 index bc02aac3e..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelpick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelpick_l1.png b/games/minimal/mods/basetools/textures/basetools_steelpick_l1.png deleted file mode 100644 index dc03f3f65..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelpick_l1.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelpick_l2.png b/games/minimal/mods/basetools/textures/basetools_steelpick_l2.png deleted file mode 100644 index 011df4584..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelpick_l2.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelshears.png b/games/minimal/mods/basetools/textures/basetools_steelshears.png deleted file mode 100644 index 04c86c370..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelshears.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelshovel.png b/games/minimal/mods/basetools/textures/basetools_steelshovel.png deleted file mode 100644 index 8cab60784..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelshovel.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_steelsword.png b/games/minimal/mods/basetools/textures/basetools_steelsword.png deleted file mode 100644 index 9909365c3..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_steelsword.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stoneaxe.png b/games/minimal/mods/basetools/textures/basetools_stoneaxe.png deleted file mode 100644 index a374c547d..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stoneaxe.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stonepick.png b/games/minimal/mods/basetools/textures/basetools_stonepick.png deleted file mode 100644 index d9156ee3a..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stonepick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stoneshears.png b/games/minimal/mods/basetools/textures/basetools_stoneshears.png deleted file mode 100644 index 0b4bd3b74..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stoneshears.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stoneshovel.png b/games/minimal/mods/basetools/textures/basetools_stoneshovel.png deleted file mode 100644 index 3c1bb48cb..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stoneshovel.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_stonesword.png b/games/minimal/mods/basetools/textures/basetools_stonesword.png deleted file mode 100644 index 6f3e94cda..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_stonesword.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodaxe.png b/games/minimal/mods/basetools/textures/basetools_woodaxe.png deleted file mode 100644 index 4015e910f..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodaxe.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodpick.png b/games/minimal/mods/basetools/textures/basetools_woodpick.png deleted file mode 100644 index 15c61f408..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodpick.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodshears.png b/games/minimal/mods/basetools/textures/basetools_woodshears.png deleted file mode 100644 index 4ff92fd7c..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodshears.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodshovel.png b/games/minimal/mods/basetools/textures/basetools_woodshovel.png deleted file mode 100644 index 6cc52f8a1..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodshovel.png and /dev/null differ diff --git a/games/minimal/mods/basetools/textures/basetools_woodsword.png b/games/minimal/mods/basetools/textures/basetools_woodsword.png deleted file mode 100644 index 364016ed6..000000000 Binary files a/games/minimal/mods/basetools/textures/basetools_woodsword.png and /dev/null differ diff --git a/games/minimal/mods/bucket/init.lua b/games/minimal/mods/bucket/init.lua deleted file mode 100644 index 3189d4aa6..000000000 --- a/games/minimal/mods/bucket/init.lua +++ /dev/null @@ -1,26 +0,0 @@ --- Bucket: Punch liquid source or flowing liquid to collect it - -minetest.register_tool("bucket:bucket", { - description = "Bucket", - inventory_image = "bucket.png", - stack_max = 1, - liquids_pointable = true, - groups = { disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - -- Must be pointing to node - if pointed_thing.type ~= "node" then - return - end - -- Check if pointing to a liquid - local n = minetest.get_node(pointed_thing.under) - local def = minetest.registered_nodes[n.name] - if def ~= nil and (def.liquidtype == "source" or def.liquidtype == "flowing") then - minetest.add_node(pointed_thing.under, {name="air"}) - local inv = user:get_inventory() - if inv then - inv:add_item("main", ItemStack(n.name)) - end - end - end, -}) - diff --git a/games/minimal/mods/bucket/mod.conf b/games/minimal/mods/bucket/mod.conf deleted file mode 100644 index d14deb4ea..000000000 --- a/games/minimal/mods/bucket/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = bucket -description = Minimal bucket to pick up liquids diff --git a/games/minimal/mods/bucket/textures/bucket.png b/games/minimal/mods/bucket/textures/bucket.png deleted file mode 100644 index 677952875..000000000 Binary files a/games/minimal/mods/bucket/textures/bucket.png and /dev/null differ diff --git a/games/minimal/mods/bucket/textures/bucket_lava.png b/games/minimal/mods/bucket/textures/bucket_lava.png deleted file mode 100644 index dfcae65fb..000000000 Binary files a/games/minimal/mods/bucket/textures/bucket_lava.png and /dev/null differ diff --git a/games/minimal/mods/bucket/textures/bucket_water.png b/games/minimal/mods/bucket/textures/bucket_water.png deleted file mode 100644 index e164b0a50..000000000 Binary files a/games/minimal/mods/bucket/textures/bucket_water.png and /dev/null differ diff --git a/games/minimal/mods/chest/init.lua b/games/minimal/mods/chest/init.lua deleted file mode 100644 index c44522cb9..000000000 --- a/games/minimal/mods/chest/init.lua +++ /dev/null @@ -1,27 +0,0 @@ -minetest.register_node("chest:chest", { - description = "Chest", - tiles ={"chest_chest.png^[sheet:2x2:0,0", "chest_chest.png^[sheet:2x2:0,0", - "chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:1,0", - "chest_chest.png^[sheet:2x2:1,0", "chest_chest.png^[sheet:2x2:0,1"}, - paramtype2 = "facedir", - groups = {dig_immediate=2,choppy=3}, - is_ground_content = false, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[8,9]".. - "list[current_name;main;0,0;8,4;]".. - "list[current_player;main;0,5;8,4;]" .. - "listring[]") - meta:set_string("infotext", "Chest") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") - end, -}) - - diff --git a/games/minimal/mods/chest/mod.conf b/games/minimal/mods/chest/mod.conf deleted file mode 100644 index 0d7500164..000000000 --- a/games/minimal/mods/chest/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = chest -description = A simple chest to store items diff --git a/games/minimal/mods/chest/textures/chest_chest.png b/games/minimal/mods/chest/textures/chest_chest.png deleted file mode 100644 index 824b4d502..000000000 Binary files a/games/minimal/mods/chest/textures/chest_chest.png and /dev/null differ diff --git a/games/minimal/mods/chest_of_everything/init.lua b/games/minimal/mods/chest_of_everything/init.lua deleted file mode 100644 index 7d61abebf..000000000 --- a/games/minimal/mods/chest_of_everything/init.lua +++ /dev/null @@ -1,135 +0,0 @@ -local F = minetest.formspec_escape - --- Create a detached inventory -local inv_everything = minetest.create_detached_inventory("everything", { - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - return 0 - end, - allow_put = function(inv, listname, index, stack, player) - return 0 - end, - allow_take = function(inv, listname, index, stack, player) - return -1 - end, -}) -local inv_trash = minetest.create_detached_inventory("trash", { - allow_take = function(inv, listname, index, stack, player) - return 0 - end, - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - return 0 - end, - on_put = function(inv, listname, index, stack, player) - inv:set_list("main", {}) - end, -}) -inv_trash:set_size("main", 1) - -local max_page = 1 - -local function get_chest_formspec(page) - local start = 0 + (page-1)*32 - return "size[8,9]".. - "list[detached:everything;main;0,0;8,4;"..start.."]".. - "list[current_player;main;0,5;8,4;]" .. - "label[6,4;Trash:]" .. - "list[detached:trash;main;7,4;1,1]" .. - "button[0,4;1,1;chest_of_everything_prev;"..F("<").."]".. - "button[1,4;1,1;chest_of_everything_next;"..F(">").."]".. - "label[2,4;"..F("Page: "..page).."]".. - "listring[detached:everything;main]".. - "listring[current_player;main]".. - "listring[detached:trash;main]" -end - -minetest.register_node("chest_of_everything:chest", { - description = "Chest of Everything", - tiles ={"chest_of_everything_chest.png^[sheet:2x2:0,0", "chest_of_everything_chest.png^[sheet:2x2:0,0", - "chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:1,0", - "chest_of_everything_chest.png^[sheet:2x2:1,0", "chest_of_everything_chest.png^[sheet:2x2:0,1"}, - paramtype2 = "facedir", - groups = {dig_immediate=2,choppy=3}, - is_ground_content = false, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Chest of Everything") - meta:set_int("page", 1) - meta:set_string("formspec", get_chest_formspec(1)) - end, - on_receive_fields = function(pos, formname, fields, sender) - if formname == "" then - local meta = minetest.get_meta(pos) - local page = meta:get_int("page") - if fields.chest_of_everything_prev then - page = page - 1 - elseif fields.chest_of_everything_next then - page = page + 1 - end - if page < 1 then - page = 1 - end - if page > max_page then - page = max_page - end - meta:set_int("page", page) - meta:set_string("formspec", get_chest_formspec(page)) - end - end, -}) - -minetest.register_on_mods_loaded(function() - local items = {} - for itemstring,_ in pairs(minetest.registered_items) do - if itemstring ~= "" and itemstring ~= "unknown" and itemstring ~= "ignore" then - table.insert(items, itemstring) - end - end - --[[ Sort items in this order: - * Chest of Everything - * Test tools - * Other tools - * Craftitems - * Other items - * Dummy items ]] - local function compare(item1, item2) - local def1 = minetest.registered_items[item1] - local def2 = minetest.registered_items[item2] - local tool1 = def1.type == "tool" - local tool2 = def2.type == "tool" - local testtool1 = minetest.get_item_group(item1, "testtool") == 1 - local testtool2 = minetest.get_item_group(item2, "testtool") == 1 - local dummy1 = minetest.get_item_group(item1, "dummy") == 1 - local dummy2 = minetest.get_item_group(item2, "dummy") == 1 - local craftitem1 = def1.type == "craft" - local craftitem2 = def2.type == "craft" - if item1 == "chest_of_everything:chest" then - return true - elseif item2 == "chest_of_everything:chest" then - return false - elseif dummy1 and not dummy2 then - return false - elseif not dummy1 and dummy2 then - return true - elseif testtool1 and not testtool2 then - return true - elseif not testtool1 and testtool2 then - return false - elseif tool1 and not tool2 then - return true - elseif not tool1 and tool2 then - return false - elseif craftitem1 and not craftitem2 then - return true - elseif not craftitem1 and craftitem2 then - return false - else - return item1 < item2 - end - end - table.sort(items, compare) - inv_everything:set_size("main", #items) - max_page = math.ceil(#items / 32) - for i=1, #items do - inv_everything:add_item("main", items[i]) - end -end) diff --git a/games/minimal/mods/chest_of_everything/mod.conf b/games/minimal/mods/chest_of_everything/mod.conf deleted file mode 100644 index 4a4425e05..000000000 --- a/games/minimal/mods/chest_of_everything/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = chest_of_everything -description = Adds the chest of everything from which you can take all items diff --git a/games/minimal/mods/chest_of_everything/textures/chest_of_everything_chest.png b/games/minimal/mods/chest_of_everything/textures/chest_of_everything_chest.png deleted file mode 100644 index 6b2fd58d5..000000000 Binary files a/games/minimal/mods/chest_of_everything/textures/chest_of_everything_chest.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/init.lua b/games/minimal/mods/dignodes/init.lua deleted file mode 100644 index 833150873..000000000 --- a/games/minimal/mods/dignodes/init.lua +++ /dev/null @@ -1,37 +0,0 @@ -local groups = { - "cracky", "dig_immediate" -} - --- Register dig nodes with 1 digging group, a rating between 1-3 and a level between 0-2 -for g=1, #groups do - local gr = groups[g] - for r=1, 3 do - for l=0, 2 do - if not (gr=="dig_immediate" and (l>0 or r==1)) then - local d - if l > 0 then - d = string.format("Dig Test Node: %s=%d, level=%d", gr, r, l) - else - d = string.format("Dig Test Node: %s=%d", gr, r) - end - local tile = "dignodes_"..gr..".png^dignodes_rating"..r..".png" - if l==1 then - tile = tile .. "^[colorize:#FFFF00:127" - elseif l==2 then - tile = tile .. "^[colorize:#FF0000:127" - end - minetest.register_node("dignodes:"..gr.."_"..r.."_"..l, { - description = d, - tiles = { tile }, - groups = { [gr] = r, level = l }, - }) - end - end - end -end - --- Node without any digging groups -minetest.register_node("dignodes:none", { - description = "Dig Test Node: groupless", - tiles = {"dignodes_none.png"}, -}) diff --git a/games/minimal/mods/dignodes/mod.conf b/games/minimal/mods/dignodes/mod.conf deleted file mode 100644 index 52a80d66e..000000000 --- a/games/minimal/mods/dignodes/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = dignodes -description = Nodes with different digging groups diff --git a/games/minimal/mods/dignodes/textures/dignodes_choppy.png b/games/minimal/mods/dignodes/textures/dignodes_choppy.png deleted file mode 100644 index a73fc2424..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_choppy.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_cracky.png b/games/minimal/mods/dignodes/textures/dignodes_cracky.png deleted file mode 100644 index eb84e3079..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_cracky.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_crumbly.png b/games/minimal/mods/dignodes/textures/dignodes_crumbly.png deleted file mode 100644 index 23f2f7c71..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_crumbly.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_dig_immediate.png b/games/minimal/mods/dignodes/textures/dignodes_dig_immediate.png deleted file mode 100644 index a532ad90b..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_dig_immediate.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_none.png b/games/minimal/mods/dignodes/textures/dignodes_none.png deleted file mode 100644 index 60f13650b..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_none.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_rating1.png b/games/minimal/mods/dignodes/textures/dignodes_rating1.png deleted file mode 100644 index d2fee3a23..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_rating1.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_rating2.png b/games/minimal/mods/dignodes/textures/dignodes_rating2.png deleted file mode 100644 index 15329b93f..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_rating2.png and /dev/null differ diff --git a/games/minimal/mods/dignodes/textures/dignodes_rating3.png b/games/minimal/mods/dignodes/textures/dignodes_rating3.png deleted file mode 100644 index 37216bfd1..000000000 Binary files a/games/minimal/mods/dignodes/textures/dignodes_rating3.png and /dev/null differ diff --git a/games/minimal/mods/experimental/commands.lua b/games/minimal/mods/experimental/commands.lua deleted file mode 100644 index 96f8cbe39..000000000 --- a/games/minimal/mods/experimental/commands.lua +++ /dev/null @@ -1,215 +0,0 @@ -minetest.register_chatcommand("test_inv", { - params = "", - description = "Test: Modify player's inventory formspec", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - player:set_inventory_formspec( - "size[13,7.5]".. - "image[6,0.6;1,2;player.png]".. - "list[current_player;main;5,3.5;8,4;]".. - "list[current_player;craft;8,0;3,3;]".. - "list[current_player;craftpreview;12,1;1,1;]".. - "list[detached:test_inventory;main;0,0;4,6;0]".. - "button[0.5,7;2,1;button1;Button 1]".. - "button_exit[2.5,7;2,1;button2;Exit Button]") - return true, "Done." - end, -}) - -minetest.register_chatcommand("test_bulk_set_node", { - params = "", - description = "Test: Bulk-set 9×9×9 stone nodes", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local pos_list = {} - local ppos = player:get_pos() - local i = 1 - for x=2,10 do - for y=2,10 do - for z=2,10 do - pos_list[i] = {x=ppos.x + x,y = ppos.y + y,z = ppos.z + z} - i = i + 1 - end - end - end - minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) - return true, "Done." - end, -}) - -minetest.register_chatcommand("bench_bulk_set_node", { - params = "", - description = "Benchmark: Bulk-set 99×99×99 stone nodes", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local pos_list = {} - local ppos = player:get_pos() - local i = 1 - for x=2,100 do - for y=2,100 do - for z=2,100 do - pos_list[i] = {x=ppos.x + x,y = ppos.y + y,z = ppos.z + z} - i = i + 1 - end - end - end - - minetest.chat_send_player(name, "Benchmarking minetest.bulk_set_node. Warming up ..."); - - -- warm up with stone to prevent having different callbacks - -- due to different node topology - minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) - - minetest.chat_send_player(name, "Warming up finished, now benchmarking ..."); - - local start_time = minetest.get_us_time() - for i=1,#pos_list do - minetest.set_node(pos_list[i], {name = "mapgen_stone"}) - end - local middle_time = minetest.get_us_time() - minetest.bulk_set_node(pos_list, {name = "mapgen_stone"}) - local end_time = minetest.get_us_time() - local msg = string.format("Benchmark results: minetest.set_node loop: %.2f ms; minetest.bulk_set_node: %.2f ms", - ((middle_time - start_time)) / 1000, - ((end_time - middle_time)) / 1000 - ) - return true, msg - end, -}) - -local function advance_pos(pos, start_pos, advance_z) - if advance_z then - pos.z = pos.z + 2 - pos.x = start_pos.x - else - pos.x = pos.x + 2 - end - if pos.x > 30900 or pos.x - start_pos.x > 46 then - pos.x = start_pos.x - pos.z = pos.z + 2 - end - if pos.z > 30900 then - -- We ran out of space! Aborting - aborted = true - return false - end - return pos -end - -local function place_nodes(param) - local nodes = param.nodes - local name = param.name - local pos = param.pos - local start_pos = param.start_pos - table.sort(nodes) - minetest.chat_send_player(name, "Placing nodes …") - local nodes_placed = 0 - for n=1, #nodes do - local itemstring = nodes[n] - local def = minetest.registered_nodes[itemstring] - local p2_max = 0 - if param.param ~= "no_param2" then - -- Also test the param2 values of the nodes - -- ... but we only use permissible param2 values - if def.paramtype2 == "wallmounted" then - p2_max = 5 - elseif def.paramtype2 == "facedir" then - p2_max = 23 - elseif def.paramtype2 == "glasslikeliquidlevel" then - p2_max = 63 - elseif def.paramtype2 == "meshoptions" and def.drawtype == "plantlike" then - p2_max = 63 - elseif def.paramtype2 == "leveled" then - p2_max = 127 - elseif def.paramtype2 == "degrotate" and def.drawtype == "plantlike" then - p2_max = 179 - elseif def.paramtype2 == "colorfacedir" or - def.paramtype2 == "colorwallmounted" or - def.paramtype2 == "color" then - p2_max = 255 - end - end - for p2 = 0, p2_max do - -- Skip undefined param2 values - if not ((def.paramtype2 == "meshoptions" and p2 % 8 > 4) or - (def.paramtype2 == "colorwallmounted" and p2 % 8 > 5) or - (def.paramtype2 == "colorfacedir" and p2 % 32 > 23)) then - - minetest.set_node(pos, { name = itemstring, param2 = p2 }) - nodes_placed = nodes_placed + 1 - pos = advance_pos(pos, start_pos) - if not pos then - aborted = true - break - end - end - end - if aborted then - break - end - end - if aborted then - minetest.chat_send_player(name, "Not all nodes could be placed, please move further away from the world boundary. Nodes placed: "..nodes_placed) - end - minetest.chat_send_player(name, "Nodes placed: "..nodes_placed..".") -end - -local function after_emerge(blockpos, action, calls_remaining, param) - if calls_remaining == 0 then - place_nodes(param) - end -end - -minetest.register_chatcommand("test_place_nodes", { - params = "[ no_param2 ]", - description = "Test: Place all non-experimental nodes and optionally their permissible param2 variants", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local pos = vector.floor(player:get_pos()) - pos.x = math.ceil(pos.x + 3) - pos.z = math.ceil(pos.z + 3) - pos.y = math.ceil(pos.y + 1) - local start_pos = table.copy(pos) - if pos.x > 30800 then - return false, "Too close to world boundary (+X). Please move to X < 30800." - end - if pos.z > 30800 then - return false, "Too close to world boundary (+Z). Please move to Z < 30800." - end - - local aborted = false - local nodes = {} - local emerge_estimate = 0 - for itemstring, def in pairs(minetest.registered_nodes) do - if itemstring ~= "ignore" and string.sub(itemstring, 1, 13) ~= "experimental:" then - table.insert(nodes, itemstring) - if def.paramtype2 == 0 then - emerge_estimate = emerge_estimate + 1 - else - emerge_estimate = emerge_estimate + 255 - end - end - end - -- Emerge area to make sure that all nodes are being placed. - -- Note we will emerge much more than we need to (overestimation), - -- the estimation code could be improved performance-wise … - local length = 16 + math.ceil(emerge_estimate / 24) * 2 - minetest.emerge_area(start_pos, - { x = start_pos.x + 46, y = start_pos.y, z = start_pos.z + length }, - after_emerge, { nodes = nodes, name = name, pos = pos, start_pos = start_pos, param = param }) - return true, "Emerging area …" - end, -}) - diff --git a/games/minimal/mods/experimental/detached.lua b/games/minimal/mods/experimental/detached.lua deleted file mode 100644 index 673adfdd4..000000000 --- a/games/minimal/mods/experimental/detached.lua +++ /dev/null @@ -1,29 +0,0 @@ --- Create a detached inventory -local inv = minetest.create_detached_inventory("test_inventory", { - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - experimental.print_to_everything("allow move asked") - return count -- Allow all - end, - allow_put = function(inv, listname, index, stack, player) - experimental.print_to_everything("allow put asked") - return 1 -- Allow only 1 - end, - allow_take = function(inv, listname, index, stack, player) - experimental.print_to_everything("allow take asked") - return 4 -- Allow 4 at max - end, - on_move = function(inv, from_list, from_index, to_list, to_index, count, player) - experimental.print_to_everything(player:get_player_name().." moved items") - end, - on_put = function(inv, listname, index, stack, player) - experimental.print_to_everything(player:get_player_name().." put items") - end, - on_take = function(inv, listname, index, stack, player) - experimental.print_to_everything(player:get_player_name().." took items") - end, -}) -inv:set_size("main", 4*6) -inv:add_item("main", "experimental:callback_node") -inv:add_item("main", "experimental:particle_spawner") - - diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua deleted file mode 100644 index b292f792e..000000000 --- a/games/minimal/mods/experimental/init.lua +++ /dev/null @@ -1,23 +0,0 @@ --- --- Experimental things --- - -experimental = {} - -dofile(minetest.get_modpath("experimental").."/detached.lua") -dofile(minetest.get_modpath("experimental").."/items.lua") -dofile(minetest.get_modpath("experimental").."/commands.lua") - -function experimental.print_to_everything(msg) - minetest.log("action", msg) - minetest.chat_send_all(msg) -end - -minetest.log("info", "[experimental] modname="..dump(minetest.get_current_modname())) -minetest.log("info", "[experimental] modpath="..dump(minetest.get_modpath("experimental"))) -minetest.log("info", "[experimental] worldpath="..dump(minetest.get_worldpath())) - - -minetest.register_on_mods_loaded(function() - minetest.log("action", "[experimental] on_mods_loaded()") -end) diff --git a/games/minimal/mods/experimental/items.lua b/games/minimal/mods/experimental/items.lua deleted file mode 100644 index 51b063ba2..000000000 --- a/games/minimal/mods/experimental/items.lua +++ /dev/null @@ -1,103 +0,0 @@ -minetest.register_node("experimental:callback_node", { - description = "Callback Test Node (construct/destruct/timer)", - tiles = {"experimental_callback_node.png"}, - groups = {dig_immediate=3}, - -- This was known to cause a bug in minetest.item_place_node() when used - -- via minetest.place_node(), causing a placer with no position - paramtype2 = "facedir", - drop = "", - - on_construct = function(pos) - experimental.print_to_everything("experimental:callback_node:on_construct("..minetest.pos_to_string(pos)..")") - local meta = minetest.get_meta(pos) - meta:set_string("mine", "test") - local timer = minetest.get_node_timer(pos) - timer:start(4, 3) - end, - - after_place_node = function(pos, placer) - experimental.print_to_everything("experimental:callback_node:after_place_node("..minetest.pos_to_string(pos)..")") - local meta = minetest.get_meta(pos) - if meta:get_string("mine") == "test" then - experimental.print_to_everything("correct metadata found") - else - experimental.print_to_everything("incorrect metadata found") - end - end, - - on_destruct = function(pos) - experimental.print_to_everything("experimental:callback_node:on_destruct("..minetest.pos_to_string(pos)..")") - end, - - after_destruct = function(pos) - experimental.print_to_everything("experimental:callback_node:after_destruct("..minetest.pos_to_string(pos)..")") - end, - - after_dig_node = function(pos, oldnode, oldmetadata, digger) - experimental.print_to_everything("experimental:callback_node:after_dig_node("..minetest.pos_to_string(pos)..")") - end, - - on_timer = function(pos, elapsed) - experimental.print_to_everything("on_timer(): elapsed="..dump(elapsed)) - return true - end, -}) - -minetest.register_tool("experimental:privatizer", { - description = "Node Meta Privatizer", - inventory_image = "experimental_tester_tool_1.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type == "node" then - local node = minetest.get_node(pointed_thing.under) - if node.name == "chest:chest" then - local p = pointed_thing.under - minetest.log("action", "Privatizer used at "..minetest.pos_to_string(p)) - minetest.get_meta(p):mark_as_private({"infotext", "formspec"}) - if user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), "Chest metadata (infotext, formspec) set private!") - end - return - end - end - if user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), "Privatizer can only be used on chest!") - end - end, -}) - -minetest.register_tool("experimental:particle_spawner", { - description = "Particle Spawner", - inventory_image = "experimental_tester_tool_1.png^[invert:g", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing, true) - if pos == nil then - if user then - pos = user:get_pos() - end - end - pos = vector.add(pos, {x=0, y=0.5, z=0}) - local tex, anim - if math.random(0, 1) == 0 then - tex = "experimental_particle_sheet.png" - anim = {type="sheet_2d", frames_w=3, frames_h=2, frame_length=0.5} - else - tex = "experimental_particle_vertical.png" - anim = {type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3} - end - - minetest.add_particle({ - pos = pos, - velocity = {x=0, y=0, z=0}, - acceleration = {x=0, y=0.04, z=0}, - expirationtime = 6, - collisiondetection = true, - texture = tex, - animation = anim, - size = 4, - glow = math.random(0, 5), - }) - end, -}) - diff --git a/games/minimal/mods/experimental/mod.conf b/games/minimal/mods/experimental/mod.conf deleted file mode 100644 index cf0f9cb42..000000000 --- a/games/minimal/mods/experimental/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = experimental -description = Chaotic mod containing unstructured tests for testing out engine features. The features in this mod should be moved to other mods. diff --git a/games/minimal/mods/experimental/textures/experimental_callback_node.png b/games/minimal/mods/experimental/textures/experimental_callback_node.png deleted file mode 100644 index e9d87434c..000000000 Binary files a/games/minimal/mods/experimental/textures/experimental_callback_node.png and /dev/null differ diff --git a/games/minimal/mods/experimental/textures/experimental_particle_sheet.png b/games/minimal/mods/experimental/textures/experimental_particle_sheet.png deleted file mode 100644 index 6d70394e4..000000000 Binary files a/games/minimal/mods/experimental/textures/experimental_particle_sheet.png and /dev/null differ diff --git a/games/minimal/mods/experimental/textures/experimental_particle_vertical.png b/games/minimal/mods/experimental/textures/experimental_particle_vertical.png deleted file mode 100644 index 0320b7545..000000000 Binary files a/games/minimal/mods/experimental/textures/experimental_particle_vertical.png and /dev/null differ diff --git a/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png b/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png deleted file mode 100644 index 5df416a58..000000000 Binary files a/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png and /dev/null differ diff --git a/games/minimal/mods/give_initial_stuff/init.lua b/games/minimal/mods/give_initial_stuff/init.lua deleted file mode 100644 index 491a531e4..000000000 --- a/games/minimal/mods/give_initial_stuff/init.lua +++ /dev/null @@ -1,37 +0,0 @@ -local give_if_not_gotten_already = function(inv, list, item) - if not inv:contains_item(list, item) then - inv:add_item(list, item) - end -end - -local give_initial_stuff = function(player) - local inv = player:get_inventory() - give_if_not_gotten_already(inv, "main", "basetools:pick_mese") - give_if_not_gotten_already(inv, "main", "basetools:axe_steel") - give_if_not_gotten_already(inv, "main", "basetools:shovel_steel") - give_if_not_gotten_already(inv, "main", "bucket:bucket") - give_if_not_gotten_already(inv, "main", "testnodes:light14") - give_if_not_gotten_already(inv, "main", "chest_of_everything:chest") - minetest.log("action", "[give_initial_stuff] Giving initial stuff to "..player:get_player_name()) -end - -minetest.register_on_newplayer(function(player) - if minetest.settings:get_bool("give_initial_stuff", true) then - give_initial_stuff(player) - end -end) - -minetest.register_chatcommand("stuff", { - params = "", - privs = { give = true }, - description = "Give yourself initial items", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player or not player:is_player() then - return false, "No player." - end - give_initial_stuff(player) - return true - end, -}) - diff --git a/games/minimal/mods/give_initial_stuff/mod.conf b/games/minimal/mods/give_initial_stuff/mod.conf deleted file mode 100644 index 1ba49f52a..000000000 --- a/games/minimal/mods/give_initial_stuff/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = give_initial_stuff -description = Gives items to players on join -depends = basetools, bucket, chest_of_everything, testnodes diff --git a/games/minimal/mods/initial_message/init.lua b/games/minimal/mods/initial_message/init.lua deleted file mode 100644 index f92f4d3cf..000000000 --- a/games/minimal/mods/initial_message/init.lua +++ /dev/null @@ -1,9 +0,0 @@ -minetest.register_on_joinplayer(function(player) - local cb = function(player) - if not player or not player:is_player() then - return - end - minetest.chat_send_player(player:get_player_name(), "This is the \"Minimal development Test\" [minimal], meant only for testing and development. Use Minetest Game for the real thing.") - end - minetest.after(2.0, cb, player) -end) diff --git a/games/minimal/mods/initial_message/mod.conf b/games/minimal/mods/initial_message/mod.conf deleted file mode 100644 index 32aa2ac4e..000000000 --- a/games/minimal/mods/initial_message/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = initial_message -description = Show message to joining players explaining what this testing game is about diff --git a/games/minimal/mods/mapgen/init.lua b/games/minimal/mods/mapgen/init.lua deleted file mode 100644 index 13a186a50..000000000 --- a/games/minimal/mods/mapgen/init.lua +++ /dev/null @@ -1,81 +0,0 @@ --- --- Aliases for map generator outputs --- - --- ESSENTIAL node aliases --- Basic nodes -minetest.register_alias("mapgen_stone", "basenodes:stone") -minetest.register_alias("mapgen_water_source", "basenodes:water_source") -minetest.register_alias("mapgen_river_water_source", "basenodes:river_water_source") - --- Additional essential aliases for v6 -minetest.register_alias("mapgen_lava_source", "basenodes:lava_source") -minetest.register_alias("mapgen_dirt", "basenodes:dirt") -minetest.register_alias("mapgen_dirt_with_grass", "basenodes:dirt_with_grass") -minetest.register_alias("mapgen_sand", "basenodes:sand") -minetest.register_alias("mapgen_tree", "basenodes:tree") -minetest.register_alias("mapgen_leaves", "basenodes:leaves") -minetest.register_alias("mapgen_apple", "basenodes:apple") - --- Essential alias for dungeons -minetest.register_alias("mapgen_cobble", "basenodes:cobble") - --- Optional aliases for v6 (they all have fallback values in the engine) -if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then - minetest.register_alias("mapgen_gravel", "basenodes:gravel") - minetest.register_alias("mapgen_desert_stone", "basenodes:desert_stone") - minetest.register_alias("mapgen_desert_sand", "basenodes:desert_sand") - minetest.register_alias("mapgen_dirt_with_snow", "basenodes:dirt_with_snow") - minetest.register_alias("mapgen_snowblock", "basenodes:snowblock") - minetest.register_alias("mapgen_snow", "basenodes:snow") - minetest.register_alias("mapgen_ice", "basenodes:ice") - minetest.register_alias("mapgen_junglegrass", "basenodes:junglegrass") - minetest.register_alias("mapgen_jungletree", "basenodes:jungletree") - minetest.register_alias("mapgen_jungleleaves", "basenodes:jungleleaves") - minetest.register_alias("mapgen_pine_tree", "basenodes:pine_tree") - minetest.register_alias("mapgen_pine_needles", "basenodes:pine_needles") -end --- Optional alias for mossycobble (should fall back to cobble) -if minetest.settings:get_bool("devtest_dungeon_mossycobble", false) then - minetest.register_alias("mapgen_mossycobble", "basenodes:mossycobble") -end --- Optional aliases for dungeon stairs (should fall back to full nodes) -if minetest.settings:get_bool("devtest_dungeon_stairs", false) then - minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") - if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then - minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone") - end -end - --- --- Register biomes for biome API --- - -minetest.clear_registered_biomes() -minetest.clear_registered_decorations() - -if minetest.settings:get_bool("devtest_register_biomes", true) then - minetest.register_biome({ - name = "mapgen:grassland", - node_top = "basenodes:dirt_with_grass", - depth_top = 1, - node_filler = "basenodes:dirt", - depth_filler = 1, - y_min = 5, - y_max = 31000, - heat_point = 50, - humidity_point = 50, - }) - - minetest.register_biome({ - name = "mapgen:grassland_ocean", - node_top = "basenodes:sand", - depth_top = 1, - node_filler = "basenodes:sand", - depth_filler = 2, - y_min = -31000, - y_max = 4, - heat_point = 50, - humidity_point = 50, - }) -end diff --git a/games/minimal/mods/mapgen/mod.conf b/games/minimal/mods/mapgen/mod.conf deleted file mode 100644 index 15750ccbe..000000000 --- a/games/minimal/mods/mapgen/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = mapgen -description = Minimal map generator -depends = basenodes diff --git a/games/minimal/mods/modchannels/init.lua b/games/minimal/mods/modchannels/init.lua deleted file mode 100644 index ee925f09b..000000000 --- a/games/minimal/mods/modchannels/init.lua +++ /dev/null @@ -1,14 +0,0 @@ --- --- Mod channels experimental handlers --- -local mod_channel = minetest.mod_channel_join("experimental_preview") - -minetest.register_on_modchannel_message(function(channel, sender, message) - minetest.log("action", "[modchannels] Server received message `" .. message - .. "` on channel `" .. channel .. "` from sender `" .. sender .. "`") - - if mod_channel:is_writeable() then - mod_channel:send_all("experimental answers to preview") - mod_channel:leave() - end -end) diff --git a/games/minimal/mods/modchannels/mod.conf b/games/minimal/mods/modchannels/mod.conf deleted file mode 100644 index 7c13aadfb..000000000 --- a/games/minimal/mods/modchannels/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = modchannels -description = Add experimental mod channel handlers diff --git a/games/minimal/mods/soundstuff/init.lua b/games/minimal/mods/soundstuff/init.lua deleted file mode 100644 index 22012ba14..000000000 --- a/games/minimal/mods/soundstuff/init.lua +++ /dev/null @@ -1,170 +0,0 @@ -local simple_nodes = { - footstep = { "Footstep Sound Node", "soundstuff_node_footstep.png" }, - dig = { "Dig Sound Node", "soundstuff_node_dig.png" }, - dug = { "Dug Sound Node", "soundstuff_node_dug.png" }, - place = { "Place Sound Node", "soundstuff_node_place.png" }, - place_failed = { "Place Failed Sound Node", "soundstuff_node_place_failed.png" }, -} - -for k,v in pairs(simple_nodes) do - minetest.register_node("soundstuff:"..k, { - description = v[1], - tiles = {"soundstuff_node_sound.png","soundstuff_node_sound.png",v[2]}, - groups = {dig_immediate=2}, - sounds = { - [k] = { name = "soundstuff_mono", gain = 1.0 }, - } - }) -end - -minetest.register_node("soundstuff:place_failed_attached", { - description = "Attached Place Failed Sound Node", - tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_place_failed.png"}, - groups = {dig_immediate=2, attached_node=1}, - drawtype = "nodebox", - paramtype = "light", - node_box = { type = "fixed", fixed = { - { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 }, - { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 }, - }}, - sounds = { - place_failed = { name = "soundstuff_mono", gain = 1.0 }, - }, -}) - -minetest.register_node("soundstuff:fall", { - description = "Fall Sound Node", - tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"}, - groups = {dig_immediate=2, falling_node=1}, - sounds = { - fall = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - -minetest.register_node("soundstuff:fall_attached", { - description = "Attached Fall Sound Node", - tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"}, - groups = {dig_immediate=2, attached_node=1}, - drawtype = "nodebox", - paramtype = "light", - node_box = { type = "fixed", fixed = { - { -7/16, -7/16, -7/16, 7/16, 7/16, 7/16 }, - { -0.5, -0.5, -0.5, 0.5, -7/16, 0.5 }, - }}, - sounds = { - fall = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - -minetest.register_node("soundstuff:footstep_liquid", { - description = "Liquid Footstep Sound Node", - drawtype = "liquid", - tiles = { - "soundstuff_node_sound.png^[colorize:#0000FF:127", - }, - special_tiles = { - {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = false}, - {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = true}, - }, - liquids_pointable = true, - liquidtype = "source", - liquid_alternative_flowing = "soundstuff:footstep_liquid", - liquid_alternative_source = "soundstuff:footstep_liquid", - liquid_renewable = false, - liquid_range = 0, - liquid_viscosity = 0, - alpha = 190, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - post_effect_color = {a = 64, r = 0, g = 0, b = 200}, - sounds = { - footstep = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - -minetest.register_node("soundstuff:footstep_climbable", { - description = "Climbable Footstep Sound Node", - drawtype = "allfaces", - tiles = { - "soundstuff_node_climbable.png", - }, - alpha = 120, - paramtype = "light", - sunlight_propagates = true, - walkable = false, - climbable = true, - is_ground_content = false, - groups = { dig_immediate = 2 }, - sounds = { - footstep = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - - - -minetest.register_craftitem("soundstuff:eat", { - description = "Eat Sound Item", - inventory_image = "soundstuff_eat.png", - on_use = minetest.item_eat(0), - sound = { - eat = { name = "soundstuff_mono", gain = 1.0 }, - } -}) - -minetest.register_tool("soundstuff:breaks", { - description = "Break Sound Tool", - inventory_image = "soundstuff_node_dug.png", - sound = { - breaks = { name = "soundstuff_mono", gain = 1.0 }, - }, - tool_capabilities = { - max_drop_level=0, - groupcaps={ - cracky={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, - choppy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, - snappy={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, - crumbly={times={[2]=2.00, [3]=1.20}, uses=1, maxlevel=0}, - }, - }, -}) - --- Plays sound repeatedly -minetest.register_node("soundstuff:positional", { - description = "Positional Sound Node", - on_construct = function(pos) - local timer = minetest.get_node_timer(pos) - timer:start(0) - end, - on_timer = function(pos, elapsed) - local node = minetest.get_node(pos) - local dist = node.param2 - if dist == 0 then - dist = nil - end - minetest.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist }) - local timer = minetest.get_node_timer(pos) - timer:start(0.7) - end, - on_rightclick = function(pos, node, clicker) - node.param2 = (node.param2 + 1) % 64 - minetest.set_node(pos, node) - if clicker and clicker:is_player() then - local dist = node.param2 - local diststr - if dist == 0 then - diststr = "" - else - diststr = tostring(dist) - end - minetest.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr) - end - end, - - groups = { dig_immediate = 2 }, - tiles = { "soundstuff_node_sound.png" }, -}) - diff --git a/games/minimal/mods/soundstuff/mod.conf b/games/minimal/mods/soundstuff/mod.conf deleted file mode 100644 index 2c631e2da..000000000 --- a/games/minimal/mods/soundstuff/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = soundstuff -description = Example items and nodes for testing sound effects diff --git a/games/minimal/mods/soundstuff/sounds/soundstuff_mono.ogg b/games/minimal/mods/soundstuff/sounds/soundstuff_mono.ogg deleted file mode 100644 index 43428d566..000000000 Binary files a/games/minimal/mods/soundstuff/sounds/soundstuff_mono.ogg and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_eat.png b/games/minimal/mods/soundstuff/textures/soundstuff_eat.png deleted file mode 100644 index aed205422..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_eat.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_blank.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_blank.png deleted file mode 100644 index 4dffacc4c..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_blank.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_climbable.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_climbable.png deleted file mode 100644 index 3888f793c..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_climbable.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_dig.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_dig.png deleted file mode 100644 index 67ba111d8..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_dig.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_dug.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_dug.png deleted file mode 100644 index bab5fbe51..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_dug.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_fall.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_fall.png deleted file mode 100644 index 17b14f1e4..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_fall.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_footstep.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_footstep.png deleted file mode 100644 index 6367ae909..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_footstep.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_place.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_place.png deleted file mode 100644 index d159ad533..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_place.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_place_failed.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_place_failed.png deleted file mode 100644 index 780ba946d..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_place_failed.png and /dev/null differ diff --git a/games/minimal/mods/soundstuff/textures/soundstuff_node_sound.png b/games/minimal/mods/soundstuff/textures/soundstuff_node_sound.png deleted file mode 100644 index 0592a0299..000000000 Binary files a/games/minimal/mods/soundstuff/textures/soundstuff_node_sound.png and /dev/null differ diff --git a/games/minimal/mods/stairs/init.lua b/games/minimal/mods/stairs/init.lua deleted file mode 100644 index 2701cabab..000000000 --- a/games/minimal/mods/stairs/init.lua +++ /dev/null @@ -1,65 +0,0 @@ -stairs = {} - --- Node will be called stairs:stair_ -function stairs.register_stair(subname, recipeitem, groups, images, description) - minetest.register_node(":stairs:stair_" .. subname, { - description = description, - drawtype = "nodebox", - tiles = images, - paramtype = "light", - paramtype2 = "facedir", - is_ground_content = true, - groups = groups, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - {-0.5, 0, 0, 0.5, 0.5, 0.5}, - }, - }, - }) -end - --- Node will be called stairs:slab_ -function stairs.register_slab(subname, recipeitem, groups, images, description) - minetest.register_node(":stairs:slab_" .. subname, { - description = description, - drawtype = "nodebox", - tiles = images, - paramtype = "light", - is_ground_content = true, - groups = groups, - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - }, - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, - }, - }) -end - --- Nodes will be called stairs:{stair,slab}_ -function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab) - stairs.register_stair(subname, recipeitem, groups, images, desc_stair) - stairs.register_slab(subname, recipeitem, groups, images, desc_slab) -end - -stairs.register_stair_and_slab("stone", "basenodes:stone", - {cracky=3}, - {"default_stone.png"}, - "Stone Stair", - "Stone Slab") - -stairs.register_stair_and_slab("desert_stone", "basenodes:desert_stone", - {cracky=3}, - {"default_desert_stone.png"}, - "Desert Stone Stair", - "Desert Stone Slab") - -stairs.register_stair_and_slab("cobble", "basenodes:cobble", - {cracky=3}, - {"default_cobble.png"}, - "Cobblestone Stair", - "Cobblestone Slab") diff --git a/games/minimal/mods/stairs/mod.conf b/games/minimal/mods/stairs/mod.conf deleted file mode 100644 index 724bff881..000000000 --- a/games/minimal/mods/stairs/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = stairs -description = Adds stairs and slabs -depends = basenodes diff --git a/games/minimal/mods/testentities/armor.lua b/games/minimal/mods/testentities/armor.lua deleted file mode 100644 index 4c30cec8d..000000000 --- a/games/minimal/mods/testentities/armor.lua +++ /dev/null @@ -1,41 +0,0 @@ --- Armorball: Test entity for testing armor groups --- Rightclick to change armor group - -local phasearmor = { - [0]={icy=100}, - [1]={firy=100}, - [2]={fleshy=100}, - [3]={immortal=1}, - [4]={punch_operable=1}, -} - -minetest.register_entity("testentities:armorball", { - initial_properties = { - hp_max = 20, - physical = false, - collisionbox = {-0.4,-0.4,-0.4, 0.4,0.4,0.4}, - visual = "sprite", - visual_size = {x=1, y=1}, - textures = {"testentities_armorball.png"}, - spritediv = {x=1, y=5}, - initial_sprite_basepos = {x=0, y=0}, - }, - - _phase = 2, - - on_activate = function(self, staticdata) - minetest.log("action", "[testentities] armorball.on_activate") - self.object:set_armor_groups(phasearmor[self._phase]) - self.object:set_sprite({x=0, y=self._phase}) - end, - - on_rightclick = function(self, clicker) - -- Change armor group and sprite - self._phase = self._phase + 1 - if self._phase >= 5 then - self._phase = 0 - end - self.object:set_sprite({x=0, y=self._phase}) - self.object:set_armor_groups(phasearmor[self._phase]) - end, -}) diff --git a/games/minimal/mods/testentities/callbacks.lua b/games/minimal/mods/testentities/callbacks.lua deleted file mode 100644 index 711079f87..000000000 --- a/games/minimal/mods/testentities/callbacks.lua +++ /dev/null @@ -1,75 +0,0 @@ --- Entities that test their callbacks - -local message = function(msg) - minetest.log("action", msg) - minetest.chat_send_all(msg) -end - -local get_object_name = function(obj) - local name = "" - if obj then - if obj:is_player() then - name = obj:get_player_name() - else - name = "" - end - end - return name -end - -local spos = function(self) - return minetest.pos_to_string(vector.round(self.object:get_pos())) -end - --- Callback test entity (all callbacks except on_step) -minetest.register_entity("testentities:callback", { - initial_properties = { - visual = "upright_sprite", - textures = { "testentities_callback.png" }, - }, - - on_activate = function(self, staticdata, dtime_s) - message("Callback entity: on_activate! pos="..spos(self).."; dtime_s="..dtime_s) - end, - on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) - local name = get_object_name(puncher) - message( - "Callback entity: on_punch! ".. - "pos="..spos(self).."; puncher="..name.."; ".. - "time_from_last_punch="..time_from_last_punch.."; ".. - "tool_capabilities="..tostring(dump(tool_capabilities)).."; ".. - "dir="..tostring(dump(dir)).."; damage="..damage) - end, - on_rightclick = function(self, clicker) - local name = get_object_name(clicker) - message("Callback entity: on_rightclick! pos="..spos(self).."; clicker="..name) - end, - on_death = function(self, killer) - local name = get_object_name(killer) - message("Callback entity: on_death! pos="..spos(self).."; killer="..name) - end, - on_attach_child = function(self, child) - local name = get_object_name(child) - message("Callback entity: on_attach_child! pos="..spos(self).."; child="..name) - end, - on_detach_child = function(self, child) - local name = get_object_name(child) - message("Callback entity: on_detach_child! pos="..spos(self).."; child="..name) - end, - on_detach = function(self, parent) - local name = get_object_name(parent) - message("Callback entity: on_detach! pos="..spos(self).."; parent="..name) - end, - get_staticdata = function(self) - message("Callback entity: get_staticdata! pos="..spos(self)) - end, -}) - --- Only test on_step callback -minetest.register_entity("testentities:callback_step", { - visual = "upright_sprite", - textures = { "testentities_callback_step.png" }, - on_step = function(self, dtime) - message("on_step callback entity: on_step! pos="..spos(self).."; dtime="..dtime) - end, -}) diff --git a/games/minimal/mods/testentities/init.lua b/games/minimal/mods/testentities/init.lua deleted file mode 100644 index df8c72ea7..000000000 --- a/games/minimal/mods/testentities/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -dofile(minetest.get_modpath("testentities").."/visuals.lua") -dofile(minetest.get_modpath("testentities").."/armor.lua") -dofile(minetest.get_modpath("testentities").."/callbacks.lua") diff --git a/games/minimal/mods/testentities/mod.conf b/games/minimal/mods/testentities/mod.conf deleted file mode 100644 index 7a8cb5a3e..000000000 --- a/games/minimal/mods/testentities/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testentities -description = Example entities for testing diff --git a/games/minimal/mods/testentities/textures/testentities_armorball.png b/games/minimal/mods/testentities/textures/testentities_armorball.png deleted file mode 100644 index 88147bd1f..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_armorball.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_callback.png b/games/minimal/mods/testentities/textures/testentities_callback.png deleted file mode 100644 index c4c9066d1..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_callback.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_callback_step.png b/games/minimal/mods/testentities/textures/testentities_callback_step.png deleted file mode 100644 index b67506a97..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_callback_step.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube1.png b/games/minimal/mods/testentities/textures/testentities_cube1.png deleted file mode 100644 index c667e425f..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube1.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube2.png b/games/minimal/mods/testentities/textures/testentities_cube2.png deleted file mode 100644 index 481823420..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube2.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube3.png b/games/minimal/mods/testentities/textures/testentities_cube3.png deleted file mode 100644 index 03b5daa15..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube3.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube4.png b/games/minimal/mods/testentities/textures/testentities_cube4.png deleted file mode 100644 index 639204896..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube4.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube5.png b/games/minimal/mods/testentities/textures/testentities_cube5.png deleted file mode 100644 index d8acdf0b6..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube5.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_cube6.png b/games/minimal/mods/testentities/textures/testentities_cube6.png deleted file mode 100644 index 5f81a64d9..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_cube6.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_dungeon_master.png b/games/minimal/mods/testentities/textures/testentities_dungeon_master.png deleted file mode 100644 index 1e3107746..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_dungeon_master.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_sprite.png b/games/minimal/mods/testentities/textures/testentities_sprite.png deleted file mode 100644 index a4b019699..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_sprite.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_upright_sprite1.png b/games/minimal/mods/testentities/textures/testentities_upright_sprite1.png deleted file mode 100644 index 6242511df..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_upright_sprite1.png and /dev/null differ diff --git a/games/minimal/mods/testentities/textures/testentities_upright_sprite2.png b/games/minimal/mods/testentities/textures/testentities_upright_sprite2.png deleted file mode 100644 index a79a760e3..000000000 Binary files a/games/minimal/mods/testentities/textures/testentities_upright_sprite2.png and /dev/null differ diff --git a/games/minimal/mods/testentities/visuals.lua b/games/minimal/mods/testentities/visuals.lua deleted file mode 100644 index de346fd68..000000000 --- a/games/minimal/mods/testentities/visuals.lua +++ /dev/null @@ -1,74 +0,0 @@ --- Minimal test entities to test visuals - -minetest.register_entity("testentities:sprite", { - initial_properties = { - visual = "sprite", - textures = { "testentities_sprite.png" }, - }, -}) - -minetest.register_entity("testentities:upright_sprite", { - initial_properties = { - visual = "upright_sprite", - textures = { - "testentities_upright_sprite1.png", - "testentities_upright_sprite2.png", - }, - }, -}) - -minetest.register_entity("testentities:cube", { - initial_properties = { - visual = "cube", - textures = { - "testentities_cube1.png", - "testentities_cube2.png", - "testentities_cube3.png", - "testentities_cube4.png", - "testentities_cube5.png", - "testentities_cube6.png", - }, - }, -}) - -minetest.register_entity("testentities:item", { - initial_properties = { - visual = "item", - wield_item = "testnodes:normal", - }, -}) - -minetest.register_entity("testentities:wielditem", { - initial_properties = { - visual = "wielditem", - wield_item = "testnodes:normal", - }, -}) - -minetest.register_entity("testentities:mesh", { - initial_properties = { - visual = "mesh", - mesh = "testnodes_pyramid.obj", - textures = { - "testnodes_mesh_stripes2.png" - }, - }, -}) - --- Advanced visual tests - --- A test entity for testing animated and yaw-modulated sprites -minetest.register_entity("testentities:yawsprite", { - initial_properties = { - selectionbox = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3}, - visual = "sprite", - visual_size = {x=0.6666, y=1}, - textures = {"testentities_dungeon_master.png^[makealpha:128,0,0^[makealpha:128,128,0"}, - spritediv = {x=6, y=5}, - initial_sprite_basepos = {x=0, y=0}, - on_activate = function(self, staticdata) - self.object:set_sprite({x=0, y=0}, 1, 0, true) - end, - }, -}) - diff --git a/games/minimal/mods/testfood/init.lua b/games/minimal/mods/testfood/init.lua deleted file mode 100644 index a6236ff68..000000000 --- a/games/minimal/mods/testfood/init.lua +++ /dev/null @@ -1,24 +0,0 @@ -local S = minetest.get_translator("testfood") - -minetest.register_craftitem("testfood:good1", { - description = S("Good Food (+1)"), - inventory_image = "testfood_good.png", - on_use = minetest.item_eat(1), -}) -minetest.register_craftitem("testfood:good5", { - description = S("Good Food (+5)"), - inventory_image = "testfood_good2.png", - on_use = minetest.item_eat(5), -}) - -minetest.register_craftitem("testfood:bad1", { - description = S("Bad Food (-1)"), - inventory_image = "testfood_bad.png", - on_use = minetest.item_eat(-1), -}) -minetest.register_craftitem("testfood:bad5", { - description = S("Bad Food (-5)"), - inventory_image = "testfood_bad2.png", - on_use = minetest.item_eat(-5), -}) - diff --git a/games/minimal/mods/testfood/mod.conf b/games/minimal/mods/testfood/mod.conf deleted file mode 100644 index 7bff21b6e..000000000 --- a/games/minimal/mods/testfood/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testfood -description = For testing food items diff --git a/games/minimal/mods/testfood/textures/testfood_bad.png b/games/minimal/mods/testfood/textures/testfood_bad.png deleted file mode 100644 index 6e9251440..000000000 Binary files a/games/minimal/mods/testfood/textures/testfood_bad.png and /dev/null differ diff --git a/games/minimal/mods/testfood/textures/testfood_bad2.png b/games/minimal/mods/testfood/textures/testfood_bad2.png deleted file mode 100644 index 22b567890..000000000 Binary files a/games/minimal/mods/testfood/textures/testfood_bad2.png and /dev/null differ diff --git a/games/minimal/mods/testfood/textures/testfood_good.png b/games/minimal/mods/testfood/textures/testfood_good.png deleted file mode 100644 index 31df7f5dd..000000000 Binary files a/games/minimal/mods/testfood/textures/testfood_good.png and /dev/null differ diff --git a/games/minimal/mods/testfood/textures/testfood_good2.png b/games/minimal/mods/testfood/textures/testfood_good2.png deleted file mode 100644 index e43dda209..000000000 Binary files a/games/minimal/mods/testfood/textures/testfood_good2.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/callbacks.lua b/games/minimal/mods/testformspec/callbacks.lua deleted file mode 100644 index 559380580..000000000 --- a/games/minimal/mods/testformspec/callbacks.lua +++ /dev/null @@ -1,51 +0,0 @@ -local callback_test = 0 - -local out = function(player, formname, fields, number) - local snum = "" - if number then - snum = " "..number - end - local msg = "Formspec callback"..snum..": player="..player:get_player_name()..", formname=\""..tostring(formname).."\", fields="..dump(fields) - minetest.chat_send_player(player:get_player_name(), msg) - minetest.log("action", msg) -end - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if callback_test == 1 then - out(player, formname, fields) - elseif callback_test == 2 then - out(player, formname, fields, 1) - end -end) -minetest.register_on_player_receive_fields(function(player, formname, fields) - if callback_test == 2 then - out(player, formname, fields, 2) - return true -- Disable the first callback - end -end) -minetest.register_on_player_receive_fields(function(player, formname, fields) - if callback_test == 2 then - out(player, formname, fields, 3) - end -end) - -minetest.register_chatcommand("test_formspec_callbacks", { - params = "[ 0 | 1 | 2 ]", - description = "Test: Change formspec callbacks testing mode", - func = function(name, param) - local mode = tonumber(param) - if not mode then - callback_test = (callback_test + 1 % 3) - else - callback_test = mode - end - if callback_test == 1 then - minetest.chat_send_player(name, "Formspec callback test mode 1 enabled: Logging only") - elseif callback_test == 2 then - minetest.chat_send_player(name, "Formspec callback test mode 2 enabled: Three callbacks, disable pre-registered callbacks") - else - callback_test = 0 - minetest.chat_send_player(name, "Formspec callback test disabled!") - end - end -}) diff --git a/games/minimal/mods/testformspec/dummy_items.lua b/games/minimal/mods/testformspec/dummy_items.lua deleted file mode 100644 index 2037ae9cf..000000000 --- a/games/minimal/mods/testformspec/dummy_items.lua +++ /dev/null @@ -1,14 +0,0 @@ --- This code adds dummy items that are supposed to be used in formspecs --- for testing item_image formspec elements. - -minetest.register_node("testformspec:node", { - description = "Formspec Test Node", - tiles = { "testformspec_node.png" }, - groups = { dig_immediate = 3, dummy = 1 }, -}) - -minetest.register_craftitem("testformspec:item", { - description = "Formspec Test Item", - inventory_image = "testformspec_item.png", - groups = { dummy = 1 }, -}) diff --git a/games/minimal/mods/testformspec/formspec.lua b/games/minimal/mods/testformspec/formspec.lua deleted file mode 100644 index 08c1b6dc0..000000000 --- a/games/minimal/mods/testformspec/formspec.lua +++ /dev/null @@ -1,381 +0,0 @@ -local color = minetest.colorize - -local clip_fs = [[ - style_type[label,button,image_button,item_image_button, - tabheader,scrollbar,table,animated_image - ,field,textarea,checkbox,dropdown;noclip=%c] - - label[0,0;A clipping test] - button[0,1;3,0.8;clip_button;A clipping test] - image_button[0,2;3,0.8;testformspec_button_image.png;clip_image_button;A clipping test] - item_image_button[0,3;3,0.8;testformspec:item;clip_item_image_button;A clipping test] - tabheader[0,4.7;3,0.63;clip_tabheader;Clip,Test,Text,Tabs;1;false;false] - field[0,5;3,0.8;clip_field;Title;] - textarea[0,6;3,1;clip_textarea;Title;] - checkbox[0,7.5;clip_checkbox;This is a test;true] - dropdown[0,8;3,0.8;clip_dropdown;Select An Item,One,Two,Three,Four,Five;1] - scrollbar[0,9;3,0.8;horizontal;clip_scrollbar;3] - tablecolumns[text;text] - table[0,10;3,1;clip_table;one,two,three,four;1] - animated_image[-0.5,11;4.5,1;clip_animated_image;testformspec_animation.png;4;100] -]] - -local tabheaders_fs = [[ - tabheader[0,0;10,0.63;tabs_opaque;Opaque,Without,Border;1;false;false] - tabheader[0,1;10,0.63;tabs_opaque_border;Opaque,With,Border;1;false;true] - tabheader[0,2;10,0.63;tabs_transparent;Transparent,Without,Border;1;true;false] - tabheader[0,3;10,0.63;tabs_transparent_border;Transparent,With,Border;1;true;true] - tabheader[0,4;tabs_default;Default,Tabs;1] - tabheader[0,6;10,0.5;tabs_size1;Height=0.5;1;false;false] - tabheader[2,6;10,0.75;tabs_size1;Height=0.75;1;false;false] - tabheader[4,6;10,1;tabs_size2;Height=1;1;false;false] - tabheader[6,6;10,1.25;tabs_size2;Height=1.25;1;false;false] - tabheader[8,6;10,1.5;tabs_size2;Height=1.5;1;false;false] -]] - -local hypertext_basic = [[ -Normal test -This is a normal text. - -style test - - . - - -Tag test -normal -mono -bold -italic -underlined -big -bigger -left -
center
-right -justify. Here comes a blind text: Lorem testum dolor sit amet consecutor celeron fiftifahivus e shadoninia e smalus jokus anrus relsocutoti rubenwardus. Erasputinus hara holisti dominus wusi. Grumarinsti erltusmuate ol fortitusti fla flo, blani burki e sfani fahif. Ultae ratii, e megus gigae don anonimus. Grinus dimondus krockus e nore. Endus finalus nowus comus endus o blindus tekstus. - -Custom tag test - - - - - -color=green -Action: color=green -Action: hovercolor=yellow -size=24 -font=mono -color=green font=mono size=24 - -action test -action - -img test -Normal: - -width=48 height=48: - -float=left: - -float=right: - - -item test -Normal: - -width=48 height=48 - -angle=30,0,0: - -angle=0,30,0: - -angle=0,0,30: - -rotate=yes: - -rotate=100,0,0: - -rotate=0,100,0: - -rotate=0,0,100: - -rotate=50,75,100: - -angle=-30,-45,90 rotate=100,150,-50: -]] - -local hypertext_global = [[ - -This is a test of the global tag. The parameters are: -background=gray margin=20 valign=bottom halign=right color=pink hovercolor=purple size=12 font=mono -action]] - -local hypertext_fs = "hypertext[0,0;11,9;hypertext;"..minetest.formspec_escape(hypertext_basic).."]".. - "hypertext[0,9.5;11,2.5;hypertext;"..minetest.formspec_escape(hypertext_global).."]" - -local style_fs = [[ - style[one_btn1;bgcolor=red;textcolor=yellow;bgcolor_hovered=orange; - bgcolor_pressed=purple] - button[0,0;2.5,0.8;one_btn1;Button] - - style[one_btn2;border=false;textcolor=cyan] ]].. - "button[0,1.05;2.5,0.8;one_btn2;Text " .. color("#FF0", "Yellow") .. [[] - - style[one_btn3;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; - bgimg_pressed=testformspec_pressed.png] - button[0,2.1;1,1;one_btn3;Border] - - style[one_btn4;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; - bgimg_pressed=testformspec_pressed.png;border=false] - button[1.25,2.1;1,1;one_btn4;NoBor] - - style[one_btn5;bgimg=testformspec_button_image.png;bgimg_hovered=testformspec_hovered.png; - bgimg_pressed=testformspec_pressed.png;border=false;alpha=false] - button[0,3.35;1,1;one_btn5;Alph] - - style[one_btn6;border=true] - image_button[0,4.6;1,1;testformspec_button_image.png;one_btn6;Border] - - style[one_btn7;border=false] - image_button[1.25,4.6;1,1;testformspec_button_image.png;one_btn7;NoBor] - - style[one_btn8;border=false] - image_button[0,5.85;1,1;testformspec_button_image.png;one_btn8;Border;false;true;testformspec_pressed.png] - - style[one_btn9;border=true] - image_button[1.25,5.85;1,1;testformspec_button_image.png;one_btn9;NoBor;false;false;testformspec_pressed.png] - - style[one_btn10;alpha=false] - image_button[0,7.1;1,1;testformspec_button_image.png;one_btn10;NoAlpha] - - style[one_btn11;alpha=true] - image_button[1.25,7.1;1,1;testformspec_button_image.png;one_btn11;Alpha] - - style[one_btn12;border=true] - item_image_button[0,8.35;1,1;testformspec:item;one_btn12;Border] - - style[one_btn13;border=false] - item_image_button[1.25,8.35;1,1;testformspec:item;one_btn13;NoBor] - - style[one_btn14;border=false;bgimg=testformspec_bg.png;fgimg=testformspec_button_image.png] - style[one_btn14:hovered;bgimg=testformspec_bg_hovered.png;fgimg=testformspec_hovered.png;textcolor=yellow] - style[one_btn14:pressed;bgimg=testformspec_bg_pressed.png;fgimg=testformspec_pressed.png;textcolor=blue] - style[one_btn14:hovered+pressed;textcolor=purple] - image_button[0,9.6;1,1;testformspec_button_image.png;one_btn14;Bg] - - style[one_btn15;border=false;bgimg=testformspec_bg.png;bgimg_hovered=testformspec_bg_hovered.png;bgimg_pressed=testformspec_bg_pressed.png] - item_image_button[1.25,9.6;1,1;testformspec:item;one_btn15;Bg] - - style[one_btn16;border=false;bgimg=testformspec_bg_9slice.png;bgimg_hovered=testformspec_bg_9slice_hovered.png;bgimg_pressed=testformspec_bg_9slice_pressed.png;bgimg_middle=4,6] - button[2.5,9.6;2,1;one_btn16;9-Slice Bg] - - - - container[2.75,0] - - style[one_tb1;textcolor=Yellow] - tabheader[0,3;2.5,0.63;one_tb1;Yellow,Text,Tabs;1;false;false] - - style[one_f1;textcolor=yellow] - field[0,4.25;2.5,0.8;one_f1;Field One;Yellow Text] - - style[one_f2;border=false;textcolor=cyan] - field[0,5.75;2.5,0.8;one_f2;Field Two;Borderless Cyan Text] - - style[one_f3;textcolor=yellow] - textarea[0,7.025;2.5,0.8;one_f3;Label;]] .. - minetest.formspec_escape("Yellow Text\nLine two") .. [[ ] - - style[one_f4;border=false;textcolor=cyan] - textarea[0,8.324999999999999;2.5,0.8;one_f4;Label;]] .. - minetest.formspec_escape("Borderless Cyan Text\nLine two") .. [[ ] - - container_end[] -]] - -local scroll_fs = - "button[8.5,1;4,1;outside;Outside of container]".. - "box[1,1;8,6;#00aa]".. - "scroll_container[1,1;8,6;scrbar;vertical]".. - "button[0,1;1,1;lorem;Lorem]".. - "button[0,10;1,1;ipsum;Ipsum]".. - "pwdfield[2,2;1,1;lorem2;Lorem]".. - "list[current_player;main;4,4;1,5;]".. - "box[2,5;3,2;#ffff00]".. - "image[1,10;3,2;testformspec_item.png]".. - "image[3,1;testformspec_item.png]".. - "item_image[2,6;3,2;testformspec:node]".. - "label[2,15;bla Bli\nfoo bar]".. - "item_image_button[2,3;1,1;testformspec:node;itemimagebutton;ItemImageButton]".. - "tooltip[0,11;3,2;Buz;#f00;#000]".. - "box[0,11;3,2;#00ff00]".. - "hypertext[3,13;3,3;;" .. hypertext_basic .. "]" .. - "container[0,18]".. - "box[1,2;3,2;#0a0a]".. - "scroll_container[1,2;3,2;scrbar2;horizontal;0.06]".. - "button[0,0;6,1;butnest;Nest]".. - "label[10,0.5;nest]".. - "scroll_container_end[]".. - "scrollbar[1,0;3.5,0.3;horizontal;scrbar2;0]".. - "container_end[]".. - "dropdown[0,6;2;hmdrpdwn;apple,bulb;1]".. - "image_button[0,4;2,2;testformspec_button_image.png;imagebutton;bbbbtt;false;true;testformspec_pressed.png]".. - "box[1,22.5;4,1;#a00a]".. - "scroll_container_end[]".. - "scrollbaroptions[max=170]".. -- lowest seen pos is: 0.1*170+6=23 (factor*max+height) - "scrollbar[7.5,0;0.3,4;vertical;scrbar;0]".. - "scrollbar[8,0;0.3,4;vertical;scrbarhmmm;0]".. - "dropdown[0,6;2;hmdrpdwnnn;Outside,of,container;1]" - ---style_type[label;textcolor=green] ---label[0,0;Green] ---style_type[label;textcolor=blue] ---label[0,1;Blue] ---style_type[label;textcolor=;border=true] ---label[1.2,0;Border] ---style_type[label;border=true;bgcolor=red] ---label[1.2,1;Background] ---style_type[label;border=;bgcolor=] ---label[0.75,2;Reset] - - -local pages = { - -- Real Coordinates - [[ - formspec_version[3] - size[12,13] - image_button[0,0;1,1;logo.png;rc_image_button_1x1;1x1] - image_button[1,0;2,2;logo.png;rc_image_button_2x2;2x2] - button[0,2;1,1;rc_button_1x1;1x1] - button[1,2;2,2;rc_button_2x2;2x2] - item_image[0,4;1,1;air] - item_image[1,4;2,2;air] - item_image_button[0,6;1,1;testformspec:node;rc_item_image_button_1x1;1x1] - item_image_button[1,6;2,2;testformspec:node;rc_item_image_button_2x2;2x2] - field[3,.5;3,.5;rc_field;Field;text] - pwdfield[6,.5;3,1;rc_pwdfield;Password Field] - field[3,1;3,1;;Read-Only Field;text] - textarea[3,2;3,.5;rc_textarea_small;Textarea;text] - textarea[6,2;3,2;rc_textarea_big;Textarea;text\nmore text] - textarea[3,3;3,1;;Read-Only Textarea;text\nmore text] - textlist[3,4;3,2;rc_textlist;Textlist,Perfect Coordinates;1;false] - tableoptions[highlight=#ABCDEF75;background=#00000055;border=false] - table[6,4;3,2;rc_table;Table,Cool Stuff,Foo,Bar;2] - dropdown[3,6;3,1;rc_dropdown_small;This,is,a,dropdown;1] - dropdown[6,6;3,2;rc_dropdown_big;I,am,a,bigger,dropdown;5] - image[0,8;3,2;ignore.png] - box[3,7;3,1;#00A3FF] - checkbox[3,8;rc_checkbox_1;Check me!;false] - checkbox[3,9;rc_checkbox_2;Uncheck me now!;true] - scrollbar[0,11.5;11.5,.5;horizontal;rc_scrollbar_horizontal;500] - scrollbar[11.5,0;.5,11.5;vertical;rc_scrollbar_vertical;0] - list[current_player;main;6,8;3,2;1] - button[9,0;2.5,1;rc_empty_button_1;] - button[9,1;2.5,1;rc_empty_button_2;] - button[9,2;2.5,1;rc_empty_button_3;] ]].. - "label[9,0.5;This is a label.\nLine\nLine\nLine\nEnd]".. - [[button[9,3;1,1;rc_empty_button_4;] - vertlabel[9,4;VERT] - label[10,3;HORIZ] - tabheader[8,0;6,0.65;rc_tabheader;Tab 1,Tab 2,Tab 3,Secrets;1;false;false] - ]], - -- Style - - "formspec_version[3]size[12,13]" .. - ("label[0.375,0.375;Styled - %s %s]"):format( - color("#F00", "red text"), - color("#77FF00CC", "green text")) .. - "label[6.375,0.375;Unstyled]" .. - "box[0,0.75;12,0.1;#999]" .. - "box[6,0.85;0.1,11.15;#999]" .. - "container[0.375,1.225]" .. - style_fs .. - "container_end[]container[6.375,1.225]" .. - style_fs:gsub("one_", "two_"):gsub("style%[[^%]]+%]", ""):gsub("style_type%[[^%]]+%]", "") .. - "container_end[]", - - -- Noclip - "formspec_version[3]size[12,13]" .. - "label[0.1,0.5;Clip]" .. - "container[-2.5,1]" .. clip_fs:gsub("%%c", "false") .. "container_end[]" .. - "label[11,0.5;Noclip]" .. - "container[11.5,1]" .. clip_fs:gsub("%%c", "true") .. "container_end[]", - - -- Hypertext - "size[12,13]real_coordinates[true]" .. - "container[0.5,0.5]" .. hypertext_fs .. "container_end[]", - - -- Tabheaders - "size[12,13]real_coordinates[true]" .. - "container[0.5,1.5]" .. tabheaders_fs .. "container_end[]", - - -- Animation - [[ - formspec_version[3] - size[12,13] - animated_image[0.5,0.5;1,1;;testformspec_animation.png;4;100] - animated_image[0.5,1.75;1,1;;testformspec_animation.jpg;4;100] - animated_image[1.75,0.5;1,1;;testformspec_animation.png;100;100] - animated_image[3,0.5;1,1;ani_img_1;testformspec_animation.png;4;1000] - button[4.25,0.5;1,1;ani_btn_1;Current -Number] - animated_image[3,1.75;1,1;ani_img_2;testformspec_animation.png;4;1000;2] - button[4.25,1.75;1,1;ani_btn_2;Current -Number] - animated_image[3,3;1,1;;testformspec_animation.png;4;0] - animated_image[3,4.25;1,1;;testformspec_animation.png;4;0;3] - animated_image[5.5,0.5;5,2;;testformspec_animation.png;4;100] - animated_image[5.5,2.75;5,2;;testformspec_animation.jpg;4;100] - ]], - - -- Scroll containers - "formspec_version[3]size[12,13]" .. - scroll_fs, -} - -local function show_test_formspec(pname, page_id) - page_id = page_id or 2 - - local fs = pages[page_id] .. "tabheader[0,0;8,0.65;maintabs;Real Coord,Styles,Noclip,Hypertext,Tabs,Anim,ScrollC;" .. page_id .. ";false;false]" - - minetest.show_formspec(pname, "testformspec:formspec", fs) -end - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname ~= "testformspec:formspec" then - return false - end - - - if fields.maintabs then - show_test_formspec(player:get_player_name(), tonumber(fields.maintabs)) - return true - end - - if fields.ani_img_1 and fields.ani_btn_1 then - minetest.chat_send_player(player:get_player_name(), "ani_img_1 = " .. tostring(fields.ani_img_1)) - return true - elseif fields.ani_img_2 and fields.ani_btn_2 then - minetest.chat_send_player(player:get_player_name(), "ani_img_2 = " .. tostring(fields.ani_img_2)) - return true - end - - if fields.hypertext then - minetest.chat_send_player(player:get_player_name(), "Hypertext action received: " .. tostring(fields.hypertext)) - return true - end -end) - -minetest.register_chatcommand("test_formspec", { - params = "", - description = "Open the test formspec", - func = function(name) - if not minetest.get_player_by_name(name) then - return false, "You need to be online!" - end - - show_test_formspec(name) - return true - end, -}) diff --git a/games/minimal/mods/testformspec/init.lua b/games/minimal/mods/testformspec/init.lua deleted file mode 100644 index 23b565f08..000000000 --- a/games/minimal/mods/testformspec/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -dofile(minetest.get_modpath("testformspec").."/dummy_items.lua") -dofile(minetest.get_modpath("testformspec").."/formspec.lua") -dofile(minetest.get_modpath("testformspec").."/callbacks.lua") diff --git a/games/minimal/mods/testformspec/mod.conf b/games/minimal/mods/testformspec/mod.conf deleted file mode 100644 index 00eac307a..000000000 --- a/games/minimal/mods/testformspec/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testformspec -description = Contains an example formspec to test all the features of formspecs diff --git a/games/minimal/mods/testformspec/textures/testformspec_animation.jpg b/games/minimal/mods/testformspec/textures/testformspec_animation.jpg deleted file mode 100644 index b98ca2677..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_animation.jpg and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_animation.png b/games/minimal/mods/testformspec/textures/testformspec_animation.png deleted file mode 100644 index b972e5dbb..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_animation.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg.png b/games/minimal/mods/testformspec/textures/testformspec_bg.png deleted file mode 100644 index cd1e50900..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice.png b/games/minimal/mods/testformspec/textures/testformspec_bg_9slice.png deleted file mode 100644 index 34433ac82..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_hovered.png b/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_hovered.png deleted file mode 100644 index 01c2dc777..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_hovered.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_pressed.png b/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_pressed.png deleted file mode 100644 index 0cbac7536..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_9slice_pressed.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_hovered.png b/games/minimal/mods/testformspec/textures/testformspec_bg_hovered.png deleted file mode 100644 index 3ebbb988c..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_hovered.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_bg_pressed.png b/games/minimal/mods/testformspec/textures/testformspec_bg_pressed.png deleted file mode 100644 index 2fb5fc21e..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_bg_pressed.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_button_image.png b/games/minimal/mods/testformspec/textures/testformspec_button_image.png deleted file mode 100644 index 75c438a9a..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_button_image.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_hovered.png b/games/minimal/mods/testformspec/textures/testformspec_hovered.png deleted file mode 100644 index 3ccad30a2..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_hovered.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_item.png b/games/minimal/mods/testformspec/textures/testformspec_item.png deleted file mode 100644 index 4fd823b55..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_item.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_node.png b/games/minimal/mods/testformspec/textures/testformspec_node.png deleted file mode 100644 index c107f28a3..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_node.png and /dev/null differ diff --git a/games/minimal/mods/testformspec/textures/testformspec_pressed.png b/games/minimal/mods/testformspec/textures/testformspec_pressed.png deleted file mode 100644 index 45c504f27..000000000 Binary files a/games/minimal/mods/testformspec/textures/testformspec_pressed.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/README.md b/games/minimal/mods/testnodes/README.md deleted file mode 100644 index 13ed972c0..000000000 --- a/games/minimal/mods/testnodes/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Test Nodes - -This mod contains a bunch of basic nodes to test development stuff. -Most nodes are kept as minimal as possible in order to show off one particular feature of the engine, to make testing stuff easier. - -This mod includes tests for: - -* drawtypes -* paramtype2's -* node properties such as damage, drowning, falling, etc. -* other random stuff diff --git a/games/minimal/mods/testnodes/drawtypes.lua b/games/minimal/mods/testnodes/drawtypes.lua deleted file mode 100644 index 35fda960f..000000000 --- a/games/minimal/mods/testnodes/drawtypes.lua +++ /dev/null @@ -1,517 +0,0 @@ ---[[ Drawtype Test: This file tests out and provides examples for -all drawtypes in Minetest. It is attempted to keep the node -definitions as simple and minimal as possible to keep -side-effects to a minimum. - -How to read the node definitions: -There are two parts which are separated by 2 newlines: -The first part contains the things that are more or less essential -for defining the drawtype (except description, which is -at the top for readability). -The second part (after the 2 newlines) contains stuff that are -unrelated to the drawtype, stuff that is mostly there to make -testing this node easier and more convenient. -]] - -local S = minetest.get_translator("testnodes") - --- If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. --- This is due to . --- This is only added to make the items more visible to avoid confusion, but you will no longer see --- the default inventory images for these items. When you want to test the default inventory image of drawtypes, --- this should be turned off. --- TODO: Remove support for fallback inventory image as soon #9209 is fixed. -local SHOW_FALLBACK_IMAGE = minetest.settings:get_bool("testnodes_show_fallback_image", false) - -local fallback_image = function(img) - if SHOW_FALLBACK_IMAGE then - return img - else - return nil - end -end - --- A regular cube -minetest.register_node("testnodes:normal", { - description = S("Normal Drawtype Test Node"), - drawtype = "normal", - tiles = { "testnodes_normal.png" }, - - groups = { dig_immediate = 3 }, -}) - --- Standard glasslike node -minetest.register_node("testnodes:glasslike", { - description = S("Glasslike Drawtype Test Node"), - drawtype = "glasslike", - paramtype = "light", - tiles = { "testnodes_glasslike.png" }, - - groups = { dig_immediate = 3 }, -}) - --- Glasslike framed with the two textures (normal and "detail") -minetest.register_node("testnodes:glasslike_framed", { - description = S("Glasslike Framed Drawtype Test Node"), - drawtype = "glasslike_framed", - paramtype = "light", - tiles = { - "testnodes_glasslike_framed.png", - "testnodes_glasslike_detail.png", - }, - - - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - --- Like the one above, but without the "detail" texture (texture 2). --- This node was added to see how the engine behaves when the "detail" texture --- is missing. -minetest.register_node("testnodes:glasslike_framed_no_detail", { - description = S("Glasslike Framed without Detail Drawtype Test Node"), - drawtype = "glasslike_framed", - paramtype = "light", - tiles = { "testnodes_glasslike_framed2.png" }, - - - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - - -minetest.register_node("testnodes:glasslike_framed_optional", { - description = S("Glasslike Framed Optional Drawtype Test Node"), - drawtype = "glasslike_framed_optional", - paramtype = "light", - tiles = { - "testnodes_glasslike_framed_optional.png", - "testnodes_glasslike_detail.png", - }, - - - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - - - -minetest.register_node("testnodes:allfaces", { - description = S("Allfaces Drawtype Test Node"), - drawtype = "allfaces", - paramtype = "light", - tiles = { "testnodes_allfaces.png" }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:allfaces_optional", { - description = S("Allfaces Optional Drawtype Test Node"), - drawtype = "allfaces_optional", - paramtype = "light", - tiles = { "testnodes_allfaces_optional.png" }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:allfaces_optional_waving", { - description = S("Waving Allfaces Optional Drawtype Test Node"), - drawtype = "allfaces_optional", - paramtype = "light", - tiles = { "testnodes_allfaces_optional.png^[brighten" }, - waving = 2, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:firelike", { - description = S("Firelike Drawtype Test Node"), - drawtype = "firelike", - paramtype = "light", - tiles = { "testnodes_firelike.png" }, - - - walkable = false, - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:fencelike", { - description = S("Fencelike Drawtype Test Node"), - drawtype = "fencelike", - paramtype = "light", - tiles = { "testnodes_fencelike.png" }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:torchlike", { - description = S("Wallmounted Torchlike Drawtype Test Node"), - drawtype = "torchlike", - paramtype = "light", - paramtype2 = "wallmounted", - tiles = { - "testnodes_torchlike_floor.png", - "testnodes_torchlike_ceiling.png", - "testnodes_torchlike_wall.png", - }, - - - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, - inventory_image = fallback_image("testnodes_torchlike_floor.png"), -}) - -minetest.register_node("testnodes:signlike", { - description = S("Wallmounted Signlike Drawtype Test Node"), - drawtype = "signlike", - paramtype = "light", - paramtype2 = "wallmounted", - tiles = { "testnodes_signlike.png" }, - - - walkable = false, - groups = { dig_immediate = 3 }, - sunlight_propagates = true, - inventory_image = fallback_image("testnodes_signlike.png"), -}) - -minetest.register_node("testnodes:plantlike", { - description = S("Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - tiles = { "testnodes_plantlike.png" }, - - - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:plantlike_waving", { - description = S("Waving Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - tiles = { "testnodes_plantlike_waving.png" }, - waving = 1, - - - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - - - --- param2 will rotate -minetest.register_node("testnodes:plantlike_degrotate", { - description = S("Degrotate Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - paramtype2 = "degrotate", - tiles = { "testnodes_plantlike_degrotate.png" }, - - - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - --- param2 will change height -minetest.register_node("testnodes:plantlike_leveled", { - description = S("Leveled Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - paramtype2 = "leveled", - tiles = { - { name = "testnodes_plantlike_leveled.png", tileable_vertical = true }, - }, - - - -- We set a default param2 here only for convenience, to make the "plant" visible after placement - place_param2 = 8, - walkable = false, - sunlight_propagates = true, - groups = { dig_immediate = 3 }, -}) - --- param2 changes shape -minetest.register_node("testnodes:plantlike_meshoptions", { - description = S("Meshoptions Plantlike Drawtype Test Node"), - drawtype = "plantlike", - paramtype = "light", - paramtype2 = "meshoptions", - tiles = { "testnodes_plantlike_meshoptions.png" }, - - - walkable = false, - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:plantlike_rooted", { - description = S("Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - tiles = { "testnodes_plantlike_rooted_base.png" }, - special_tiles = { "testnodes_plantlike_rooted.png" }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:plantlike_rooted_waving", { - description = S("Waving Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - tiles = { - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base_side_waving.png", - }, - special_tiles = { "testnodes_plantlike_rooted_waving.png" }, - waving = 1, - - groups = { dig_immediate = 3 }, -}) - --- param2 changes height -minetest.register_node("testnodes:plantlike_rooted_leveled", { - description = S("Leveled Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - paramtype2 = "leveled", - tiles = { - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base_side_leveled.png", - }, - special_tiles = { - { name = "testnodes_plantlike_rooted_leveled.png", tileable_vertical = true }, - }, - - - -- We set a default param2 here only for convenience, to make the "plant" visible after placement - place_param2 = 8, - groups = { dig_immediate = 3 }, -}) - --- param2 changes shape -minetest.register_node("testnodes:plantlike_rooted_meshoptions", { - description = S("Meshoptions Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - paramtype2 = "meshoptions", - tiles = { - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base_side_meshoptions.png", - }, - special_tiles = { - "testnodes_plantlike_rooted_meshoptions.png", - }, - - groups = { dig_immediate = 3 }, -}) - --- param2 changes rotation -minetest.register_node("testnodes:plantlike_rooted_degrotate", { - description = S("Degrotate Rooted Plantlike Drawtype Test Node"), - drawtype = "plantlike_rooted", - paramtype = "light", - paramtype2 = "degrotate", - tiles = { - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base.png", - "testnodes_plantlike_rooted_base_side_degrotate.png", - }, - special_tiles = { - "testnodes_plantlike_rooted_degrotate.png", - }, - - groups = { dig_immediate = 3 }, -}) - --- Demonstrative liquid nodes, source and flowing form. This is only the --- drawtype, no physical liquid properties are used -minetest.register_node("testnodes:liquid", { - description = S("Source Liquid Drawtype Test Node"), - drawtype = "liquid", - paramtype = "light", - tiles = { - "testnodes_liquidsource.png", - }, - special_tiles = { - {name="testnodes_liquidsource.png", backface_culling=false}, - {name="testnodes_liquidsource.png", backface_culling=true}, - }, - use_texture_alpha = true, - - - walkable = false, - liquid_alternative_flowing = "testnodes:liquid_flowing", - liquid_alternative_source = "testnodes:liquid", - groups = { dig_immediate = 3 }, -}) -minetest.register_node("testnodes:liquid_flowing", { - description = S("Flowing Liquid Drawtype Test Node"), - drawtype = "flowingliquid", - paramtype = "light", - paramtype2 = "flowingliquid", - tiles = { - "testnodes_liquidflowing.png", - }, - special_tiles = { - {name="testnodes_liquidflowing.png", backface_culling=false}, - {name="testnodes_liquidflowing.png", backface_culling=false}, - }, - use_texture_alpha = true, - - - walkable = false, - liquid_alternative_flowing = "testnodes:liquid_flowing", - liquid_alternative_source = "testnodes:liquid", - groups = { dig_immediate = 3 }, -}) -minetest.register_node("testnodes:liquid_waving", { - description = S("Waving Source Liquid Drawtype Test Node"), - drawtype = "liquid", - paramtype = "light", - tiles = { - "testnodes_liquidsource.png^[brighten", - }, - special_tiles = { - {name="testnodes_liquidsource.png^[brighten", backface_culling=false}, - {name="testnodes_liquidsource.png^[brighten", backface_culling=true}, - }, - use_texture_alpha = true, - waving = 3, - - - walkable = false, - liquid_alternative_flowing = "testnodes:liquid_flowing", - liquid_alternative_source = "testnodes:liquid", - groups = { dig_immediate = 3 }, -}) -minetest.register_node("testnodes:liquid_flowing_waving", { - description = S("Waving Flowing Liquid Drawtype Test Node"), - drawtype = "flowingliquid", - paramtype = "light", - paramtype2 = "flowingliquid", - tiles = { - "testnodes_liquidflowing.png^[brighten", - }, - special_tiles = { - {name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, - {name="testnodes_liquidflowing.png^[brighten", backface_culling=false}, - }, - use_texture_alpha = true, - waving = 3, - - - walkable = false, - liquid_alternative_flowing = "testnodes:liquid_flowing", - liquid_alternative_source = "testnodes:liquid", - groups = { dig_immediate = 3 }, -}) - - - --- Invisible node -minetest.register_node("testnodes:airlike", { - description = S("Airlike Drawtype Test Node"), - drawtype = "airlike", - paramtype = "light", - - - walkable = false, - groups = { dig_immediate = 3 }, - sunlight_propagates = true, - inventory_image = fallback_image("testnodes_airlike.png"), -}) - --- param2 changes liquid height -minetest.register_node("testnodes:glassliquid", { - description = S("Glasslike Liquid Level Drawtype Test Node"), - drawtype = "glasslike_framed", - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - tiles = { - "testnodes_glasslikeliquid.png", - }, - special_tiles = { - "testnodes_liquid.png", - }, - - groups = { dig_immediate = 3 }, -}) - --- Adding many raillike examples, primarily to demonstrate the behavior of --- "raillike groups". Nodes of the same type (rail, groupless, line, street) --- should connect to nodes of the same "rail type" (=same shape, different --- color) only. -local rails = { - { "rail", {"testnodes_rail_straight.png", "testnodes_rail_curved.png", "testnodes_rail_t_junction.png", "testnodes_rail_crossing.png"} }, - { "line", {"testnodes_line_straight.png", "testnodes_line_curved.png", "testnodes_line_t_junction.png", "testnodes_line_crossing.png"}, }, - { "street", {"testnodes_street_straight.png", "testnodes_street_curved.png", "testnodes_street_t_junction.png", "testnodes_street_crossing.png"}, }, - -- the "groupless" nodes are nodes in which the "connect_to_raillike" group is not set - { "groupless", {"testnodes_rail2_straight.png", "testnodes_rail2_curved.png", "testnodes_rail2_t_junction.png", "testnodes_rail2_crossing.png"} }, -} -local colors = { "", "cyan", "red" } - -for r=1, #rails do - local id = rails[r][1] - local tiles = rails[r][2] - local raillike_group - if id ~= "groupless" then - raillike_group = minetest.raillike_group(id) - end - for c=1, #colors do - local color - if colors[c] ~= "" then - color = colors[c] - end - minetest.register_node("testnodes:raillike_"..id..c, { - description = S("Raillike Drawtype Test Node: @1 @2", id, c), - drawtype = "raillike", - paramtype = "light", - tiles = tiles, - groups = { connect_to_raillike = raillike_group, dig_immediate = 3 }, - - - color = color, - selection_box = { - type = "fixed", - fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}}, - }, - sunlight_propagates = true, - walkable = false, - }) - end -end - - - --- Add visual_scale variants of previous nodes for half and double size -local scale = function(subname, desc_double, desc_half) - local original = "testnodes:"..subname - local def = table.copy(minetest.registered_items[original]) - def.visual_scale = 2.0 - def.description = desc_double - minetest.register_node("testnodes:"..subname.."_double", def) - def = table.copy(minetest.registered_items[original]) - def.visual_scale = 0.5 - def.description = desc_half - minetest.register_node("testnodes:"..subname.."_half", def) -end - -scale("plantlike", - S("Double-sized Plantlike Drawtype Test Node"), - S("Half-sized Plantlike Drawtype Test Node")) -scale("torchlike", - S("Double-sized Wallmounted Torchlike Drawtype Test Node"), - S("Half-sized Wallmounted Torchlike Drawtype Test Node")) -scale("signlike", - S("Double-sized Wallmounted Signlike Drawtype Test Node"), - S("Half-sized Wallmounted Signlike Drawtype Test Node")) -scale("firelike", - S("Double-sized Firelike Drawtype Test Node"), - S("Half-sized Firelike Drawtype Test Node")) diff --git a/games/minimal/mods/testnodes/init.lua b/games/minimal/mods/testnodes/init.lua deleted file mode 100644 index 92e2c5630..000000000 --- a/games/minimal/mods/testnodes/init.lua +++ /dev/null @@ -1,10 +0,0 @@ -local path = minetest.get_modpath(minetest.get_current_modname()) - -dofile(path.."/drawtypes.lua") -dofile(path.."/meshes.lua") -dofile(path.."/nodeboxes.lua") -dofile(path.."/param2.lua") -dofile(path.."/properties.lua") -dofile(path.."/liquids.lua") -dofile(path.."/light.lua") -dofile(path.."/textures.lua") diff --git a/games/minimal/mods/testnodes/light.lua b/games/minimal/mods/testnodes/light.lua deleted file mode 100644 index 94409e83f..000000000 --- a/games/minimal/mods/testnodes/light.lua +++ /dev/null @@ -1,48 +0,0 @@ --- Test Nodes: Light test - -local S = minetest.get_translator("testnodes") - --- All possible light levels -for i=1, minetest.LIGHT_MAX do - minetest.register_node("testnodes:light"..i, { - description = S("Light Source (@1)", i), - paramtype = "light", - light_source = i, - - - tiles ={"testnodes_light_"..i..".png"}, - drawtype = "glasslike", - walkable = false, - sunlight_propagates = true, - is_ground_content = false, - groups = {dig_immediate=3}, - }) -end - --- Lets light through, but not sunlight, leading to a --- reduction in light level when light passes through -minetest.register_node("testnodes:sunlight_filter", { - description = S("Sunlight Filter"), - paramtype = "light", - - - drawtype = "glasslike", - tiles = { - "testnodes_sunlight_filter.png", - }, - groups = { dig_immediate = 3 }, -}) - --- Lets light and sunlight through without obstruction -minetest.register_node("testnodes:sunlight_propagator", { - description = S("Sunlight Propagator"), - paramtype = "light", - sunlight_propagates = true, - - - drawtype = "glasslike", - tiles = { - "testnodes_sunlight_filter.png^[brighten", - }, - groups = { dig_immediate = 3 }, -}) diff --git a/games/minimal/mods/testnodes/liquids.lua b/games/minimal/mods/testnodes/liquids.lua deleted file mode 100644 index e316782ad..000000000 --- a/games/minimal/mods/testnodes/liquids.lua +++ /dev/null @@ -1,91 +0,0 @@ --- Add liquids for ranges and viscosity levels 0-8 - -for d=0, 8 do - minetest.register_node("testnodes:rliquid_"..d, { - description = "Test Liquid Source, Range "..d, - drawtype = "liquid", - tiles = {"testnodes_liquidsource_r"..d..".png"}, - special_tiles = { - {name = "testnodes_liquidsource_r"..d..".png", backface_culling = false}, - {name = "testnodes_liquidsource_r"..d..".png", backface_culling = true}, - }, - alpha = 192, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - liquidtype = "source", - liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d, - liquid_alternative_source = "testnodes:rliquid_"..d, - liquid_range = d, - }) - - minetest.register_node("testnodes:rliquid_flowing_"..d, { - description = "Flowing Test Liquid, Range "..d, - drawtype = "flowingliquid", - tiles = {"testnodes_liquidflowing_r"..d..".png"}, - special_tiles = { - {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false}, - {name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false}, - }, - alpha = 192, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - liquidtype = "flowing", - liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d, - liquid_alternative_source = "testnodes:rliquid_"..d, - liquid_range = d, - }) - - local mod = "^[colorize:#000000:127" - minetest.register_node("testnodes:vliquid_"..d, { - description = "Test Liquid Source, Viscosity "..d, - drawtype = "liquid", - tiles = {"testnodes_liquidsource_r"..d..".png"..mod}, - special_tiles = { - {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = false}, - {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = true}, - }, - alpha = 192, - paramtype = "light", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - liquidtype = "source", - liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d, - liquid_alternative_source = "testnodes:vliquid_"..d, - liquid_viscosity = d, - }) - - minetest.register_node("testnodes:vliquid_flowing_"..d, { - description = "Flowing Test Liquid, Viscosity "..d, - drawtype = "flowingliquid", - tiles = {"testnodes_liquidflowing_r"..d..".png"..mod}, - special_tiles = { - {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false}, - {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false}, - }, - alpha = 192, - paramtype = "light", - paramtype2 = "flowingliquid", - walkable = false, - pointable = false, - diggable = false, - buildable_to = true, - is_ground_content = false, - liquidtype = "flowing", - liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d, - liquid_alternative_source = "testnodes:vliquid_"..d, - liquid_viscosity = d, - }) - -end diff --git a/games/minimal/mods/testnodes/meshes.lua b/games/minimal/mods/testnodes/meshes.lua deleted file mode 100644 index 900abc180..000000000 --- a/games/minimal/mods/testnodes/meshes.lua +++ /dev/null @@ -1,145 +0,0 @@ --- Meshes - -local S = minetest.get_translator("testnodes") - -local ocorner_cbox = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, - {-0.5, -0.25, -0.25, 0.25, 0, 0.5}, - {-0.5, 0, 0, 0, 0.25, 0.5}, - {-0.5, 0.25, 0.25, -0.25, 0.5, 0.5} - } -} - -local tall_pyr_cbox = { - type = "fixed", - fixed = { - { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, - { -0.375, -0.25, -0.375, 0.375, 0, 0.375}, - { -0.25, 0, -0.25, 0.25, 0.25, 0.25}, - { -0.125, 0.25, -0.125, 0.125, 0.5, 0.125} - } -} - --- Normal mesh -minetest.register_node("testnodes:mesh", { - description = S("Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes2.png"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - - groups = {dig_immediate=3}, -}) - --- Facedir mesh: outer corner slope -minetest.register_node("testnodes:mesh_facedir", { - description = S("Facedir Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_ocorner.obj", - tiles = {"testnodes_mesh_stripes.png"}, - paramtype = "light", - paramtype2 = "facedir", - collision_box = ocorner_cbox, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:mesh_colorfacedir", { - description = S("Color Facedir Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_ocorner.obj", - tiles = {"testnodes_mesh_stripes3.png"}, - paramtype = "light", - paramtype2 = "colorfacedir", - palette = "testnodes_palette_facedir.png", - collision_box = ocorner_cbox, - - groups = {dig_immediate=3}, -}) - --- Wallmounted mesh: pyramid -minetest.register_node("testnodes:mesh_wallmounted", { - description = S("Wallmounted Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes2.png"}, - paramtype = "light", - paramtype2 = "wallmounted", - collision_box = tall_pyr_cbox, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:mesh_colorwallmounted", { - description = S("Color Wallmounted Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes3.png"}, - paramtype = "light", - paramtype2 = "colorwallmounted", - palette = "testnodes_palette_wallmounted.png", - collision_box = tall_pyr_cbox, - - groups = {dig_immediate=3}, -}) - - -minetest.register_node("testnodes:mesh_double", { - description = S("Double-sized Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes2.png"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - visual_scale = 2, - - groups = {dig_immediate=3}, -}) -minetest.register_node("testnodes:mesh_half", { - description = S("Half-sized Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes2.png"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - visual_scale = 0.5, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:mesh_waving1", { - description = S("Plantlike-waving Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0FFB0"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - waving = 1, - - groups = {dig_immediate=3}, -}) -minetest.register_node("testnodes:mesh_waving2", { - description = S("Leaflike-waving Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes4.png^[multiply:#FFFFB0"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - waving = 2, - - groups = {dig_immediate=3}, -}) -minetest.register_node("testnodes:mesh_waving3", { - description = S("Liquidlike-waving Mesh Test Node"), - drawtype = "mesh", - mesh = "testnodes_pyramid.obj", - tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0B0FF"}, - paramtype = "light", - collision_box = tall_pyr_cbox, - waving = 3, - - groups = {dig_immediate=3}, -}) diff --git a/games/minimal/mods/testnodes/mod.conf b/games/minimal/mods/testnodes/mod.conf deleted file mode 100644 index 4824c6ed0..000000000 --- a/games/minimal/mods/testnodes/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testnodes -description = Contains a bunch of basic example nodes for demonstrative purposes, development and testing diff --git a/games/minimal/mods/testnodes/models/testnodes_ocorner.obj b/games/minimal/mods/testnodes/models/testnodes_ocorner.obj deleted file mode 100644 index 231d7056b..000000000 --- a/games/minimal/mods/testnodes/models/testnodes_ocorner.obj +++ /dev/null @@ -1,23 +0,0 @@ -# Blender v2.73 (sub 0) OBJ File: 'slope_test_ocorner_onetexture.blend' -# www.blender.org -o Cube_Cube.002 -v 0.500000 0.500000 0.500000 -v -0.500000 -0.500000 0.500000 -v 0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 -0.500000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.000000 -vt 1.000000 0.000000 -vn 0.000000 -1.000000 -0.000000 -vn 1.000000 0.000000 0.000000 -vn 0.000000 -0.000000 1.000000 -vn -0.707100 0.707100 0.000000 -vn 0.000000 0.707100 -0.707100 -s off -f 3/1/1 2/2/1 4/3/1 5/4/1 -f 1/2/2 3/3/2 5/4/2 -f 1/1/3 2/3/3 3/4/3 -f 1/1/4 4/3/4 2/4/4 -f 1/2/5 5/3/5 4/4/5 diff --git a/games/minimal/mods/testnodes/models/testnodes_pyramid.obj b/games/minimal/mods/testnodes/models/testnodes_pyramid.obj deleted file mode 100644 index b305af2f8..000000000 --- a/games/minimal/mods/testnodes/models/testnodes_pyramid.obj +++ /dev/null @@ -1,24 +0,0 @@ -# Blender v2.73 (sub 0) OBJ File: 'slope_test_pyramid_onetexture.blend' -# www.blender.org -o Cube -v 0.500000 -0.500000 -0.500000 -v 0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 0.500000 -v -0.500000 -0.500000 -0.500000 -v -0.000000 0.500000 -0.000000 -vt 1.000000 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.000000 -vt 1.000000 0.000000 -vt 0.500000 1.000000 -vn 0.000000 -1.000000 0.000000 -vn -0.894400 0.447200 -0.000000 -vn 0.000000 0.447200 -0.894400 -vn 0.894400 0.447200 0.000000 -vn -0.000000 0.447200 0.894400 -s off -f 1/1/1 2/2/1 3/3/1 4/4/1 -f 3/4/2 5/5/2 4/3/2 -f 5/5/3 1/3/3 4/4/3 -f 1/4/4 5/5/4 2/3/4 -f 2/4/5 5/5/5 3/3/5 diff --git a/games/minimal/mods/testnodes/nodeboxes.lua b/games/minimal/mods/testnodes/nodeboxes.lua deleted file mode 100644 index ebd858337..000000000 --- a/games/minimal/mods/testnodes/nodeboxes.lua +++ /dev/null @@ -1,80 +0,0 @@ -local S = minetest.get_translator("testnodes") - --- Nodebox examples and tests. - --- An simple example nodebox with one centered box -minetest.register_node("testnodes:nodebox_fixed", { - description = S("Fixed Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - drawtype = "nodebox", - paramtype = "light", - node_box = { - type = "fixed", - fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, - }, - - groups = {dig_immediate=3}, -}) - --- 50% higher than a regular node -minetest.register_node("testnodes:nodebox_overhigh", { - description = S("Overhigh Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - drawtype = "nodebox", - paramtype = "light", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 1, 0.5}, - }, - - groups = {dig_immediate=3}, -}) - --- 100% higher than a regular node -minetest.register_node("testnodes:nodebox_overhigh2", { - description = S("Double-height Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - drawtype = "nodebox", - paramtype = "light", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5}, - }, - - groups = {dig_immediate=3}, -}) - --- Height of nodebox changes with its param2 value -minetest.register_node("testnodes:nodebox_leveled", { - description = S("Leveled Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "leveled", - node_box = { - type = "leveled", - fixed = {-0.5, 0.0, -0.5, 0.5, -0.499, 0.5}, - }, - - groups = {dig_immediate=3}, -}) - --- Wall-like nodebox that connects to neighbors -minetest.register_node("testnodes:nodebox_connected", { - description = S("Connected Nodebox Test Node"), - tiles = {"testnodes_nodebox.png"}, - groups = {connected_nodebox=1, dig_immediate=3}, - drawtype = "nodebox", - paramtype = "light", - connects_to = {"group:connected_nodebox"}, - connect_sides = {"front", "back", "left", "right"}, - node_box = { - type = "connected", - fixed = {-0.125, -0.500, -0.125, 0.125, 0.500, 0.125}, - connect_front = {-0.125, -0.500, -0.500, 0.125, 0.400, -0.125}, - connect_back = {-0.125, -0.500, 0.125, 0.125, 0.400, 0.500}, - connect_left = {-0.500, -0.500, -0.125, -0.125, 0.400, 0.125}, - connect_right = {0.125, -0.500, -0.125, 0.500, 0.400, 0.125}, - }, -}) - diff --git a/games/minimal/mods/testnodes/param2.lua b/games/minimal/mods/testnodes/param2.lua deleted file mode 100644 index 5d64376fa..000000000 --- a/games/minimal/mods/testnodes/param2.lua +++ /dev/null @@ -1,168 +0,0 @@ --- This file is for misc. param2 tests that aren't covered in drawtypes.lua already. - -local S = minetest.get_translator("testnodes") - -minetest.register_node("testnodes:facedir", { - description = S("Facedir Test Node"), - paramtype2 = "facedir", - tiles = { - "testnodes_1.png", - "testnodes_2.png", - "testnodes_3.png", - "testnodes_4.png", - "testnodes_5.png", - "testnodes_6.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:facedir_nodebox", { - description = S("Facedir Nodebox Test Node"), - tiles = { - "testnodes_1.png", - "testnodes_2.png", - "testnodes_3.png", - "testnodes_4.png", - "testnodes_5.png", - "testnodes_6.png", - }, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "facedir", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2}, - }, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:wallmounted", { - description = S("Wallmounted Test Node"), - paramtype2 = "wallmounted", - tiles = { - "testnodes_1w.png", - "testnodes_2w.png", - "testnodes_3w.png", - "testnodes_4w.png", - "testnodes_5w.png", - "testnodes_6w.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:wallmounted_nodebox", { - description = S("Wallmounted Nodebox Test Node"), - paramtype2 = "wallmounted", - paramtype = "light", - tiles = { - "testnodes_1w.png", - "testnodes_2w.png", - "testnodes_3w.png", - "testnodes_4w.png", - "testnodes_5w.png", - "testnodes_6w.png", - }, - drawtype = "nodebox", - node_box = { - type = "wallmounted", - wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, - wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, - wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:color", { - description = S("Color Test Node"), - paramtype2 = "color", - palette = "testnodes_palette_full.png", - tiles = { - "testnodes_node.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:colorfacedir", { - description = S("Color Facedir Test Node"), - paramtype2 = "colorfacedir", - palette = "testnodes_palette_facedir.png", - tiles = { - "testnodes_1g.png", - "testnodes_2g.png", - "testnodes_3g.png", - "testnodes_4g.png", - "testnodes_5g.png", - "testnodes_6g.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:colorfacedir_nodebox", { - description = S("Color Facedir Nodebox Test Node"), - tiles = { - "testnodes_1g.png", - "testnodes_2g.png", - "testnodes_3g.png", - "testnodes_4g.png", - "testnodes_5g.png", - "testnodes_6g.png", - }, - drawtype = "nodebox", - paramtype = "light", - paramtype2 = "colorfacedir", - palette = "testnodes_palette_facedir.png", - node_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2}, - }, - - groups = {dig_immediate=3}, -}) - -minetest.register_node("testnodes:colorwallmounted", { - description = S("Color Wallmounted Test Node"), - paramtype2 = "colorwallmounted", - paramtype = "light", - palette = "testnodes_palette_wallmounted.png", - tiles = { - "testnodes_1wg.png", - "testnodes_2wg.png", - "testnodes_3wg.png", - "testnodes_4wg.png", - "testnodes_5wg.png", - "testnodes_6wg.png", - }, - - groups = { dig_immediate = 3 }, -}) - -minetest.register_node("testnodes:colorwallmounted_nodebox", { - description = S("Color Wallmounted Nodebox Test Node"), - paramtype2 = "colorwallmounted", - paramtype = "light", - palette = "testnodes_palette_wallmounted.png", - tiles = { - "testnodes_1wg.png", - "testnodes_2wg.png", - "testnodes_3wg.png", - "testnodes_4wg.png", - "testnodes_5wg.png", - "testnodes_6wg.png", - }, - drawtype = "nodebox", - node_box = { - type = "wallmounted", - wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, - wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, - wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, - }, - - groups = { dig_immediate = 3 }, -}) - diff --git a/games/minimal/mods/testnodes/properties.lua b/games/minimal/mods/testnodes/properties.lua deleted file mode 100644 index e169d4b08..000000000 --- a/games/minimal/mods/testnodes/properties.lua +++ /dev/null @@ -1,270 +0,0 @@ --- Test Nodes: Node property tests - -local S = minetest.get_translator("testnodes") - --- Is supposed to fall when it doesn't rest on solid ground -minetest.register_node("testnodes:falling", { - description = S("Falling Node"), - tiles = { - "testnodes_node.png", - "testnodes_node.png", - "testnodes_node_falling.png", - }, - groups = { falling_node = 1, dig_immediate = 3 }, -}) - --- Same as falling node, but will stop falling on top of liquids -minetest.register_node("testnodes:falling_float", { - description = S("Falling+Floating Node"), - groups = { falling_node = 1, float = 1, dig_immediate = 3 }, - - - tiles = { - "testnodes_node.png", - "testnodes_node.png", - "testnodes_node_falling.png", - }, - color = "cyan", -}) - --- This node attaches to the floor and drops as item --- when the floor is gone. -minetest.register_node("testnodes:attached", { - description = S("Floor-Attached Node"), - tiles = { - "testnodes_attached_top.png", - "testnodes_attached_bottom.png", - "testnodes_attached_side.png", - }, - groups = { attached_node = 1, dig_immediate = 3 }, -}) - --- This node attaches to the side of a node and drops as item --- when the node it attaches to is gone. -minetest.register_node("testnodes:attached_wallmounted", { - description = S("Wallmounted Attached Node"), - paramtype2 = "wallmounted", - tiles = { - "testnodes_attachedw_top.png", - "testnodes_attachedw_bottom.png", - "testnodes_attachedw_side.png", - }, - groups = { attached_node = 1, dig_immediate = 3 }, -}) - --- Jump disabled -minetest.register_node("testnodes:nojump", { - description = S("Non-jumping Node"), - groups = {disable_jump=1, dig_immediate=3}, - - - tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"}, -}) - --- Climbable up and down with jump and sneak keys -minetest.register_node("testnodes:climbable", { - description = S("Climbable Node"), - climbable = true, - walkable = false, - - - paramtype = "light", - sunlight_propagates = true, - is_ground_content = false, - tiles ={"testnodes_climbable_side.png"}, - drawtype = "glasslike", - groups = {dig_immediate=3}, -}) - --- Climbable only downwards with sneak key -minetest.register_node("testnodes:climbable_nojump", { - description = S("Downwards-climbable Node"), - climbable = true, - walkable = false, - - groups = {disable_jump=1, dig_immediate=3}, - drawtype = "glasslike", - tiles ={"testnodes_climbable_nojump_side.png"}, - paramtype = "light", - sunlight_propagates = true, -}) - --- A liquid in which you can't rise -minetest.register_node("testnodes:liquid_nojump", { - description = S("Non-jumping Liquid Source Node"), - liquidtype = "source", - liquid_range = 1, - liquid_viscosity = 0, - liquid_alternative_flowing = "testnodes:liquidflowing_nojump", - liquid_alternative_source = "testnodes:liquid_nojump", - liquid_renewable = false, - groups = {disable_jump=1, dig_immediate=3}, - walkable = false, - - drawtype = "liquid", - tiles = {"testnodes_liquidsource.png^[colorize:#FF0000:127"}, - special_tiles = { - {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false}, - {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = true}, - }, - use_texture_alpha = true, - paramtype = "light", - pointable = false, - liquids_pointable = true, - diggable = false, - buildable_to = true, - is_ground_content = false, - post_effect_color = {a = 70, r = 255, g = 0, b = 200}, -}) - --- A liquid in which you can't rise (flowing variant) -minetest.register_node("testnodes:liquidflowing_nojump", { - description = S("Non-jumping Flowing Liquid Node"), - liquidtype = "flowing", - liquid_range = 1, - liquid_viscosity = 0, - liquid_alternative_flowing = "testnodes:liquidflowing_nojump", - liquid_alternative_source = "testnodes:liquid_nojump", - liquid_renewable = false, - groups = {disable_jump=1, dig_immediate=3}, - walkable = false, - - - drawtype = "flowingliquid", - tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"}, - special_tiles = { - {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false}, - {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false}, - }, - use_texture_alpha = true, - paramtype = "light", - paramtype2 = "flowingliquid", - pointable = false, - liquids_pointable = true, - diggable = false, - buildable_to = true, - is_ground_content = false, - post_effect_color = {a = 70, r = 255, g = 0, b = 200}, -}) - --- Nodes that modify fall damage (various damage modifiers) -for i=-100, 100, 25 do - if i ~= 0 then - local subname, descnum - if i < 0 then - subname = "m"..math.abs(i) - descnum = tostring(i) - else - subname = tostring(i) - descnum = S("+@1", i) - end - local tex, color, desc - if i > 0 then - local val = math.floor((i/100)*255) - tex = "testnodes_fall_damage_plus.png" - color = { b=0, g=255-val, r=255, a=255 } - desc = S("Fall Damage Node (+@1%)", i) - else - tex = "testnodes_fall_damage_minus.png" - if i == -100 then - color = { r=0, b=0, g=255, a=255 } - else - local val = math.floor((math.abs(i)/100)*255) - color = { r=0, b=255, g=255-val, a=255 } - end - desc = S("Fall Damage Node (-@1%)", math.abs(i)) - end - minetest.register_node("testnodes:damage"..subname, { - description = desc, - groups = {fall_damage_add_percent=i, dig_immediate=3}, - - - tiles = { tex }, - is_ground_content = false, - color = color, - }) - end -end - --- Bouncy nodes (various bounce levels) -for i=20, 180, 20 do - local val = math.floor(((i-20)/200)*255) - minetest.register_node("testnodes:bouncy"..i, { - description = S("Bouncy Node (@1%)", i), - groups = {bouncy=i, dig_immediate=3}, - - - tiles ={"testnodes_bouncy.png"}, - is_ground_content = false, - color = { r=255, g=255-val, b=val, a=255 }, - }) -end - --- Slippery nodes (various slippery levels) -for i=1, 5 do - minetest.register_node("testnodes:slippery"..i, { - description = S("Slippery Node (@1)", i), - tiles ={"testnodes_slippery.png"}, - is_ground_content = false, - groups = {slippery=i, dig_immediate=3}, - color = { r=0, g=255, b=math.floor((i/5)*255), a=255 }, - }) -end - --- By placing something on the node, the node itself will be replaced -minetest.register_node("testnodes:buildable_to", { - description = S("Replacable Node"), - buildable_to = true, - tiles = {"testnodes_buildable_to.png"}, - is_ground_content = false, - groups = {dig_immediate=3}, -}) - --- Nodes that deal damage to players that are inside them. --- Negative damage nodes should heal. -for d=-3,3 do - if d ~= 0 then - local sub, tile - if d > 0 then - sub = tostring(d) - tile = "testnodes_damage.png" - else - sub = "m" .. tostring(math.abs(d)) - tile = "testnodes_damage_neg.png" - end - if math.abs(d) == 2 then - tile = tile .. "^[colorize:#000000:70" - elseif math.abs(d) == 3 then - tile = tile .. "^[colorize:#000000:140" - end - minetest.register_node("testnodes:damage_"..sub, { - description = S("Damage Node (@1 damage per second)", d), - damage_per_second = d, - - - walkable = false, - is_ground_content = false, - drawtype = "allfaces", - paramtype = "light", - sunlight_propagates = true, - tiles = { tile }, - groups = {dig_immediate=3}, - }) - end -end - --- Causes drowning damage -minetest.register_node("testnodes:drowning_1", { - description = S("Drowning Node (@1 damage)", 1), - drowning = 1, - - - walkable = false, - is_ground_content = false, - drawtype = "allfaces", - paramtype = "light", - sunlight_propagates = true, - tiles = { "testnodes_drowning.png" }, - groups = {dig_immediate=3}, -}) - diff --git a/games/minimal/mods/testnodes/settingtypes.txt b/games/minimal/mods/testnodes/settingtypes.txt deleted file mode 100644 index 7f753bf3e..000000000 --- a/games/minimal/mods/testnodes/settingtypes.txt +++ /dev/null @@ -1,4 +0,0 @@ -# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. -# This is due to . -# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off. -testnodes_show_fallback_image (Use fallback inventory images) bool false diff --git a/games/minimal/mods/testnodes/textures.lua b/games/minimal/mods/testnodes/textures.lua deleted file mode 100644 index f5db9ccbf..000000000 --- a/games/minimal/mods/testnodes/textures.lua +++ /dev/null @@ -1,67 +0,0 @@ --- Node texture tests - -local S = minetest.get_translator("testnodes") - -minetest.register_node("testnodes:6sides", { - description = S("Six Textures Test Node"), - tiles = { - "testnodes_normal1.png", - "testnodes_normal2.png", - "testnodes_normal3.png", - "testnodes_normal4.png", - "testnodes_normal5.png", - "testnodes_normal6.png", - }, - - groups = { dig_immediate = 2 }, -}) - -minetest.register_node("testnodes:anim", { - description = S("Animated Test Node"), - tiles = { - { name = "testnodes_anim.png", - animation = { - type = "vertical_frames", - aspect_w = 16, - aspect_h = 16, - length = 4.0, - }, }, - }, - - groups = { dig_immediate = 2 }, -}) - --- Node texture transparency test - -local alphas = { 64, 128, 191 } - -for a=1,#alphas do - local alpha = alphas[a] - - -- Transparency taken from texture - minetest.register_node("testnodes:alpha_texture_"..alpha, { - description = S("Texture Alpha Test Node (@1)", alpha), - drawtype = "glasslike", - paramtype = "light", - tiles = { - "testnodes_alpha"..alpha..".png", - }, - use_texture_alpha = true, - - groups = { dig_immediate = 3 }, - }) - - -- Transparency set via "alpha" parameter - minetest.register_node("testnodes:alpha_"..alpha, { - description = S("Alpha Test Node (@1)", alpha), - -- It seems that only the liquid drawtype supports the alpha parameter - drawtype = "liquid", - paramtype = "light", - tiles = { - "testnodes_alpha.png", - }, - alpha = alpha, - - groups = { dig_immediate = 3 }, - }) -end diff --git a/games/minimal/mods/testnodes/textures/testnodes_1.png b/games/minimal/mods/testnodes/textures/testnodes_1.png deleted file mode 100644 index 6730997e2..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_1g.png b/games/minimal/mods/testnodes/textures/testnodes_1g.png deleted file mode 100644 index 529298ece..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_1g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_1w.png b/games/minimal/mods/testnodes/textures/testnodes_1w.png deleted file mode 100644 index d24e571cc..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_1w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_1wg.png b/games/minimal/mods/testnodes/textures/testnodes_1wg.png deleted file mode 100644 index b2eba0e9a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_1wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_2.png b/games/minimal/mods/testnodes/textures/testnodes_2.png deleted file mode 100644 index 6c87c868d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_2g.png b/games/minimal/mods/testnodes/textures/testnodes_2g.png deleted file mode 100644 index cb9060f7b..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_2g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_2w.png b/games/minimal/mods/testnodes/textures/testnodes_2w.png deleted file mode 100644 index b56874ee1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_2w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_2wg.png b/games/minimal/mods/testnodes/textures/testnodes_2wg.png deleted file mode 100644 index 108dc87bb..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_2wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_3.png b/games/minimal/mods/testnodes/textures/testnodes_3.png deleted file mode 100644 index 05b45629a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_3g.png b/games/minimal/mods/testnodes/textures/testnodes_3g.png deleted file mode 100644 index 5c84f5882..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_3g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_3w.png b/games/minimal/mods/testnodes/textures/testnodes_3w.png deleted file mode 100644 index 8b435cf01..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_3w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_3wg.png b/games/minimal/mods/testnodes/textures/testnodes_3wg.png deleted file mode 100644 index 9ee900667..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_3wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_4.png b/games/minimal/mods/testnodes/textures/testnodes_4.png deleted file mode 100644 index 15e6ffec7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_4g.png b/games/minimal/mods/testnodes/textures/testnodes_4g.png deleted file mode 100644 index 8f144fae0..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_4g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_4w.png b/games/minimal/mods/testnodes/textures/testnodes_4w.png deleted file mode 100644 index 214e0df9d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_4w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_4wg.png b/games/minimal/mods/testnodes/textures/testnodes_4wg.png deleted file mode 100644 index 888b3d482..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_4wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_5.png b/games/minimal/mods/testnodes/textures/testnodes_5.png deleted file mode 100644 index 1ef1c728c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_5g.png b/games/minimal/mods/testnodes/textures/testnodes_5g.png deleted file mode 100644 index 30da4793a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_5g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_5w.png b/games/minimal/mods/testnodes/textures/testnodes_5w.png deleted file mode 100644 index b4cb42426..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_5w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_5wg.png b/games/minimal/mods/testnodes/textures/testnodes_5wg.png deleted file mode 100644 index fac9db28e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_5wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_6.png b/games/minimal/mods/testnodes/textures/testnodes_6.png deleted file mode 100644 index 805813e57..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_6g.png b/games/minimal/mods/testnodes/textures/testnodes_6g.png deleted file mode 100644 index a88f4c9f8..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_6g.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_6w.png b/games/minimal/mods/testnodes/textures/testnodes_6w.png deleted file mode 100644 index e6bbf97d9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_6w.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_6wg.png b/games/minimal/mods/testnodes/textures/testnodes_6wg.png deleted file mode 100644 index 29ca933e0..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_6wg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_airlike.png b/games/minimal/mods/testnodes/textures/testnodes_airlike.png deleted file mode 100644 index 5a5664a2a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_airlike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_allfaces.png b/games/minimal/mods/testnodes/textures/testnodes_allfaces.png deleted file mode 100644 index c0a7dc550..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_allfaces.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_allfaces_optional.png b/games/minimal/mods/testnodes/textures/testnodes_allfaces_optional.png deleted file mode 100644 index 1f6a17313..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_allfaces_optional.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_alpha.png b/games/minimal/mods/testnodes/textures/testnodes_alpha.png deleted file mode 100644 index 157fa7386..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_alpha.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_alpha128.png b/games/minimal/mods/testnodes/textures/testnodes_alpha128.png deleted file mode 100644 index 16babf6c7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_alpha128.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_alpha191.png b/games/minimal/mods/testnodes/textures/testnodes_alpha191.png deleted file mode 100644 index f165d2887..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_alpha191.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_alpha64.png b/games/minimal/mods/testnodes/textures/testnodes_alpha64.png deleted file mode 100644 index c343c32c3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_alpha64.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_anim.png b/games/minimal/mods/testnodes/textures/testnodes_anim.png deleted file mode 100644 index d321fe857..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_anim.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attached_bottom.png b/games/minimal/mods/testnodes/textures/testnodes_attached_bottom.png deleted file mode 100644 index e01ae576f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attached_bottom.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attached_side.png b/games/minimal/mods/testnodes/textures/testnodes_attached_side.png deleted file mode 100644 index 9459cbb05..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attached_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attached_top.png b/games/minimal/mods/testnodes/textures/testnodes_attached_top.png deleted file mode 100644 index 0148b41e0..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attached_top.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attachedw_bottom.png b/games/minimal/mods/testnodes/textures/testnodes_attachedw_bottom.png deleted file mode 100644 index 488ad23a9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attachedw_bottom.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attachedw_side.png b/games/minimal/mods/testnodes/textures/testnodes_attachedw_side.png deleted file mode 100644 index a02facbc7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attachedw_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_attachedw_top.png b/games/minimal/mods/testnodes/textures/testnodes_attachedw_top.png deleted file mode 100644 index 1f4fc7b85..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_attachedw_top.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_bouncy.png b/games/minimal/mods/testnodes/textures/testnodes_bouncy.png deleted file mode 100644 index eabbbdfe4..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_bouncy.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_buildable_to.png b/games/minimal/mods/testnodes/textures/testnodes_buildable_to.png deleted file mode 100644 index 23b5e54d2..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_buildable_to.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_climbable_nojump_side.png b/games/minimal/mods/testnodes/textures/testnodes_climbable_nojump_side.png deleted file mode 100644 index d5ca13033..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_climbable_nojump_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_climbable_side.png b/games/minimal/mods/testnodes/textures/testnodes_climbable_side.png deleted file mode 100644 index c56ea90d7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_climbable_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_damage.png b/games/minimal/mods/testnodes/textures/testnodes_damage.png deleted file mode 100644 index 9de2ab5e8..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_damage.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_damage_neg.png b/games/minimal/mods/testnodes/textures/testnodes_damage_neg.png deleted file mode 100644 index 85811bc8e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_damage_neg.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_drowning.png b/games/minimal/mods/testnodes/textures/testnodes_drowning.png deleted file mode 100644 index 57ffc8fcf..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_drowning.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_fall_damage_minus.png b/games/minimal/mods/testnodes/textures/testnodes_fall_damage_minus.png deleted file mode 100644 index 88d3bdf58..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_fall_damage_minus.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_fall_damage_plus.png b/games/minimal/mods/testnodes/textures/testnodes_fall_damage_plus.png deleted file mode 100644 index 61fdec2e3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_fall_damage_plus.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_fencelike.png b/games/minimal/mods/testnodes/textures/testnodes_fencelike.png deleted file mode 100644 index 84dea1b7c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_fencelike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_firelike.png b/games/minimal/mods/testnodes/textures/testnodes_firelike.png deleted file mode 100644 index ee59b0db1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_firelike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike.png deleted file mode 100644 index cf3e35414..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike_detail.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike_detail.png deleted file mode 100644 index 30c9586e8..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike_detail.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed.png deleted file mode 100644 index 8a513f21c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed2.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed2.png deleted file mode 100644 index 4ea839c8b..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed_optional.png b/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed_optional.png deleted file mode 100644 index 37de77dd1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslike_framed_optional.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_glasslikeliquid.png b/games/minimal/mods/testnodes/textures/testnodes_glasslikeliquid.png deleted file mode 100644 index e1e96ffb9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_glasslikeliquid.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light.png b/games/minimal/mods/testnodes/textures/testnodes_light.png deleted file mode 100644 index 4ba0081c3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_1.png b/games/minimal/mods/testnodes/textures/testnodes_light_1.png deleted file mode 100644 index 57adf5a4a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_10.png b/games/minimal/mods/testnodes/textures/testnodes_light_10.png deleted file mode 100644 index 483834770..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_10.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_11.png b/games/minimal/mods/testnodes/textures/testnodes_light_11.png deleted file mode 100644 index 4c423d9b4..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_11.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_12.png b/games/minimal/mods/testnodes/textures/testnodes_light_12.png deleted file mode 100644 index bc7946d09..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_12.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_13.png b/games/minimal/mods/testnodes/textures/testnodes_light_13.png deleted file mode 100644 index 0b63c84a6..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_13.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_14.png b/games/minimal/mods/testnodes/textures/testnodes_light_14.png deleted file mode 100644 index a817bd394..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_14.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_2.png b/games/minimal/mods/testnodes/textures/testnodes_light_2.png deleted file mode 100644 index 852eaeff1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_3.png b/games/minimal/mods/testnodes/textures/testnodes_light_3.png deleted file mode 100644 index 79fc834cc..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_4.png b/games/minimal/mods/testnodes/textures/testnodes_light_4.png deleted file mode 100644 index 75f8c6136..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_5.png b/games/minimal/mods/testnodes/textures/testnodes_light_5.png deleted file mode 100644 index b6eede0ae..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_6.png b/games/minimal/mods/testnodes/textures/testnodes_light_6.png deleted file mode 100644 index ef54addec..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_7.png b/games/minimal/mods/testnodes/textures/testnodes_light_7.png deleted file mode 100644 index 4a885b0f6..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_7.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_8.png b/games/minimal/mods/testnodes/textures/testnodes_light_8.png deleted file mode 100644 index b283301e3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_8.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_light_9.png b/games/minimal/mods/testnodes/textures/testnodes_light_9.png deleted file mode 100644 index 2aa902358..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_light_9.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_line_crossing.png b/games/minimal/mods/testnodes/textures/testnodes_line_crossing.png deleted file mode 100644 index e566f2793..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_line_crossing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_line_curved.png b/games/minimal/mods/testnodes/textures/testnodes_line_curved.png deleted file mode 100644 index ab9f8e720..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_line_curved.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_line_straight.png b/games/minimal/mods/testnodes/textures/testnodes_line_straight.png deleted file mode 100644 index 4f33d9c6d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_line_straight.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_line_t_junction.png b/games/minimal/mods/testnodes/textures/testnodes_line_t_junction.png deleted file mode 100644 index 5668f6ea3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_line_t_junction.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquid.png b/games/minimal/mods/testnodes/textures/testnodes_liquid.png deleted file mode 100644 index 98ab270c2..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquid.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing.png deleted file mode 100644 index 1736b89ba..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r0.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r0.png deleted file mode 100644 index e8a61039d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r0.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r1.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r1.png deleted file mode 100644 index b4e45b42f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r2.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r2.png deleted file mode 100644 index e064b8f2d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r3.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r3.png deleted file mode 100644 index bef773968..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r4.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r4.png deleted file mode 100644 index de1001b2d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r5.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r5.png deleted file mode 100644 index 97b422e9a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r6.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r6.png deleted file mode 100644 index 4cd8e4e8e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r7.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r7.png deleted file mode 100644 index 711dd961c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r7.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r8.png b/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r8.png deleted file mode 100644 index 9cf22b8ca..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidflowing_r8.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource.png deleted file mode 100644 index b3f29b702..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r0.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r0.png deleted file mode 100644 index da0a99623..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r0.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r1.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r1.png deleted file mode 100644 index 66bf2be8f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r2.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r2.png deleted file mode 100644 index fc5f65cb6..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r3.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r3.png deleted file mode 100644 index 0f46e291e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r4.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r4.png deleted file mode 100644 index 0693a04d7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r5.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r5.png deleted file mode 100644 index cc9d03992..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r6.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r6.png deleted file mode 100644 index e276a07ae..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r7.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r7.png deleted file mode 100644 index 3534a4b15..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r7.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r8.png b/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r8.png deleted file mode 100644 index ee1a8b169..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_liquidsource_r8.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes.png b/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes.png deleted file mode 100644 index 51b8e0025..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes2.png b/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes2.png deleted file mode 100644 index 9ea65c1ec..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes3.png b/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes3.png deleted file mode 100644 index 96bc55ac5..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes4.png b/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes4.png deleted file mode 100644 index fca33727d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_mesh_stripes4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_node.png b/games/minimal/mods/testnodes/textures/testnodes_node.png deleted file mode 100644 index 145099b3a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_node.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_node_falling.png b/games/minimal/mods/testnodes/textures/testnodes_node_falling.png deleted file mode 100644 index 44153185c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_node_falling.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_nodebox.png b/games/minimal/mods/testnodes/textures/testnodes_nodebox.png deleted file mode 100644 index 66e8dd663..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_nodebox.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_nojump_side.png b/games/minimal/mods/testnodes/textures/testnodes_nojump_side.png deleted file mode 100644 index 6a64cfff0..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_nojump_side.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_nojump_top.png b/games/minimal/mods/testnodes/textures/testnodes_nojump_top.png deleted file mode 100644 index fe770838f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_nojump_top.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal.png b/games/minimal/mods/testnodes/textures/testnodes_normal.png deleted file mode 100644 index a1acfd9fd..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal1.png b/games/minimal/mods/testnodes/textures/testnodes_normal1.png deleted file mode 100644 index edaba77e4..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal1.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal2.png b/games/minimal/mods/testnodes/textures/testnodes_normal2.png deleted file mode 100644 index 0080a9ee7..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal2.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal3.png b/games/minimal/mods/testnodes/textures/testnodes_normal3.png deleted file mode 100644 index 0426ab216..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal3.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal4.png b/games/minimal/mods/testnodes/textures/testnodes_normal4.png deleted file mode 100644 index 0d1922eb6..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal4.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal5.png b/games/minimal/mods/testnodes/textures/testnodes_normal5.png deleted file mode 100644 index 0b7dcd2da..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal5.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_normal6.png b/games/minimal/mods/testnodes/textures/testnodes_normal6.png deleted file mode 100644 index f34a67d71..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_normal6.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_palette_facedir.png b/games/minimal/mods/testnodes/textures/testnodes_palette_facedir.png deleted file mode 100644 index 8cf47bbbe..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_palette_facedir.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_palette_full.png b/games/minimal/mods/testnodes/textures/testnodes_palette_full.png deleted file mode 100644 index e0a5f8b34..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_palette_full.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_palette_wallmounted.png b/games/minimal/mods/testnodes/textures/testnodes_palette_wallmounted.png deleted file mode 100644 index 682f3ac84..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_palette_wallmounted.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike.png deleted file mode 100644 index cc464444d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_degrotate.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_degrotate.png deleted file mode 100644 index 01c81da8e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_degrotate.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_leveled.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_leveled.png deleted file mode 100644 index 53504dbcd..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_leveled.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_meshoptions.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_meshoptions.png deleted file mode 100644 index d504d459f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_meshoptions.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted.png deleted file mode 100644 index 79cf2125e..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base.png deleted file mode 100644 index b9ee9e5be..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png deleted file mode 100644 index 85311cb2c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_degrotate.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png deleted file mode 100644 index bc602bafe..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_leveled.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png deleted file mode 100644 index d10002375..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_meshoptions.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png deleted file mode 100644 index 527817bc1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_waving.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png deleted file mode 100644 index 45e75bdd3..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_degrotate.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png deleted file mode 100644 index 8954b2c34..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_leveled.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png deleted file mode 100644 index a782d4874..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_meshoptions.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png deleted file mode 100644 index 112a0540f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_rooted_waving.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_plantlike_waving.png b/games/minimal/mods/testnodes/textures/testnodes_plantlike_waving.png deleted file mode 100644 index b584a8dc9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_plantlike_waving.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail2_crossing.png b/games/minimal/mods/testnodes/textures/testnodes_rail2_crossing.png deleted file mode 100644 index 530bbba7a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail2_crossing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail2_curved.png b/games/minimal/mods/testnodes/textures/testnodes_rail2_curved.png deleted file mode 100644 index 4ed1ca00f..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail2_curved.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail2_straight.png b/games/minimal/mods/testnodes/textures/testnodes_rail2_straight.png deleted file mode 100644 index 8749330d8..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail2_straight.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail2_t_junction.png b/games/minimal/mods/testnodes/textures/testnodes_rail2_t_junction.png deleted file mode 100644 index 0517f6570..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail2_t_junction.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail_crossing.png b/games/minimal/mods/testnodes/textures/testnodes_rail_crossing.png deleted file mode 100644 index 3916ce1ef..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail_crossing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail_curved.png b/games/minimal/mods/testnodes/textures/testnodes_rail_curved.png deleted file mode 100644 index e44419848..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail_curved.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail_straight.png b/games/minimal/mods/testnodes/textures/testnodes_rail_straight.png deleted file mode 100644 index 872d04fb9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail_straight.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_rail_t_junction.png b/games/minimal/mods/testnodes/textures/testnodes_rail_t_junction.png deleted file mode 100644 index 7e4af5182..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_rail_t_junction.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_signlike.png b/games/minimal/mods/testnodes/textures/testnodes_signlike.png deleted file mode 100644 index 33ffcba6c..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_signlike.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_slippery.png b/games/minimal/mods/testnodes/textures/testnodes_slippery.png deleted file mode 100644 index b990468a1..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_slippery.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_street_crossing.png b/games/minimal/mods/testnodes/textures/testnodes_street_crossing.png deleted file mode 100644 index d6e35ad7a..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_street_crossing.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_street_curved.png b/games/minimal/mods/testnodes/textures/testnodes_street_curved.png deleted file mode 100644 index 251b7fb71..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_street_curved.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_street_straight.png b/games/minimal/mods/testnodes/textures/testnodes_street_straight.png deleted file mode 100644 index 639e24b93..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_street_straight.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_street_t_junction.png b/games/minimal/mods/testnodes/textures/testnodes_street_t_junction.png deleted file mode 100644 index 713621e06..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_street_t_junction.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_sunlight_filter.png b/games/minimal/mods/testnodes/textures/testnodes_sunlight_filter.png deleted file mode 100644 index b38ea4072..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_sunlight_filter.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_torchlike_ceiling.png b/games/minimal/mods/testnodes/textures/testnodes_torchlike_ceiling.png deleted file mode 100644 index 5d9862cc9..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_torchlike_ceiling.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_torchlike_floor.png b/games/minimal/mods/testnodes/textures/testnodes_torchlike_floor.png deleted file mode 100644 index adf1e002d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_torchlike_floor.png and /dev/null differ diff --git a/games/minimal/mods/testnodes/textures/testnodes_torchlike_wall.png b/games/minimal/mods/testnodes/textures/testnodes_torchlike_wall.png deleted file mode 100644 index cb442b22d..000000000 Binary files a/games/minimal/mods/testnodes/textures/testnodes_torchlike_wall.png and /dev/null differ diff --git a/games/minimal/mods/testpathfinder/README.md b/games/minimal/mods/testpathfinder/README.md deleted file mode 100644 index 2b9d46e70..000000000 --- a/games/minimal/mods/testpathfinder/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Pathfinder Tester - -Usage: - -Use the Pathfinder Tester tool (`testpathfinder:testpathfinder`). -Here's how it works: - -* Place on node: Set destination position -* Punch: Find path -* Sneak+punch: Select pathfinding algorithm - -Information will be shown in chat. If a path was found, all waypoints -will be shown for a few seconds. - -See `init.lua` for config variables. diff --git a/games/minimal/mods/testpathfinder/init.lua b/games/minimal/mods/testpathfinder/init.lua deleted file mode 100644 index f94848236..000000000 --- a/games/minimal/mods/testpathfinder/init.lua +++ /dev/null @@ -1,132 +0,0 @@ -local S = minetest.get_translator("testpathfinder") - --- Config parameters - --- Maximum direct distance between start and end -local MAX_DIRECT_DISTANCE = 64 --- Maximum search distance -local MAX_SEARCH_DISTANCE = 32 --- Maximum permitted jump height -local MAX_JUMP = 1 --- Maximum permitted drop height -local MAX_DROP = 5 --- If true, mod won't refuse to run pathfinder even at long distances -local IGNORE_MAX_DISTANCE_SAFEGUARD = false - --- End of config parameters - -local timer = 0 -local algorithms = { - "A*_noprefetch", - "A*", - "Dijkstra", -} - -local function find_path_for_player(player, itemstack) - local meta = itemstack:get_meta() - if not meta then - return - end - local x = meta:get_int("pos_x") - local y = meta:get_int("pos_y") - local z = meta:get_int("pos_z") - local algo = meta:get_int("algorithm") - if x and y and z then - local pos2 = {x=x, y=y, z=z} - algo = algorithms[algo+1] - local pos1 = vector.round(player:get_pos()) - -- Don't bother calling pathfinder for high distance to avoid freezing - if (not IGNORE_MAX_DISTANCE_SAFEGUARD) and (vector.distance(pos1, pos2) > MAX_DIRECT_DISTANCE) then - minetest.chat_send_player(player:get_player_name(), S("Destination too far away! Set a destination (via placing) within a distance of @1 and try again!", MAX_DIRECT_DISTANCE)) - return - end - local str = S("Path from @1 to @2:", - minetest.pos_to_string(pos1), - minetest.pos_to_string(pos2)) - - minetest.chat_send_player(player:get_player_name(), str) - local time_start = minetest.get_us_time() - local path = minetest.find_path(pos1, pos2, MAX_SEARCH_DISTANCE, MAX_JUMP, MAX_DROP, algo) - local time_end = minetest.get_us_time() - local time_diff = time_end - time_start - str = "" - if not path then - minetest.chat_send_player(player:get_player_name(), S("No path!")) - minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000)) - return - end - for s=1, #path do - str = str .. minetest.pos_to_string(path[s]) .. "\n" - local t - if s == #path then - t = "testpathfinder_waypoint_end.png" - elseif s == 1 then - t = "testpathfinder_waypoint_start.png" - else - local c = math.floor(((#path-s)/#path)*255) - t = string.format("testpathfinder_waypoint.png^[multiply:#%02x%02x00", 0xFF-c, c) - end - minetest.add_particle({ - pos = path[s], - expirationtime = 5 + 0.2 * s, - playername = player:get_player_name(), - glow = minetest.LIGHT_MAX, - texture = t, - size = 3, - }) - end - minetest.chat_send_player(player:get_player_name(), str) - minetest.chat_send_player(player:get_player_name(), S("Path length: @1", #path)) - minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000)) - end -end - -local function set_destination(itemstack, user, pointed_thing) - if not (user and user:is_player()) then - return - end - local name = user:get_player_name() - local obj - local meta = itemstack:get_meta() - if pointed_thing.type == "node" then - local pos = pointed_thing.above - meta:set_int("pos_x", pos.x) - meta:set_int("pos_y", pos.y) - meta:set_int("pos_z", pos.z) - minetest.chat_send_player(user:get_player_name(), S("Destination set to @1", minetest.pos_to_string(pos))) - return itemstack - end -end - -local function find_path_or_set_algorithm(itemstack, user, pointed_thing) - if not (user and user:is_player()) then - return - end - local ctrl = user:get_player_control() - -- No sneak: Find path - if not ctrl.sneak then - find_path_for_player(user, itemstack) - else - -- Sneak: Set algorithm - local meta = itemstack:get_meta() - local algo = meta:get_int("algorithm") - algo = (algo + 1) % #algorithms - meta:set_int("algorithm", algo) - minetest.chat_send_player(user:get_player_name(), S("Algorithm: @1", algorithms[algo+1])) - return itemstack - end -end - --- Punch: Find path --- Sneak+punch: Select pathfinding algorithm --- Place: Select destination node -minetest.register_tool("testpathfinder:testpathfinder", { - description = S("Pathfinder Tester"), - inventory_image = "testpathfinder_testpathfinder.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = find_path_or_set_algorithm, - on_secondary_use = set_destination, - on_place = set_destination, -}) - - diff --git a/games/minimal/mods/testpathfinder/mod.conf b/games/minimal/mods/testpathfinder/mod.conf deleted file mode 100644 index e6034ae8c..000000000 --- a/games/minimal/mods/testpathfinder/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testpathfinder -description = Tool to test Minetest's pathfinder function diff --git a/games/minimal/mods/testpathfinder/textures/testpathfinder_testpathfinder.png b/games/minimal/mods/testpathfinder/textures/testpathfinder_testpathfinder.png deleted file mode 100644 index 37eef0565..000000000 Binary files a/games/minimal/mods/testpathfinder/textures/testpathfinder_testpathfinder.png and /dev/null differ diff --git a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint.png b/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint.png deleted file mode 100644 index 661dcf906..000000000 Binary files a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint.png and /dev/null differ diff --git a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_end.png b/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_end.png deleted file mode 100644 index 41a1cc549..000000000 Binary files a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_end.png and /dev/null differ diff --git a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_start.png b/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_start.png deleted file mode 100644 index a22e31c3b..000000000 Binary files a/games/minimal/mods/testpathfinder/textures/testpathfinder_waypoint_start.png and /dev/null differ diff --git a/games/minimal/mods/testtools/README.md b/games/minimal/mods/testtools/README.md deleted file mode 100644 index 9cfe29ea4..000000000 --- a/games/minimal/mods/testtools/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# Test Tools readme - -Test Tools is a mod for developers that adds a bunch of tools to directly manipulate nodes and entities. This is great for quickly testing out stuff. - -Here's the list of tools: - -## Remover -Removes nodes and non-player entities that you punch. - -## Node Setter -Replace a node with another one. - -First, punch a node you want to remember. -Then rightclick any other node to replace it with the node you remembered. - -If you rightclick while pointing nothing, you can manually enter the node and param2. - -## Param2 Tool -Change the value param2 of nodes. - -* Punch: Add 1 to param2 -* Sneak+Punch: Add 8 to param2 -* Place: Subtract 1 from param2 -* Sneak+Place: Subtract 8 from param2 - -Note: Use the debug screen (F5) to see the param2 of the pointed node. - -## Falling Node Tool -Turns nodes into falling nodes. - -Usage: - -* Punch node: Make it fall -* Place: Try to teleport up to 2 units upwards, then make it fall - -## Entity Rotator -Changes the entity rotation (with `set_rotation`). - -Usage: - -* Punch entity: Rotate yaw -* Punch entity while holding down “Sneak” key: Rotate pitch -* Punch entity while holding down “Special” key (aka “Aux”): Rotate roll - -Each usage rotates the entity by 22.5°. - -## Entity Spawner -Spawns entities. - -Usage: - -* Punch to select entity or spawn one directly -* Place to place selected entity - -## Object Property Editor -Edits properties of objects. - -Usage: - -* Punch object to open a formspec that allows you to view and edit properties -* Punch air to edit properties of your own player object - -To edit a property, select it in the list, enter a new value (in Lua syntax) -and hit “Submit”. - -## Object Attacher -Allows you to attach an object to another one. - -Basic usage: -* First select the parent object, then the child object that should be attached -* Selecting an object is done by punching it -* Sneak+punch to detach selected object -* If you punch air, you select yourself - -Configuration: -* Place: Increase attachment Y position -* Sneak+place: decrease attachment Y position -* Aux+place: Increase attachment X rotation -* Aux+Sneak+Rightclick: Decrease attachment X rotation - -Hint: To detach all objects nearby you (including on yourself), use the -`/detach` server command. - -## Object Mover -Move an object by a given distance. - -Usage: -* Punch object into the direction you want to move it -* Sneak+punch: Move object towards you -* Place: Increase move distance -* Sneak+place: Decrease move distance - -## Entity Visual Scaler -Change visual size of entities - -Usage: - -* Punch entity to increase visual size -* Sneak+punch entity to decrease visual size diff --git a/games/minimal/mods/testtools/init.lua b/games/minimal/mods/testtools/init.lua deleted file mode 100644 index a63c98377..000000000 --- a/games/minimal/mods/testtools/init.lua +++ /dev/null @@ -1,691 +0,0 @@ -local S = minetest.get_translator("testtools") -local F = minetest.formspec_escape - --- TODO: Add a Node Metadata tool - --- Param 2 Tool: Set param2 value of tools --- Punch: +1 --- Punch+Shift: +8 --- Place: -1 --- Place+Shift: -8 -minetest.register_tool("testtools:param2tool", { - description = S("Param2 Tool"), - inventory_image = "testtools_param2tool.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type ~= "node" or (not pos) then - return - end - local add = 1 - if user then - local ctrl = user:get_player_control() - if ctrl.sneak then - add = 8 - end - end - local node = minetest.get_node(pos) - node.param2 = node.param2 + add - minetest.swap_node(pos, node) - end, - on_place = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type ~= "node" or (not pos) then - return - end - local add = -1 - if user then - local ctrl = user:get_player_control() - if ctrl.sneak then - add = -8 - end - end - local node = minetest.get_node(pos) - node.param2 = node.param2 + add - minetest.swap_node(pos, node) - end, -}) - -minetest.register_tool("testtools:node_setter", { - description = S("Node Setter"), - inventory_image = "testtools_node_setter.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type == "nothing" then - local meta = itemstack:get_meta() - meta:set_string("node", "air") - meta:set_int("node_param2", 0) - if user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", "air", 0)) - end - return itemstack - elseif pointed_thing.type ~= "node" or (not pos) then - return - end - local node = minetest.get_node(pos) - local meta = itemstack:get_meta() - meta:set_string("node", node.name) - meta:set_int("node_param2", node.param2) - if user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", node.name, node.param2)) - end - return itemstack - end, - on_secondary_use = function(itemstack, user, pointed_thing) - local meta = itemstack:get_meta() - local nodename = meta:get_string("node") or "" - local param2 = meta:get_int("node_param2") or 0 - - minetest.show_formspec(user:get_player_name(), "testtools:node_setter", - "size[4,4]".. - "field[0.5,1;3,1;nodename;"..F(S("Node name (itemstring):"))..";"..F(nodename).."]".. - "field[0.5,2;3,1;param2;"..F(S("param2:"))..";"..F(tostring(param2)).."]".. - "button_exit[0.5,3;3,1;submit;"..F(S("Submit")).."]" - ) - end, - on_place = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - local meta = itemstack:get_meta() - local nodename = meta:get_string("node") - if nodename == "" and user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Punch a node first!")) - return - end - local param2 = meta:get_int("node_param2") - if not param2 then - param2 = 0 - end - local node = { name = nodename, param2 = param2 } - if not minetest.registered_nodes[nodename] then - minetest.chat_send_player(user:get_player_name(), S("Cannot set unknown node: @1", nodename)) - return - end - minetest.set_node(pos, node) - end, -}) - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if formname == "testtools:node_setter" then - local playername = player:get_player_name() - local witem = player:get_wielded_item() - if witem:get_name() == "testtools:node_setter" then - if fields.nodename and fields.param2 then - local param2 = tonumber(fields.param2) - if not param2 then - return - end - local meta = witem:get_meta() - meta:set_string("node", fields.nodename) - meta:set_int("node_param2", param2) - player:set_wielded_item(witem) - end - end - end -end) - -minetest.register_tool("testtools:remover", { - description = S("Remover"), - inventory_image = "testtools_remover.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type == "node" and pos ~= nil then - minetest.remove_node(pos) - elseif pointed_thing.type == "object" then - local obj = pointed_thing.ref - if not obj:is_player() then - obj:remove() - end - end - end, -}) - -minetest.register_tool("testtools:falling_node_tool", { - description = S("Falling Node Tool"), - inventory_image = "testtools_falling_node_tool.png", - groups = { testtool = 1, disable_repair = 1 }, - on_place = function(itemstack, user, pointed_thing) - -- Teleport node 1-2 units upwards (if possible) and make it fall - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type ~= "node" or (not pos) then - return - end - local ok = false - local highest - for i=1,2 do - local above = {x=pos.x,y=pos.y+i,z=pos.z} - local n2 = minetest.get_node(above) - local def2 = minetest.registered_nodes[n2.name] - if def2 and (not def2.walkable) then - highest = above - else - break - end - end - if highest then - local node = minetest.get_node(pos) - local metatable = minetest.get_meta(pos):to_table() - minetest.remove_node(pos) - minetest.set_node(highest, node) - local meta_highest = minetest.get_meta(highest) - meta_highest:from_table(metatable) - ok = minetest.spawn_falling_node(highest) - else - ok = minetest.spawn_falling_node(pos) - end - if not ok and user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!")) - end - end, - on_use = function(itemstack, user, pointed_thing) - local pos = minetest.get_pointed_thing_position(pointed_thing) - if pointed_thing.type ~= "node" or (not pos) then - return - end - local ok = minetest.spawn_falling_node(pos) - if not ok and user and user:is_player() then - minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!")) - end - end, -}) - -minetest.register_tool("testtools:rotator", { - description = S("Entity Rotator"), - inventory_image = "testtools_entity_rotator.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "object" then - return - end - local obj = pointed_thing.ref - if obj:is_player() then - -- No player rotation - return - else - local axis = "y" - if user and user:is_player() then - local ctrl = user:get_player_control() - if ctrl.sneak then - axis = "x" - elseif ctrl.aux1 then - axis = "z" - end - end - local rot = obj:get_rotation() - rot[axis] = rot[axis] + math.pi/8 - if rot[axis] > math.pi*2 then - rot[axis] = rot[axis] - math.pi*2 - end - obj:set_rotation(rot) - end - end, -}) - -local mover_config = function(itemstack, user, pointed_thing) - if not (user and user:is_player()) then - return - end - local name = user:get_player_name() - local ctrl = user:get_player_control() - local meta = itemstack:get_meta() - local dist = 1.0 - if meta:contains("distance") then - dist = meta:get_int("distance") - end - if ctrl.sneak then - dist = dist - 1 - else - dist = dist + 1 - end - meta:set_int("distance", dist) - minetest.chat_send_player(user:get_player_name(), S("distance=@1/10", dist*2)) - return itemstack -end - -minetest.register_tool("testtools:object_mover", { - description = S("Object Mover"), - inventory_image = "testtools_object_mover.png", - groups = { testtool = 1, disable_repair = 1 }, - on_place = mover_config, - on_secondary_use = mover_config, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "object" then - return - end - local obj = pointed_thing.ref - if not (user and user:is_player()) then - return - end - local yaw = user:get_look_horizontal() - local dir = minetest.yaw_to_dir(yaw) - local pos = obj:get_pos() - local pitch = user:get_look_vertical() - if pitch > 0.25 * math.pi then - dir.y = -1 - dir.x = 0 - dir.z = 0 - elseif pitch < -0.25 * math.pi then - dir.y = 1 - dir.x = 0 - dir.z = 0 - end - local ctrl = user:get_player_control() - if ctrl.sneak then - dir = vector.multiply(dir, -1) - end - local meta = itemstack:get_meta() - if meta:contains("distance") then - local dist = meta:get_int("distance") - dir = vector.multiply(dir, dist*0.2) - end - pos = vector.add(pos, dir) - obj:set_pos(pos) - end, -}) - - - -minetest.register_tool("testtools:entity_scaler", { - description = S("Entity Visual Scaler"), - inventory_image = "testtools_entity_scaler.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type ~= "object" then - return - end - local obj = pointed_thing.ref - if obj:is_player() then - -- No player scaling - return - else - local diff = 0.1 - if user and user:is_player() then - local ctrl = user:get_player_control() - if ctrl.sneak then - diff = -0.1 - end - end - local prop = obj:get_properties() - if not prop.visual_size then - prop.visual_size = { x=1, y=1, z=1 } - else - prop.visual_size = { x=prop.visual_size.x+diff, y=prop.visual_size.y+diff, z=prop.visual_size.z+diff } - if prop.visual_size.x <= 0.1 then - prop.visual_size.x = 0.1 - end - if prop.visual_size.y <= 0.1 then - prop.visual_size.y = 0.1 - end - if prop.visual_size.z <= 0.1 then - prop.visual_size.z = 0.1 - end - end - obj:set_properties(prop) - end - end, -}) - -local selections = {} -local entity_list -local function get_entity_list() - if entity_list then - return entity_list - end - local ents = minetest.registered_entities - local list = {} - for k,_ in pairs(ents) do - table.insert(list, k) - end - table.sort(list) - entity_list = list - return entity_list -end -minetest.register_tool("testtools:entity_spawner", { - description = S("Entity Spawner"), - inventory_image = "testtools_entity_spawner.png", - groups = { testtool = 1, disable_repair = 1 }, - on_place = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - if selections[name] and pointed_thing.type == "node" then - local pos = pointed_thing.above - minetest.add_entity(pos, get_entity_list()[selections[name]]) - end - end, - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type == "object" then - return - end - if user and user:is_player() then - local list = table.concat(get_entity_list(), ",") - local name = user:get_player_name() - local sel = selections[name] or "" - minetest.show_formspec(name, "testtools:entity_list", - "size[9,9]".. - "textlist[0,0;9,8;entity_list;"..list..";"..sel..";false]".. - "button[0,8;4,1;spawn;Spawn entity]" - ) - end - end, -}) - -local function prop_to_string(property) - if type(property) == "string" then - return "\"" .. property .. "\"" - elseif type(property) == "table" then - return tostring(dump(property)):gsub("\n", "") - else - return tostring(property) - end -end - -local property_formspec_data = {} -local property_formspec_index = {} -local selected_objects = {} -local function get_object_properties_form(obj, playername) - if not playername then return "" end - local props = obj:get_properties() - local str = "" - property_formspec_data[playername] = {} - local proplist = {} - for k,_ in pairs(props) do - table.insert(proplist, k) - end - table.sort(proplist) - for p=1, #proplist do - local k = proplist[p] - local v = props[k] - local newline = "" - newline = k .. " = " - newline = newline .. prop_to_string(v) - str = str .. F(newline) - if p < #proplist then - str = str .. "," - end - table.insert(property_formspec_data[playername], k) - end - return str -end - -local editor_formspec_selindex = {} - -local editor_formspec = function(playername, obj, value, sel) - if not value then - value = "" - end - if not sel then - sel = "" - end - local list = get_object_properties_form(obj, playername) - local title - if obj:is_player() then - title = S("Object properties of player “@1”", obj:get_player_name()) - else - local ent = obj:get_luaentity() - title = S("Object properties of @1", ent.name) - end - minetest.show_formspec(playername, "testtools:object_editor", - "size[9,9]".. - "label[0,0;"..F(title).."]".. - "textlist[0,0.5;9,7.5;object_props;"..list..";"..sel..";false]".. - "field[0.2,8.75;8,1;value;"..F(S("Value"))..";"..F(value).."]".. - "button[8,8.5;1,1;submit;"..F(S("Submit")).."]" - ) -end - -minetest.register_tool("testtools:object_editor", { - description = S("Object Property Editor"), - inventory_image = "testtools_object_editor.png", - groups = { testtool = 1, disable_repair = 1 }, - on_use = function(itemstack, user, pointed_thing) - if user and user:is_player() then - local name = user:get_player_name() - - if pointed_thing.type == "object" then - selected_objects[name] = pointed_thing.ref - elseif pointed_thing.type == "nothing" then - -- Use on yourself if pointing nothing - selected_objects[name] = user - else - -- Unsupported pointed thing - return - end - - local sel = editor_formspec_selindex[name] - local val - if selected_objects[name] and selected_objects[name]:get_properties() then - local props = selected_objects[name]:get_properties() - local keys = property_formspec_data[name] - if property_formspec_index[name] and props then - local key = keys[property_formspec_index[name]] - val = prop_to_string(props[key]) - end - end - - editor_formspec(name, selected_objects[name], val, sel) - end - end, -}) - -local ent_parent = {} -local ent_child = {} -local DEFAULT_ATTACH_OFFSET_Y = 11 - -local attacher_config = function(itemstack, user, pointed_thing) - if not (user and user:is_player()) then - return - end - if pointed_thing.type == "object" then - return - end - local name = user:get_player_name() - local ctrl = user:get_player_control() - local meta = itemstack:get_meta() - if ctrl.aux1 then - local rot_x = meta:get_float("rot_x") - if ctrl.sneak then - rot_x = rot_x - math.pi/8 - else - rot_x = rot_x + math.pi/8 - end - if rot_x > 6.2 then - rot_x = 0 - elseif rot_x < 0 then - rot_x = math.pi * (15/8) - end - minetest.chat_send_player(name, S("rotation=@1", minetest.pos_to_string({x=rot_x,y=0,z=0}))) - meta:set_float("rot_x", rot_x) - else - local pos_y - if meta:contains("pos_y") then - pos_y = meta:get_int("pos_y") - else - pos_y = DEFAULT_ATTACH_OFFSET_Y - end - if ctrl.sneak then - pos_y = pos_y - 1 - else - pos_y = pos_y + 1 - end - minetest.chat_send_player(name, S("position=@1", minetest.pos_to_string({x=0,y=pos_y,z=0}))) - meta:set_int("pos_y", pos_y) - end - return itemstack -end - -minetest.register_tool("testtools:object_attacher", { - description = S("Object Attacher"), - inventory_image = "testtools_object_attacher.png", - groups = { testtool = 1, disable_repair = 1 }, - on_place = attacher_config, - on_secondary_use = attacher_config, - on_use = function(itemstack, user, pointed_thing) - if user and user:is_player() then - local name = user:get_player_name() - local selected_object - if pointed_thing.type == "object" then - selected_object = pointed_thing.ref - elseif pointed_thing.type == "nothing" then - selected_object = user - else - return - end - local ctrl = user:get_player_control() - if ctrl.sneak then - if selected_object:get_attach() then - selected_object:set_detach() - minetest.chat_send_player(name, S("Object detached!")) - else - minetest.chat_send_player(name, S("Object is not attached!")) - end - return - end - local parent = ent_parent[name] - local child = ent_child[name] - local ename = S("") - if not parent then - parent = selected_object - ent_parent[name] = parent - elseif not child then - child = selected_object - ent_child[name] = child - end - local entity = selected_object:get_luaentity() - if entity then - ename = entity.name - elseif selected_object:is_player() then - ename = selected_object:get_player_name() - end - if selected_object == parent then - minetest.chat_send_player(name, S("Parent object selected: @1", ename)) - elseif selected_object == child then - minetest.chat_send_player(name, S("Child object selected: @1", ename)) - end - if parent and child then - if parent == child then - minetest.chat_send_player(name, S("Can't attach an object to itself!")) - ent_parent[name] = nil - ent_child[name] = nil - return - end - local meta = itemstack:get_meta() - local y - if meta:contains("pos_y") then - y = meta:get_int("pos_y") - else - y = DEFAULT_ATTACH_OFFSET_Y - end - local rx = meta:get_float("rot_x") or 0 - local offset = {x=0,y=y,z=0} - local angle = {x=rx,y=0,z=0} - child:set_attach(parent, "", offset, angle) - local check_parent = child:get_attach() - if check_parent then - minetest.chat_send_player(name, S("Object attached! position=@1, rotation=@2", - minetest.pos_to_string(offset), minetest.pos_to_string(angle))) - else - minetest.chat_send_player(name, S("Attachment failed!")) - end - ent_parent[name] = nil - ent_child[name] = nil - end - end - end, -}) - --- Use loadstring to parse param as a Lua value -local function use_loadstring(param, player) - -- For security reasons, require 'server' priv, just in case - -- someone is actually crazy enough to run this on a public server. - local privs = minetest.get_player_privs(player:get_player_name()) - if not privs.server then - return false, "You need 'server' privilege to change object properties!" - end - if not param then - return false, "Failed: parameter is nil" - end - --[[ DANGER ZONE ]] - -- Interpret string as Lua value - local func, errormsg = loadstring("return (" .. param .. ")") - if not func then - return false, "Failed: " .. errormsg - end - - -- Apply sandbox here using setfenv - setfenv(func, {}) - - -- Run it - local good, errOrResult = pcall(func) - if not good then - -- A Lua error was thrown - return false, "Failed: " .. errOrResult - end - - -- errOrResult will be the value - return true, errOrResult -end - -minetest.register_on_player_receive_fields(function(player, formname, fields) - if not (player and player:is_player()) then - return - end - if formname == "testtools:entity_list" then - local name = player:get_player_name() - if fields.entity_list then - local expl = minetest.explode_textlist_event(fields.entity_list) - if expl.type == "DCL" then - local pos = vector.add(player:get_pos(), {x=0,y=1,z=0}) - selections[name] = expl.index - minetest.add_entity(pos, get_entity_list()[expl.index]) - return - elseif expl.type == "CHG" then - selections[name] = expl.index - return - end - elseif fields.spawn and selections[name] then - local pos = vector.add(player:get_pos(), {x=0,y=1,z=0}) - minetest.add_entity(pos, get_entity_list()[selections[name]]) - return - end - elseif formname == "testtools:object_editor" then - local name = player:get_player_name() - if fields.object_props then - local expl = minetest.explode_textlist_event(fields.object_props) - if expl.type == "DCL" or expl.type == "CHG" then - property_formspec_index[name] = expl.index - - local props = selected_objects[name]:get_properties() - local keys = property_formspec_data[name] - if (not property_formspec_index[name]) or (not props) then - return - end - local key = keys[property_formspec_index[name]] - editor_formspec_selindex[name] = expl.index - editor_formspec(name, selected_objects[name], prop_to_string(props[key]), expl.index) - return - end - end - if fields.submit then - local props = selected_objects[name]:get_properties() - local keys = property_formspec_data[name] - if (not property_formspec_index[name]) or (not props) then - return - end - local key = keys[property_formspec_index[name]] - if not key then - return - end - local success, str = use_loadstring(fields.value, player) - if success then - props[key] = str - else - minetest.chat_send_player(name, str) - return - end - selected_objects[name]:set_properties(props) - local sel = editor_formspec_selindex[name] - editor_formspec(name, selected_objects[name], prop_to_string(props[key]), sel) - return - end - end -end) diff --git a/games/minimal/mods/testtools/mod.conf b/games/minimal/mods/testtools/mod.conf deleted file mode 100644 index cde1b2685..000000000 --- a/games/minimal/mods/testtools/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = testtools -description = Some tools to directly manipulate nodes and entities. Great for development and testing diff --git a/games/minimal/mods/testtools/textures/testtools_entity_rotator.png b/games/minimal/mods/testtools/textures/testtools_entity_rotator.png deleted file mode 100644 index 17ebb2d35..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_entity_rotator.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_entity_scaler.png b/games/minimal/mods/testtools/textures/testtools_entity_scaler.png deleted file mode 100644 index 4909c25b0..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_entity_scaler.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_entity_spawner.png b/games/minimal/mods/testtools/textures/testtools_entity_spawner.png deleted file mode 100644 index 6199e0145..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_entity_spawner.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_falling_node_tool.png b/games/minimal/mods/testtools/textures/testtools_falling_node_tool.png deleted file mode 100644 index 30099a7ef..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_falling_node_tool.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_node_setter.png b/games/minimal/mods/testtools/textures/testtools_node_setter.png deleted file mode 100644 index 8599438de..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_node_setter.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_object_attacher.png b/games/minimal/mods/testtools/textures/testtools_object_attacher.png deleted file mode 100644 index 4d9bf6fd1..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_object_attacher.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_object_editor.png b/games/minimal/mods/testtools/textures/testtools_object_editor.png deleted file mode 100644 index d1ce9cecd..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_object_editor.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_object_mover.png b/games/minimal/mods/testtools/textures/testtools_object_mover.png deleted file mode 100644 index 8b14e9fb2..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_object_mover.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_param2tool.png b/games/minimal/mods/testtools/textures/testtools_param2tool.png deleted file mode 100644 index dbc663575..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_param2tool.png and /dev/null differ diff --git a/games/minimal/mods/testtools/textures/testtools_remover.png b/games/minimal/mods/testtools/textures/testtools_remover.png deleted file mode 100644 index 73f14cd54..000000000 Binary files a/games/minimal/mods/testtools/textures/testtools_remover.png and /dev/null differ diff --git a/games/minimal/mods/tiled/init.lua b/games/minimal/mods/tiled/init.lua deleted file mode 100644 index 68ead8e3a..000000000 --- a/games/minimal/mods/tiled/init.lua +++ /dev/null @@ -1,33 +0,0 @@ -minetest.register_node("tiled:tiled", { - description = "Tiled Node (world-aligned)", - tiles = {{ - name = "tiled_tiled.png", - align_style = "world", - scale = 8, - }}, - groups = {cracky=3}, -}) - -minetest.register_node("tiled:tiled_n", { - description = "Tiled Node (node-aligned)", - tiles = {{ - name = "tiled_tiled.png", - align_style = "node", - scale = 8, - }}, - groups = {cracky=3}, -}) - -stairs.register_stair_and_slab("tiled_n", "tiled:tiled", - {cracky=3}, - {{name="tiled_tiled.png", align_style="node", scale=8}}, - "Tiled Stair (node-aligned)", - "Tiled Slab (node-aligned)") - -stairs.register_stair_and_slab("tiled", "tiled:tiled", - {cracky=3}, - {{name="tiled_tiled.png", align_style="world", scale=8}}, - "Tiled Stair (world-aligned)", - "Tiled Slab (world-aligned)") - - diff --git a/games/minimal/mods/tiled/mod.conf b/games/minimal/mods/tiled/mod.conf deleted file mode 100644 index 78b19f93b..000000000 --- a/games/minimal/mods/tiled/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = tiled -description = Add nodes with a special texture that spans multiple nodes (aka "world-aligned") -depends = stairs diff --git a/games/minimal/mods/tiled/textures/tiled_tiled.png b/games/minimal/mods/tiled/textures/tiled_tiled.png deleted file mode 100644 index 363a26487..000000000 Binary files a/games/minimal/mods/tiled/textures/tiled_tiled.png and /dev/null differ diff --git a/games/minimal/mods/unittests/crafting.lua b/games/minimal/mods/unittests/crafting.lua deleted file mode 100644 index eff13ce09..000000000 --- a/games/minimal/mods/unittests/crafting.lua +++ /dev/null @@ -1,120 +0,0 @@ --- Test minetest.clear_craft function -local function test_clear_craft() - minetest.log("info", "[unittests] Testing minetest.clear_craft") - -- Clearing by output - minetest.register_craft({ - output = "foo", - recipe = {{"bar"}} - }) - minetest.register_craft({ - output = "foo 4", - recipe = {{"foo", "bar"}} - }) - assert(#minetest.get_all_craft_recipes("foo") == 2) - minetest.clear_craft({output="foo"}) - assert(minetest.get_all_craft_recipes("foo") == nil) - -- Clearing by input - minetest.register_craft({ - output = "foo 4", - recipe = {{"foo", "bar"}} - }) - assert(#minetest.get_all_craft_recipes("foo") == 1) - minetest.clear_craft({recipe={{"foo", "bar"}}}) - assert(minetest.get_all_craft_recipes("foo") == nil) -end - --- Test minetest.get_craft_result function -local function test_get_craft_result() - minetest.log("info", "[unittests] Testing minetest.get_craft_result") - - -- normal - local input = { - method = "normal", - width = 2, - items = {"", "unittests:coal_lump", "", "unittests:stick"} - } - minetest.log("info", "[unittests] torch crafting input: "..dump(input)) - local output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] torch crafting output: "..dump(output)) - minetest.log("info", "[unittests] torch crafting decremented input: "..dump(decremented_input)) - assert(output.item) - minetest.log("info", "[unittests] torch crafting output.item:to_table(): "..dump(output.item:to_table())) - assert(output.item:get_name() == "unittests:torch") - assert(output.item:get_count() == 4) - - -- fuel - input = { - method = "fuel", - width = 1, - items = {"unittests:coal_lump"} - } - minetest.log("info", "[unittests] coal fuel input: "..dump(input)) - output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] coal fuel output: "..dump(output)) - minetest.log("info", "[unittests] coal fuel decremented input: "..dump(decremented_input)) - assert(output.time) - assert(output.time > 0) - - -- cooking - input = { - method = "cooking", - width = 1, - items = {"unittests:iron_lump"} - } - minetest.log("info", "[unittests] iron lump cooking input: "..dump(output)) - output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] iron lump cooking output: "..dump(output)) - minetest.log("info", "[unittests] iron lump cooking decremented input: "..dump(decremented_input)) - assert(output.time) - assert(output.time > 0) - assert(output.item) - minetest.log("info", "[unittests] iron lump cooking output.item:to_table(): "..dump(output.item:to_table())) - assert(output.item:get_name() == "unittests:steel_ingot") - assert(output.item:get_count() == 1) - - -- tool repair (repairable) - input = { - method = "normal", - width = 2, - -- Using a wear of 60000 - items = {"unittests:repairable_tool 1 60000", "unittests:repairable_tool 1 60000"} - } - minetest.log("info", "[unittests] repairable tool crafting input: "..dump(input)) - output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] repairable tool crafting output: "..dump(output)) - minetest.log("info", "[unittests] repairable tool crafting decremented input: "..dump(decremented_input)) - assert(output.item) - minetest.log("info", "[unittests] repairable tool crafting output.item:to_table(): "..dump(output.item:to_table())) - assert(output.item:get_name() == "unittests:repairable_tool") - -- Test the wear value. - -- See src/craftdef.cpp in Minetest source code for the formula. The formula to calculate - -- the value 51187 is: - -- 65536 - ((65536-60000)+(65536-60000)) + floor(additonal_wear * 65536 + 0.5) = 51187 - -- where additional_wear = 0.05 - assert(output.item:get_wear() == 51187) - assert(output.item:get_count() == 1) - - -- failing tool repair (unrepairable) - input = { - method = "normal", - width = 2, - items = {"unittests:unrepairable_tool 1 60000", "unittests:unrepairable_tool 1 60000"} - } - minetest.log("info", "[unittests] unrepairable tool crafting input: "..dump(input)) - output, decremented_input = minetest.get_craft_result(input) - minetest.log("info", "[unittests] unrepairable tool crafting output: "..dump(output)) - minetest.log("info", "[unittests] unrepairable tool crafting decremented input: "..dump(decremented_input)) - assert(output.item) - minetest.log("info", "[unittests] unrepairable tool crafting output.item:to_table(): "..dump(output.item:to_table())) - -- unrepairable tool must not yield any output - assert(output.item:get_name() == "") - -end - -function unittests.test_crafting() - test_clear_craft() - test_get_craft_result() - minetest.log("action", "[unittests] Crafting tests passed!") - return true -end - diff --git a/games/minimal/mods/unittests/crafting_prepare.lua b/games/minimal/mods/unittests/crafting_prepare.lua deleted file mode 100644 index a09734827..000000000 --- a/games/minimal/mods/unittests/crafting_prepare.lua +++ /dev/null @@ -1,88 +0,0 @@ --- Registering some dummy items and recipes for the crafting tests - -minetest.register_craftitem("unittests:torch", { - description = "Crafting Test Item: Torch", - inventory_image = "unittests_torch.png", - - groups = { dummy = 1 }, -}) -minetest.register_craftitem("unittests:coal_lump", { - description = "Crafting Test Item: Coal Lump", - inventory_image = "unittests_coal_lump.png", - - groups = { dummy = 1 }, -}) -minetest.register_craftitem("unittests:stick", { - description = "Crafting Test Item: Stick", - inventory_image = "unittests_stick.png", - - groups = { dummy = 1 }, -}) -minetest.register_craftitem("unittests:iron_lump", { - description = "Crafting Test Item: Iron Lump", - inventory_image = "unittests_iron_lump.png", - - groups = { dummy = 1 }, -}) -minetest.register_craftitem("unittests:steel_ingot", { - description = "Crafting Test Item: Steel Ingot", - inventory_image = "unittests_steel_ingot.png", - - groups = { dummy = 1 }, -}) - --- Recipes for tests: Normal crafting, cooking and fuel - -minetest.register_craft({ - output = 'unittests:torch 4', - recipe = { - {'unittests:coal_lump'}, - {'unittests:stick'}, - } -}) - -minetest.register_craft({ - type = "cooking", - output = "unittests:steel_ingot", - recipe = "unittests:iron_lump", -}) - -minetest.register_craft({ - type = "fuel", - recipe = "unittests:coal_lump", - burntime = 40, -}) - --- Test tool repair -minetest.register_craft({ - type = "toolrepair", - additional_wear = -0.05, -}) - --- Test the disable_repair=1 group -minetest.register_tool("unittests:unrepairable_tool", { - description = "Crafting Test Item: Unrepairable Tool", - inventory_image = "unittests_unrepairable_tool.png", - tool_capabilities = { - groupcaps = { - cracky = { - times = {3, 2, 1}, - } - } - }, - groups = { disable_repair = 1, dummy = 1 } -}) - -minetest.register_tool("unittests:repairable_tool", { - description = "Crafting Test Item: Repairable Tool", - inventory_image = "unittests_repairable_tool.png", - tool_capabilities = { - groupcaps = { - cracky = { - times = {3, 2, 1}, - } - } - }, - - groups = { dummy = 1 }, -}) diff --git a/games/minimal/mods/unittests/init.lua b/games/minimal/mods/unittests/init.lua deleted file mode 100644 index 6c1728420..000000000 --- a/games/minimal/mods/unittests/init.lua +++ /dev/null @@ -1,16 +0,0 @@ -unittests = {} - -local modpath = minetest.get_modpath("unittests") -dofile(modpath .. "/random.lua") -dofile(modpath .. "/player.lua") -dofile(modpath .. "/crafting_prepare.lua") -dofile(modpath .. "/crafting.lua") - -if minetest.settings:get_bool("devtest_unittests_autostart", false) then - unittests.test_random() - unittests.test_crafting() - minetest.register_on_joinplayer(function(player) - unittests.test_player(player) - end) -end - diff --git a/games/minimal/mods/unittests/mod.conf b/games/minimal/mods/unittests/mod.conf deleted file mode 100644 index 0d5e3c959..000000000 --- a/games/minimal/mods/unittests/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = unittests -description = Adds automated unit tests for the engine diff --git a/games/minimal/mods/unittests/player.lua b/games/minimal/mods/unittests/player.lua deleted file mode 100644 index 10781a95f..000000000 --- a/games/minimal/mods/unittests/player.lua +++ /dev/null @@ -1,73 +0,0 @@ --- --- HP Change Reasons --- -local expect = nil -local function run_hpchangereason_tests(player) - expect = { type = "set_hp", from = "mod" } - player:set_hp(3) - assert(expect == nil) - - expect = { a = 234, type = "set_hp", from = "mod" } - player:set_hp(7, { a= 234 }) - assert(expect == nil) - - expect = { df = 3458973454, type = "fall", from = "mod" } - player:set_hp(10, { type = "fall", df = 3458973454 }) - assert(expect == nil) - - player:set_hp(20) -end - -local function run_player_meta_tests(player) - local meta = player:get_meta() - meta:set_string("foo", "bar") - assert(meta:contains("foo")) - assert(meta:get_string("foo") == "bar") - assert(meta:get("foo") == "bar") - - local meta2 = player:get_meta() - assert(meta2:get_string("foo") == "bar") - assert(meta2:get("foo") == "bar") - assert(meta:equals(meta2)) - - meta:set_string("bob", "dillan") - assert(meta:get_string("foo") == "bar") - assert(meta:get_string("bob") == "dillan") - assert(meta:get("bob") == "dillan") - assert(meta2:get_string("foo") == "bar") - assert(meta2:get_string("bob") == "dillan") - assert(meta2:get("bob") == "dillan") - assert(meta:equals(meta2)) - - meta:set_string("foo", "") - assert(not meta:contains("foo")) - assert(meta:get("foo") == nil) - assert(meta:get_string("foo") == "") - assert(meta:equals(meta2)) -end - -function unittests.test_player(player) - minetest.register_on_player_hpchange(function(player, hp, reason) - if not expect then - return - end - - for key, value in pairs(reason) do - assert(expect[key] == value) - end - - for key, value in pairs(expect) do - assert(reason[key] == value) - end - - expect = nil - end) - - run_hpchangereason_tests(player) - run_player_meta_tests(player) - local msg = "Player tests passed for player '"..player:get_player_name().."'!" - minetest.chat_send_all(msg) - minetest.log("action", "[unittests] "..msg) - return true -end - diff --git a/games/minimal/mods/unittests/random.lua b/games/minimal/mods/unittests/random.lua deleted file mode 100644 index f94f0a88e..000000000 --- a/games/minimal/mods/unittests/random.lua +++ /dev/null @@ -1,10 +0,0 @@ -function unittests.test_random() - -- Try out PseudoRandom - minetest.log("action", "[unittests] Testing PseudoRandom ...") - local pseudo = PseudoRandom(13) - assert(pseudo:next() == 22290) - assert(pseudo:next() == 13854) - minetest.log("action", "[unittests] PseudoRandom test passed!") - return true -end - diff --git a/games/minimal/mods/unittests/textures/unittests_coal_lump.png b/games/minimal/mods/unittests/textures/unittests_coal_lump.png deleted file mode 100644 index f460d909e..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_coal_lump.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_iron_lump.png b/games/minimal/mods/unittests/textures/unittests_iron_lump.png deleted file mode 100644 index 22f43e9cc..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_iron_lump.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_repairable_tool.png b/games/minimal/mods/unittests/textures/unittests_repairable_tool.png deleted file mode 100644 index 46fbbaa74..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_repairable_tool.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_steel_ingot.png b/games/minimal/mods/unittests/textures/unittests_steel_ingot.png deleted file mode 100644 index 6977696a2..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_steel_ingot.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_stick.png b/games/minimal/mods/unittests/textures/unittests_stick.png deleted file mode 100644 index ffdce70d4..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_stick.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_torch.png b/games/minimal/mods/unittests/textures/unittests_torch.png deleted file mode 100644 index ba5eebef0..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_torch.png and /dev/null differ diff --git a/games/minimal/mods/unittests/textures/unittests_unrepairable_tool.png b/games/minimal/mods/unittests/textures/unittests_unrepairable_tool.png deleted file mode 100644 index c676213a5..000000000 Binary files a/games/minimal/mods/unittests/textures/unittests_unrepairable_tool.png and /dev/null differ diff --git a/games/minimal/mods/util_commands/init.lua b/games/minimal/mods/util_commands/init.lua deleted file mode 100644 index ad8d3f9ba..000000000 --- a/games/minimal/mods/util_commands/init.lua +++ /dev/null @@ -1,137 +0,0 @@ -minetest.register_chatcommand("hotbar", { - params = "", - description = "Set hotbar size", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local size = tonumber(param) - if not size then - return false, "Missing or incorrect size parameter!" - end - local ok = player:hud_set_hotbar_itemcount(size) - if ok then - return true - else - return false, "Invalid item count!" - end - end, -}) - -minetest.register_chatcommand("hp", { - params = "", - description = "Set your health", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local hp = tonumber(param) - if not hp then - return false, "Missing or incorrect hp parameter!" - end - player:set_hp(hp) - return true - end, -}) - -minetest.register_chatcommand("zoom", { - params = "[]", - description = "Set or display your zoom_fov", - func = function(name, param) - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - if param == "" then - local fov = player:get_properties().zoom_fov - return true, "zoom_fov = "..tostring(fov) - end - local fov = tonumber(param) - if not fov then - return false, "Missing or incorrect zoom_fov parameter!" - end - player:set_properties({zoom_fov = fov}) - fov = player:get_properties().zoom_fov - return true, "zoom_fov = "..tostring(fov) - end, -}) - - - -local s_infplace = minetest.settings:get("devtest_infplace") -if s_infplace == "true" then - infplace = true -elseif s_infplace == "false" then - infplace = false -else - infplace = minetest.settings:get_bool("creative_mode", false) -end - -minetest.register_chatcommand("infplace", { - params = "", - description = "Toggle infinite node placement", - func = function(name, param) - infplace = not infplace - if infplace then - minetest.chat_send_all("Infinite node placement enabled!") - minetest.log("action", "Infinite node placement enabled") - else - minetest.chat_send_all("Infinite node placement disabled!") - minetest.log("action", "Infinite node placement disabled") - end - return true - end, -}) - -minetest.register_chatcommand("detach", { - params = "[]", - description = "Detach all objects nearby", - func = function(name, param) - local radius = tonumber(param) - if type(radius) ~= "number" then - radius = 8 - end - if radius < 1 then - radius = 1 - end - local player = minetest.get_player_by_name(name) - if not player then - return false, "No player." - end - local objs = minetest.get_objects_inside_radius(player:get_pos(), radius) - local num = 0 - for o=1, #objs do - if objs[o]:get_attach() then - objs[o]:set_detach() - num = num + 1 - end - end - return true, string.format("%d object(s) detached.", num) - end, -}) - - --- Unlimited node placement -minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) - if placer and placer:is_player() then - return infplace - end -end) - --- Don't pick up if the item is already in the inventory -local old_handle_node_drops = minetest.handle_node_drops -function minetest.handle_node_drops(pos, drops, digger) - if not digger or not digger:is_player() or not infplace then - return old_handle_node_drops(pos, drops, digger) - end - local inv = digger:get_inventory() - if inv then - for _, item in ipairs(drops) do - if not inv:contains_item("main", item, true) then - inv:add_item("main", item) - end - end - end -end diff --git a/games/minimal/mods/util_commands/mod.conf b/games/minimal/mods/util_commands/mod.conf deleted file mode 100644 index fea6dd3e9..000000000 --- a/games/minimal/mods/util_commands/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = util_commands -description = Random server commands to make testing easier and more convenient diff --git a/games/minimal/screenshot.png b/games/minimal/screenshot.png deleted file mode 100644 index 7324883f6..000000000 Binary files a/games/minimal/screenshot.png and /dev/null differ diff --git a/games/minimal/settingtypes.txt b/games/minimal/settingtypes.txt deleted file mode 100644 index 40ee5845b..000000000 --- a/games/minimal/settingtypes.txt +++ /dev/null @@ -1,37 +0,0 @@ -# If enabled, nodes won't be used up when placed. -# Note: This behavior can also be toggled in-game with the /infplace command. -# -# - true: enabled -# - false: disabled -# - auto: only enabled when Creative Mode is enabled (default) -devtest_infplace (Infinite node placement) enum auto true,false,auto - -# If enabled, new players receive some initial items when joining for the first time. -give_initial_stuff (Give initial stuff) bool true - -# If enabled, automated tests of the Lua API such as player health, crafting and PseudoRandom will be performed on startup. -devtest_unittests_autostart (Perform unit tests) bool false - -# If enabled, the game will use all mapgen aliases for the v6 mapgen. -# If disabled, it will only use a minimal set of mapgen aliases. -# If enabled, there should be biome-specific tree, leaves and ground nodes. If disabled, stuff should use fallback nodes (like stone instead of desert stone). -# -# Many mapgen aliases have fallback values when no value is provided. Having this setting disabled can be useful to test whether those fallback values are functional. -devtest_v6_mapgen_aliases (Use all v6 mapgen aliases) bool false - -# If enabled, the game will use dungeon stairs by enabling the corresponding mapgen aliases. -# -# Disabling this setting can be useful to test whether dungeons still work when stairs are not defined. -devtest_dungeon_stairs (Generate dungeon stairs) bool false - -# If enabled, the mapgen alias 'mapgen_mossycobble' will be used. This should enable random mossy cobblestone in dungeons. -# If disabled, it won't be used. The engine should fall back to cobble instead. -devtest_dungeon_mossycobble (Generate mossy cobblestone) bool false - -# If enabled, some very basic biomes will be registered. -devtest_register_biomes (Register biomes) bool true - -# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0. -# This is due to . -# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off. -testnodes_show_fallback_image (Use fallback inventory images) bool false diff --git a/src/unittest/CMakeLists.txt b/src/unittest/CMakeLists.txt index 82f9a4a13..5703b8906 100644 --- a/src/unittest/CMakeLists.txt +++ b/src/unittest/CMakeLists.txt @@ -43,7 +43,7 @@ set (UNITTEST_CLIENT_SRCS PARENT_SCOPE) set (TEST_WORLDDIR ${CMAKE_CURRENT_SOURCE_DIR}/test_world) -set (TEST_SUBGAME_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../games/minimal) +set (TEST_SUBGAME_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../games/devtest) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/test_config.h.in" diff --git a/src/unittest/test_servermodmanager.cpp b/src/unittest/test_servermodmanager.cpp index 0757323f4..799936757 100644 --- a/src/unittest/test_servermodmanager.cpp +++ b/src/unittest/test_servermodmanager.cpp @@ -88,7 +88,7 @@ void TestServerModManager::testCreation() { std::string path = std::string(TEST_WORLDDIR) + DIR_DELIM + "world.mt"; Settings world_config; - world_config.set("gameid", "minimal"); + world_config.set("gameid", "devtest"); UASSERTEQ(bool, world_config.updateConfigFile(path.c_str()), true); ServerModManager sm(TEST_WORLDDIR); } @@ -118,10 +118,10 @@ void TestServerModManager::testGetMods() const auto &mods = sm.getMods(); UASSERTEQ(bool, mods.empty(), false); - // Ensure we found default mod inside the test folder + // Ensure we found basenodes mod (part of devtest) bool default_found = false; for (const auto &m : mods) { - if (m.name == "default") + if (m.name == "basenodes") default_found = true; // Verify if paths are not empty @@ -135,7 +135,7 @@ void TestServerModManager::testGetModspec() { ServerModManager sm(std::string(TEST_WORLDDIR)); UASSERTEQ(const ModSpec *, sm.getModSpec("wrongmod"), NULL); - UASSERT(sm.getModSpec("default") != NULL); + UASSERT(sm.getModSpec("basenodes") != NULL); } void TestServerModManager::testGetModNamesWrongDir() @@ -152,7 +152,7 @@ void TestServerModManager::testGetModNames() std::vector result; sm.getModNames(result); UASSERTEQ(bool, result.empty(), false); - UASSERT(std::find(result.begin(), result.end(), "default") != result.end()); + UASSERT(std::find(result.begin(), result.end(), "basenodes") != result.end()); } void TestServerModManager::testGetModMediaPathsWrongDir() diff --git a/util/test_multiplayer.sh b/util/test_multiplayer.sh index 9ebfe73be..176cf11d9 100755 --- a/util/test_multiplayer.sh +++ b/util/test_multiplayer.sh @@ -1,6 +1,6 @@ #!/bin/bash dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -gameid=minimal +gameid=devtest minetest=$dir/../bin/minetest testspath=$dir/../tests worldpath=$testspath/testworld_$gameid -- cgit v1.2.3 From 3014e8b33b3d14165cc207be13631f4ee9a8fd2e Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 25 Jun 2020 15:36:51 +0100 Subject: Release test build to Android beta program --- .gitignore | 2 ++ build/android/build.gradle | 2 +- util/bump_version.sh | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/.gitignore b/.gitignore index 33d764f76..52f8bc4f4 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,5 @@ cmake_config.h cmake_config_githash.h CMakeDoxy* compile_commands.json +*.apk +*.zip diff --git a/build/android/build.gradle b/build/android/build.gradle index c4de09bf8..6e67030ba 100644 --- a/build/android/build.gradle +++ b/build/android/build.gradle @@ -4,7 +4,7 @@ project.ext.set("versionMajor", 5) // Version Major project.ext.set("versionMinor", 3) // Version Minor project.ext.set("versionPatch", 0) // Version Patch project.ext.set("versionExtra", "-dev") // Version Extra -project.ext.set("versionCode", 26) // Android Version Code +project.ext.set("versionCode", 28) // Android Version Code // NOTE: +2 after each release! // +1 for ARM and +1 for ARM64 APK's, because // each APK must have a larger `versionCode` than the previous diff --git a/util/bump_version.sh b/util/bump_version.sh index ad1c9e1cd..58509198a 100755 --- a/util/bump_version.sh +++ b/util/bump_version.sh @@ -90,7 +90,8 @@ RELEASE_VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH" echo "Current Minetest version: $RELEASE_VERSION" echo "Current Android version code: $ANDROID_VERSION_CODE" -NEW_ANDROID_VERSION_CODE=$(expr $ANDROID_VERSION_CODE + 1) +# +1 for ARM and +1 for ARM64 APKs +NEW_ANDROID_VERSION_CODE=$(expr $ANDROID_VERSION_CODE + 2) NEW_ANDROID_VERSION_CODE=$(prompt_for_number "Set android version code" $NEW_ANDROID_VERSION_CODE) echo -- cgit v1.2.3 From b4c25872f181ccd87199aeed0a26e68d03d3089b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 8 Jul 2020 23:09:39 +0200 Subject: Make util/bump_version.sh work again --- util/bump_version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/bump_version.sh b/util/bump_version.sh index 58509198a..996962199 100755 --- a/util/bump_version.sh +++ b/util/bump_version.sh @@ -23,7 +23,7 @@ prompt_for_number() { perform_release() { sed -i -re "s/^set\(DEVELOPMENT_BUILD TRUE\)$/set(DEVELOPMENT_BUILD FALSE)/" CMakeLists.txt - sed -i -re "s/versionCode [0-9]+$/versionCode $NEW_ANDROID_VERSION_CODE/" build/android/build.gradle + sed -i -re "s/\"versionCode\", [0-9]+/\"versionCode\", $NEW_ANDROID_VERSION_CODE/" build/android/build.gradle sed -i '/\