Compare commits

...

29 Commits

Author SHA1 Message Date
Milan 69894019b1 merge upstream 2022-08-25 18:21:02 +02:00
fluxionary 0ab9bf926d
Fix texture_min_size 2022-08-24 22:38:14 +02:00
rubenwardy 2d10fa7867
Prevent loading a world with unresolved dependencies (#12542) 2022-08-19 12:31:36 +01:00
x2048 8c29c4f620
Use Sky class to obtain directional light source position for shadows (#12662)
* Also remove unused Sky::getSkyBodyOrbitTilt method

Fixes misalignment of sun position and shadow direction at high tilt values.
2022-08-17 16:30:05 +02:00
celeron55 3f67215df9
Log sockets into tracestream instead of dstream (#12701) 2022-08-16 15:18:11 +01:00
Milan ad6043b3c5 merge upstream 2020-09-24 22:39:19 +02:00
Milan f75dde52de include forgotten changes 2019-03-08 15:08:25 +01:00
Milan 94f6bd6218 merge upstream 2019-03-06 17:22:40 +01:00
Milan 8b78c96deb add random join/leave messages 2018-01-01 20:24:20 +01:00
Milan* 7112d840b4 resolve mergeconflict 2017-09-11 23:19:38 +02:00
Milan* 6ff44891a5 Merge https://github.com/minetest/minetest 2017-07-30 12:28:42 +02:00
Milan* 9e309a6e30 Merge https://github.com/minetest/minetest 2017-07-25 12:46:24 +02:00
Milan* cfc5a607d9 Merge https://github.com/minetest/minetest 2017-07-11 09:22:23 +02:00
Milan* f70ddf9998 fix mergeconflicts 2017-05-22 12:47:29 +02:00
Milan* 36fb334ab6 fix mergeconflict 2017-03-11 10:25:04 +01:00
Milan* 3193b8f10d Merge https://github.com/minetest/minetest 2017-02-14 16:40:10 +01:00
tchncs 7c8cf4d5fe fix mergeconflicts 2017-01-21 10:54:15 +01:00
Milan* 731d774598 zoom: fix typo from previous commit 2017-01-09 08:31:00 +01:00
Milan* 9d50f1e0b7 zoom: remove check for privilege 2017-01-08 23:00:16 +01:00
Milan* 0ae4ca4fa1 chatcommands: adjust / enhance color(s) of /help command(s) 2017-01-03 16:11:36 +01:00
Milan* 160c600b49 chatcommands: add most missing colors 2017-01-03 14:17:28 +01:00
Milan* aa84ae9c8b chatcommands: update admin color 2017-01-03 14:01:56 +01:00
Milan* abf314dc85 wip: recolor + individualize chatcommands, error messages done so far 2017-01-03 12:32:02 +01:00
Milan* 255ad57c7e no colorize for regular messages for now :/ 2017-01-01 01:11:36 +01:00
Milan* f7280e4644 wip: colorize chat 2017-01-01 00:43:59 +01:00
Milan* 79418b4464 experimental/testing: update cursorcolor 2016-12-24 19:55:20 +01:00
Milan* 73f66021a8 merge upstream 🐈 2016-12-24 18:31:53 +01:00
Milan* 0883ffacde experimental/testing: update chatcolor 2016-12-24 18:30:35 +01:00
Milan* 664f77fed7 update readme 2016-12-24 18:21:49 +01:00
14 changed files with 89 additions and 60 deletions

View File

@ -1,3 +1,5 @@
# Slightly modified version of:
Minetest
========

View File

@ -91,11 +91,11 @@ core.register_on_chat_message(function(name, message)
if delay > msg_time_threshold then
-- Show how much time it took to execute the command
if result then
result = result .. core.colorize("#f3d2ff", S(" (@1 s)",
result = result .. core.colorize("#f3d2ff", S(" (@1 s)",
string.format("%.5f", delay)))
else
result = core.colorize("#f3d2ff", S(
"Command execution took @1 s",
"Command execution took @1 s",
string.format("%.5f", delay)))
end
end

View File

@ -52,22 +52,27 @@ function core.check_player_privs(name, ...)
end
local player_list = {}
greet = {"Hey, ", "Woohoo! ", "Yay! ", "Hooray! ", "Oh, ", "Wait what!? ", "Aaaand here is: ", "This was about time! ", "Oh my god! "}
hint = {"Hide your bananas!", "This is awesome!", "They deserve a cookie!", "Give them a warm welcome!", "Incredible awesome surprise!", "Finally!", "The wait is over!", "Party!"}
bye = {"Oh no, ", "Hmm...", "Aw snap, ", "Buh! ", "Awww, ", "Huh?! ", "But...", "Nooo! ", "They will be missed. "}
timeout = {" Ran out of memory?", " Client died by servers awesomeness?", " Lid closed!", " Did not find the 'exit' button.", " Internet was deleted!", " Maybe wants a hardware upgrade.", " Hit the lid!"}
function core.send_join_message(player_name)
if not core.is_singleplayer() then
core.chat_send_all("*** " .. S("@1 joined the game.", player_name))
core.chat_send_all(core.colorize("#4ec44e", "") .. S(core.colorize("#c44eb5", greet[math.random(1,#greet)]..core.colorize("#a74ec4", "@1")..core.colorize("#c44eb5", " joined the game! "..hint[math.random(1,#hint)]))), player_name)
end
end
function core.send_leave_message(player_name, timed_out)
local announcement = "*** " .. S("@1 left the game.", player_name)
if timed_out then
announcement = "*** " .. S("@1 left the game (timed out).", player_name)
local announcement = core.colorize("#c44e4e", "").. S(core.colorize("#c44eb5", bye[math.random(1,#bye)]..core.colorize("#a74ec4", "@1")..core.colorize("#c44eb5", " left the game.")), player_name)
if timed_out then
announcement = announcement..core.colorize("#c44eb5"," Timed out."..timeout[math.random(1,#timeout)])
end
core.chat_send_all(announcement)
end
core.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
if not core.is_singleplayer() then

View File

@ -213,9 +213,10 @@ void Client::loadMods()
}
m_mods = modconf.getMods();
// complain about mods with unsatisfied dependencies
if (!modconf.isConsistent()) {
modconf.printUnsatisfiedModsError();
errorstream << modconf.getUnsatisfiedModsError() << std::endl;
return;
}

View File

@ -4065,10 +4065,7 @@ void Game::updateShadows()
timeoftheday = fmod(timeoftheday + 0.75f, 0.5f) + 0.25f;
const float offset_constant = 10000.0f;
v3f light(0.0f, 0.0f, -1.0f);
light.rotateXZBy(90);
light.rotateXYBy(timeoftheday * 360 - 90);
light.rotateYZBy(sky->getSkyBodyOrbitTilt());
v3f light = is_day ? sky->getSunDirection() : sky->getMoonDirection();
v3f sun_pos = light * offset_constant;

View File

@ -554,6 +554,25 @@ void Sky::update(float time_of_day, float time_brightness,
}
}
static v3f getSkyBodyPosition(float horizon_position, float day_position, float orbit_tilt)
{
v3f result = v3f(0, 0, -1);
result.rotateXZBy(horizon_position);
result.rotateXYBy(day_position);
result.rotateYZBy(orbit_tilt);
return result;
}
v3f Sky::getSunDirection()
{
return getSkyBodyPosition(90, getWickedTimeOfDay(m_time_of_day) * 360 - 90, m_sky_body_orbit_tilt);
}
v3f Sky::getMoonDirection()
{
return getSkyBodyPosition(270, getWickedTimeOfDay(m_time_of_day) * 360 - 90, m_sky_body_orbit_tilt);
}
void Sky::draw_sun(video::IVideoDriver *driver, float sunsize, const video::SColor &suncolor,
const video::SColor &suncolor2, float wicked_time_of_day)
/* Draw sun in the sky.
@ -703,15 +722,13 @@ void Sky::place_sky_body(
* day_position: turn the body around the Z axis, to place it depending of the time of the day
*/
{
v3f centrum(0, 0, -1);
centrum.rotateXZBy(horizon_position);
centrum.rotateXYBy(day_position);
centrum.rotateYZBy(m_sky_body_orbit_tilt);
v3f centrum = getSkyBodyPosition(horizon_position, day_position, m_sky_body_orbit_tilt);
v3f untilted_centrum = getSkyBodyPosition(horizon_position, day_position, 0.f);
for (video::S3DVertex &vertex : vertices) {
// Body is directed to -Z (south) by default
vertex.Pos.rotateXZBy(horizon_position);
vertex.Pos.rotateXYBy(day_position);
vertex.Pos.Z += centrum.Z;
vertex.Pos += centrum - untilted_centrum;
}
}

View File

@ -71,12 +71,14 @@ public:
void setSunScale(f32 sun_scale) { m_sun_params.scale = sun_scale; }
void setSunriseVisible(bool glow_visible) { m_sun_params.sunrise_visible = glow_visible; }
void setSunriseTexture(const std::string &sunglow_texture, ITextureSource* tsrc);
v3f getSunDirection();
void setMoonVisible(bool moon_visible) { m_moon_params.visible = moon_visible; }
bool getMoonVisible() const { return m_moon_params.visible; }
void setMoonTexture(const std::string &moon_texture,
const std::string &moon_tonemap, ITextureSource *tsrc);
void setMoonScale(f32 moon_scale) { m_moon_params.scale = moon_scale; }
v3f getMoonDirection();
void setStarsVisible(bool stars_visible) { m_star_params.visible = stars_visible; }
void setStarCount(u16 star_count);
@ -108,8 +110,6 @@ public:
ITextureSource *tsrc);
const video::SColorf &getCurrentStarColor() const { return m_star_color; }
float getSkyBodyOrbitTilt() const { return m_sky_body_orbit_tilt; }
private:
aabb3f m_box;
video::SMaterial m_materials[SKY_MATERIAL_COUNT];

View File

@ -21,16 +21,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "settings.h"
#include "filesys.h"
#include "gettext.h"
void ModConfiguration::printUnsatisfiedModsError() const
std::string ModConfiguration::getUnsatisfiedModsError() const
{
std::ostringstream error;
error << gettext("Some mods have unsatisfied dependencies:") << std::endl;
for (const ModSpec &mod : m_unsatisfied_mods) {
errorstream << "mod \"" << mod.name
<< "\" has unsatisfied dependencies: ";
//~ Error when a mod is missing dependencies. Ex: "Mod Title is missing: mod1, mod2, mod3"
error << " - " << fmtgettext("%s is missing:", mod.name.c_str());
for (const std::string &unsatisfied_depend : mod.unsatisfied_depends)
errorstream << " \"" << unsatisfied_depend << "\"";
errorstream << std::endl;
error << " " << unsatisfied_depend;
error << "\n";
}
error << "\n"
<< gettext("Install and enable the required mods, or disable the mods causing errors.") << "\n"
<< gettext("Note: this may be caused by a dependency cycle, in which case try updating the mods.");
return error.str();
}
void ModConfiguration::addModsInPath(const std::string &path, const std::string &virtual_path)

View File

@ -51,7 +51,7 @@ public:
*/
const std::vector<ModSpec> &getMods() const { return m_sorted_mods; }
void printUnsatisfiedModsError() const;
std::string getUnsatisfiedModsError() const;
/**
* Adds all mods in the given path. used for games, modpacks

View File

@ -392,7 +392,7 @@ void GUIChatConsole::drawPrompt()
x + m_fontsize.X * MYMAX(cursor_len, 1),
y + m_fontsize.Y * (cursor_len ? m_cursor_height+1 : 1)
);
video::SColor cursor_color(255,255,255,255);
video::SColor cursor_color(90,195,227,225);
driver->draw2DRectangle(
cursor_color,
destrect,

View File

@ -91,7 +91,7 @@ UDPSocket::UDPSocket(bool ipv6)
bool UDPSocket::init(bool ipv6, bool noExceptions)
{
if (!g_sockets_initialized) {
dstream << "Sockets not initialized" << std::endl;
tracestream << "Sockets not initialized" << std::endl;
return false;
}
@ -100,7 +100,7 @@ bool UDPSocket::init(bool ipv6, bool noExceptions)
m_handle = socket(m_addr_family, SOCK_DGRAM, IPPROTO_UDP);
if (socket_enable_debug_output) {
dstream << "UDPSocket(" << (int)m_handle
tracestream << "UDPSocket(" << (int)m_handle
<< ")::UDPSocket(): ipv6 = " << (ipv6 ? "true" : "false")
<< std::endl;
}
@ -131,7 +131,7 @@ bool UDPSocket::init(bool ipv6, bool noExceptions)
UDPSocket::~UDPSocket()
{
if (socket_enable_debug_output) {
dstream << "UDPSocket( " << (int)m_handle << ")::~UDPSocket()"
tracestream << "UDPSocket( " << (int)m_handle << ")::~UDPSocket()"
<< std::endl;
}
@ -145,7 +145,7 @@ UDPSocket::~UDPSocket()
void UDPSocket::Bind(Address addr)
{
if (socket_enable_debug_output) {
dstream << "UDPSocket(" << (int)m_handle
tracestream << "UDPSocket(" << (int)m_handle
<< ")::Bind(): " << addr.serializeString() << ":"
<< addr.getPort() << std::endl;
}
@ -182,7 +182,7 @@ void UDPSocket::Bind(Address addr)
}
if (ret < 0) {
dstream << (int)m_handle << ": Bind failed: "
tracestream << (int)m_handle << ": Bind failed: "
<< SOCKET_ERR_STR(LAST_SOCKET_ERR()) << std::endl;
throw SocketException("Failed to bind socket");
}
@ -197,31 +197,31 @@ void UDPSocket::Send(const Address &destination, const void *data, int size)
if (socket_enable_debug_output) {
// Print packet destination and size
dstream << (int)m_handle << " -> ";
destination.print(dstream);
dstream << ", size=" << size;
tracestream << (int)m_handle << " -> ";
destination.print(tracestream);
tracestream << ", size=" << size;
// Print packet contents
dstream << ", data=";
tracestream << ", data=";
for (int i = 0; i < size && i < 20; i++) {
if (i % 2 == 0)
dstream << " ";
tracestream << " ";
unsigned int a = ((const unsigned char *)data)[i];
dstream << std::hex << std::setw(2) << std::setfill('0') << a;
tracestream << std::hex << std::setw(2) << std::setfill('0') << a;
}
if (size > 20)
dstream << "...";
tracestream << "...";
if (dumping_packet)
dstream << " (DUMPED BY INTERNET_SIMULATOR)";
tracestream << " (DUMPED BY INTERNET_SIMULATOR)";
dstream << std::endl;
tracestream << std::endl;
}
if (dumping_packet) {
// Lol let's forget it
dstream << "UDPSocket::Send(): INTERNET_SIMULATOR: dumping packet."
tracestream << "UDPSocket::Send(): INTERNET_SIMULATOR: dumping packet."
<< std::endl;
return;
}
@ -294,22 +294,22 @@ int UDPSocket::Receive(Address &sender, void *data, int size)
if (socket_enable_debug_output) {
// Print packet sender and size
dstream << (int)m_handle << " <- ";
sender.print(dstream);
dstream << ", size=" << received;
tracestream << (int)m_handle << " <- ";
sender.print(tracestream);
tracestream << ", size=" << received;
// Print packet contents
dstream << ", data=";
tracestream << ", data=";
for (int i = 0; i < received && i < 20; i++) {
if (i % 2 == 0)
dstream << " ";
tracestream << " ";
unsigned int a = ((const unsigned char *)data)[i];
dstream << std::hex << std::setw(2) << std::setfill('0') << a;
tracestream << std::hex << std::setw(2) << std::setfill('0') << a;
}
if (received > 20)
dstream << "...";
tracestream << "...";
dstream << std::endl;
tracestream << std::endl;
}
return received;
@ -358,7 +358,7 @@ bool UDPSocket::WaitData(int timeout_ms)
}
if (result < 0) {
dstream << (int)m_handle << ": Select failed: " << SOCKET_ERR_STR(e)
tracestream << (int)m_handle << ": Select failed: " << SOCKET_ERR_STR(e)
<< std::endl;
throw SocketException("Select failed");

View File

@ -279,7 +279,7 @@ void TextureSettings::readSettings()
bool smooth_lighting = g_settings->getBool("smooth_lighting");
enable_mesh_cache = g_settings->getBool("enable_mesh_cache");
enable_minimap = g_settings->getBool("enable_minimap");
node_texture_size = std::min<u16>(g_settings->getU16("texture_min_size"), 1);
node_texture_size = std::max<u16>(g_settings->getU16("texture_min_size"), 1);
std::string leaves_style_str = g_settings->get("leaves_style");
std::string world_aligned_mode_str = g_settings->get("world_aligned_mode");
std::string autoscale_mode_str = g_settings->get("autoscale_mode");

View File

@ -425,14 +425,10 @@ void Server::init()
m_modmgr = std::make_unique<ServerModManager>(m_path_world);
std::vector<ModSpec> unsatisfied_mods = m_modmgr->getUnsatisfiedMods();
// complain about mods with unsatisfied dependencies
if (!m_modmgr->isConsistent()) {
m_modmgr->printUnsatisfiedModsError();
warningstream
<< "You have unsatisfied dependencies, loading your world anyway. "
<< "This will become a fatal error in the future." << std::endl;
std::string error = m_modmgr->getUnsatisfiedModsError();
throw ServerError(error);
}
//lock environment

View File

@ -57,8 +57,8 @@ public:
return configuration.isConsistent();
}
inline void printUnsatisfiedModsError() const {
return configuration.printUnsatisfiedModsError();
inline std::string getUnsatisfiedModsError() const {
return configuration.getUnsatisfiedModsError();
}
/**