Compare commits
29 Commits
c4ffe630f1
...
69894019b1
Author | SHA1 | Date |
---|---|---|
Milan | 69894019b1 | |
fluxionary | 0ab9bf926d | |
rubenwardy | 2d10fa7867 | |
x2048 | 8c29c4f620 | |
celeron55 | 3f67215df9 | |
Milan | ad6043b3c5 | |
Milan | f75dde52de | |
Milan | 94f6bd6218 | |
Milan | 8b78c96deb | |
Milan* | 7112d840b4 | |
Milan* | 6ff44891a5 | |
Milan* | 9e309a6e30 | |
Milan* | cfc5a607d9 | |
Milan* | f70ddf9998 | |
Milan* | 36fb334ab6 | |
Milan* | 3193b8f10d | |
tchncs | 7c8cf4d5fe | |
Milan* | 731d774598 | |
Milan* | 9d50f1e0b7 | |
Milan* | 0ae4ca4fa1 | |
Milan* | 160c600b49 | |
Milan* | aa84ae9c8b | |
Milan* | abf314dc85 | |
Milan* | 255ad57c7e | |
Milan* | f7280e4644 | |
Milan* | 79418b4464 | |
Milan* | 73f66021a8 | |
Milan* | 0883ffacde | |
Milan* | 664f77fed7 |
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -57,8 +57,8 @@ public:
|
|||
return configuration.isConsistent();
|
||||
}
|
||||
|
||||
inline void printUnsatisfiedModsError() const {
|
||||
return configuration.printUnsatisfiedModsError();
|
||||
inline std::string getUnsatisfiedModsError() const {
|
||||
return configuration.getUnsatisfiedModsError();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue