Merge October 5th Dragonfire changes

master
cron 2020-10-07 22:15:33 +00:00
commit 2530004afb
44 changed files with 295 additions and 174 deletions

View File

@ -21,6 +21,7 @@ core.cheats = {
["BrightNight"] = "no_night",
["Coords"] = "coords",
["Tracers"] = "enable_tracers",
["ESP"] = "enable_esp",
},
["World"] = {
["FastDig"] = "fastdig",

View File

@ -16,8 +16,9 @@
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------------
local hackers = {
"Elias Fleckenstein <eliasfleckenstein@web.de>"
local dragonfire_team = {
"Elias Fleckenstein <eliasfleckenstein@web.de> [Main Developer]",
"DerZombiiie [Bots, User Support]",
}
local core_developers = {
@ -109,8 +110,8 @@ return {
"tablecolumns[color;text]" ..
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
"table[3.5,-0.25;8.5,6.05;list_credits;" ..
"#FFFF00," .. fgettext("Hackers") .. ",," ..
buildCreditList(hackers) .. ",,," ..
"#FFFF00," .. fgettext("Dragonfire Team") .. ",," ..
buildCreditList(dragonfire_team) .. ",,," ..
"#FFFF00," .. fgettext("Core Developers") .. ",," ..
buildCreditList(core_developers) .. ",,," ..
"#FFFF00," .. fgettext("Active Contributors") .. ",," ..

View File

@ -2271,6 +2271,8 @@ no_force_rotate (NoForceRotate) bool false
enable_tracers (Tracers) bool false
enable_esp (ESP) bool false
no_slow (NoSlow) bool false
trace_players_only (Only trace to players) bool true

View File

@ -0,0 +1,13 @@
local was_enabled = false
minetest.register_globalstep(function()
if minetest.settings:get_bool("autosneak") then
minetest.set_keypress("sneak", true)
was_enabled = true
elseif was_enabled then
was_enabled = false
minetest.set_keypress("sneak", false)
end
end)
minetest.register_cheat("AutoSneak", "Movement", "autosneak")

View File

@ -0,0 +1,3 @@
name = autosneak
desciption = Adds the AutoSneak feature to dragonfire.
author = Fleckenstein

View File

@ -0,0 +1 @@
autosneak (AutoSneak) bool false

View File

@ -8,3 +8,5 @@ minetest.register_globalstep(function(dtime)
local player = minetest.localplayer
minetest.send_chat_message(minetest.pos_to_string(vector.floor(player:get_pos())))
end)
minetest.register_cheat("Leak", "Player", "leak")

View File

@ -3,3 +3,5 @@ minetest.register_on_receiving_chat_message(function(message)
return true
end
end)
minetest.register_cheat("IgnoreStatus", "Player", "ignore_status_messages")

View File

@ -0,0 +1,19 @@
minetest.register_globalstep(function()
if minetest.settings:get_bool("autoeject") then
local player = minetest.localplayer
local list = (minetest.settings:get("eject_items") or ""):split(",")
local inventory = minetest.get_inventory("current_player")
for index, stack in pairs(inventory.main) do
if table.indexof(list, stack:get_name()) ~= -1 then
local old_index = player:get_wield_index()
player:set_wield_index(index - 1)
minetest.drop_selected_item()
player:set_wield_index(old_index)
return
end
end
end
end)
minetest.register_chatcommand("eject", list.new("Configure AutoEject", "eject_items"))
minetest.register_cheat("AutoEject", "Player", "autoeject")

View File

@ -1,8 +1,11 @@
inventory_mod = {}
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
dofile(modpath .. "/invhack.lua")
dofile(modpath .. "/enderchest.lua")
dofile(modpath .. "/next_item.lua")
dofile(modpath .. "/enderchest.lua")
dofile(modpath .. "/hand.lua")
dofile(modpath .. "/next_item.lua")
dofile(modpath .. "/autotool.lua")
dofile(modpath .. "/hand.lua")
dofile(modpath .. "/autoeject.lua")

View File

@ -1,3 +1,4 @@
name = inventory
author = Fleckenstein
description = The inventory cheats for Dragonfireclient
dependencies = list

View File

@ -1,2 +1,4 @@
next_item (NextItem) bool false
autotool (AutoTool) bool false
autoeject (AutoEject) bool false
eject_items (AutoEject Items) string

View File

@ -0,0 +1,47 @@
list = {}
function list.new(desc, setting)
local def = {}
def.description = desc
def.params = "del <item> | add <item> | list"
function def.func(param)
local list = (minetest.settings:get(setting) or ""):split(",")
if param == "list" then
return true, table.concat(list, ", ")
else
local sparam = param:split(" ")
local cmd = sparam[1]
local item = sparam[2]
if cmd == "del" then
if not item then
return false, "Missing item."
end
local i = table.indexof(list, item)
if i == -1 then
return false, item .. " is not on the list."
else
table.remove(list, i)
minetest.settings:set(setting, table.concat(list, ","))
return true, "Removed " .. item .. " from the list."
end
elseif cmd == "add" then
if not item then
return false, "Missing item."
end
local i = table.indexof(list, item)
if i ~= -1 then
return false, item .. " is already on the list."
else
table.insert(list, item)
minetest.settings:set(setting, table.concat(list, ","))
return true, "Added " .. item .. " to the list."
end
end
end
return false, "Invalid usage. (See /help <command>)"
end
return def
end
minetest.register_chatcommand("xray", list.new("Configure X-Ray", "xray_nodes"))
--minetest.register_chatcommand("Configure Search Nodes", "search_nodes")

View File

@ -25,3 +25,5 @@ load_mod_autoeat = true
load_mod_perlin = true
load_mod_hignore = true
load_mod_quotebot = true
load_mod_autosneak = true
load_mod_list = true

View File

@ -876,6 +876,8 @@ Call these functions only at load time!
* Alias for `minetest.send_chat_message("/" .. cmd .. " " .. param)`
* `minetest.clear_out_chat_queue()`
* Clears the out chat queue
* `minetest.drop_selected_item()`
* Drops the selected item
* `minetest.localplayer`
* Reference to the LocalPlayer object. See [`LocalPlayer`](#localplayer) class reference for methods.

View File

@ -41,7 +41,12 @@ public:
m_active_objects.find(id);
return (n != m_active_objects.end() ? n->second : nullptr);
}
std::unordered_map<u16, T *> getAllActiveObjects() const
{
return m_active_objects;
}
protected:
u16 getFreeId() const
{

View File

@ -1289,9 +1289,6 @@ void Client::sendReady()
void Client::sendPlayerPos(v3f pos)
{
if (g_settings->getBool("freecam"))
return;
LocalPlayer *player = m_env.getLocalPlayer();
if (!player)
return;
@ -1309,7 +1306,7 @@ void Client::sendPlayerPos(v3f pos)
if (
player->last_position == pos &&
player->last_speed == player->getSpeed() &&
player->last_speed == player->getLegitSpeed() &&
player->last_pitch == player->getPitch() &&
player->last_yaw == player->getYaw() &&
player->last_keyPressed == player->keyPressed &&
@ -1318,7 +1315,7 @@ void Client::sendPlayerPos(v3f pos)
return;
player->last_position = pos;
player->last_speed = player->getSpeed();
player->last_speed = player->getLegitSpeed();
player->last_pitch = player->getPitch();
player->last_yaw = player->getYaw();
player->last_keyPressed = player->keyPressed;
@ -1337,7 +1334,7 @@ void Client::sendPlayerPos()
LocalPlayer *player = m_env.getLocalPlayer();
if (!player)
return;
sendPlayerPos(player->getPosition());
sendPlayerPos(player->getLegitPosition());
}
void Client::removeNode(v3s16 p)
@ -1667,15 +1664,23 @@ void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server, bool ur
void Client::updateAllMapBlocks()
{
v3s16 currentBlock = getNodeBlockPos(floatToInt(m_env.getLocalPlayer()->getPosition(), BS));
for (s16 X = currentBlock.X - 2; X <= currentBlock.X + 2; X++)
for (s16 Y = currentBlock.Y - 2; Y <= currentBlock.Y + 2; Y++)
for (s16 Z = currentBlock.Z - 2; Z <= currentBlock.Z + 2; Z++)
addUpdateMeshTask(v3s16(X, Y, Z), false, true);
std::map<v2s16, MapSector*> *sectors = m_env.getMap().getSectorsPtr();
for (auto &sector_it : *sectors) {
MapSector *sector = sector_it.second;
MapBlockVect blocks;
sector->getBlocks(blocks);
for (MapBlock *block : blocks)
for (MapBlock *block : blocks) {
addUpdateMeshTask(block->getPos(), false, false);
}
}
//addUpdateMeshTaskWithEdge(getObjectBlockPos(m_env.getLocalPlayer()->getPosition()), false, false);
}
ClientEvent *Client::getClientEvent()

View File

@ -92,6 +92,11 @@ public:
{
return m_ao_manager.getActiveObject(id);
}
std::unordered_map<u16, ClientActiveObject*> getAllActiveObjects()
{
return m_ao_manager.getAllActiveObjects();
}
/*
Adds an active object to the environment.

View File

@ -112,7 +112,7 @@ Game::Game() :
&freecamChangedCallback, this);
g_settings->registerChangedCallback("xray",
&updateAllMapBlocksCallback, this);
g_settings->registerChangedCallback("xray_node",
g_settings->registerChangedCallback("xray_nodes",
&updateAllMapBlocksCallback, this);
g_settings->registerChangedCallback("fullbright",
&updateAllMapBlocksCallback, this);
@ -178,7 +178,7 @@ Game::~Game()
&freecamChangedCallback, this);
g_settings->deregisterChangedCallback("xray",
&updateAllMapBlocksCallback, this);
g_settings->deregisterChangedCallback("xray_node",
g_settings->deregisterChangedCallback("xray_nodes",
&updateAllMapBlocksCallback, this);
g_settings->deregisterChangedCallback("fullbright",
&updateAllMapBlocksCallback, this);
@ -228,7 +228,7 @@ bool Game::startup(bool *kill,
if (!createClient(start_data))
return false;
RenderingEngine::initialize(client, hud, m_tracers);
RenderingEngine::initialize(client, hud);
return true;
}
@ -349,9 +349,6 @@ void Game::shutdown()
if (m_cheat_menu)
delete m_cheat_menu;
if (m_tracers)
delete m_tracers;
if (sky)
sky->drop();
@ -627,14 +624,6 @@ bool Game::initGui()
return false;
}
m_tracers = new Tracers();
if (!m_tracers) {
*error_message = "Could not allocate memory for tracers";
errorstream << *error_message << std::endl;
return false;
}
#ifdef HAVE_TOUCHSCREENGUI
if (g_touchscreengui)
@ -3196,7 +3185,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
}
#endif
RenderingEngine::draw_scene(skycolor, m_game_ui->m_flags.show_hud,
m_game_ui->m_flags.show_minimap, draw_wield_tool, draw_crosshair, g_settings->getBool("enable_tracers"));
m_game_ui->m_flags.show_minimap, draw_wield_tool, draw_crosshair, g_settings->getBool("enable_tracers"), g_settings->getBool("enable_esp"));
/*
Profiler graph

View File

@ -50,7 +50,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gui/guiVolumeChange.h"
#include "gui/mainmenumanager.h"
#include "gui/profilergraph.h"
#include "gui/tracers.h"
#include "mapblock.h"
#include "minimap.h"
#include "nodedef.h" // Needed for determining pointing to nodes
@ -869,7 +868,6 @@ public:
std::unique_ptr<GameUI> m_game_ui;
GUIChatConsole *gui_chat_console = nullptr; // Free using ->Drop()
CheatMenu *m_cheat_menu = nullptr;
Tracers *m_tracers = nullptr;
MapDrawControl *draw_control = nullptr;
Camera *camera = nullptr;
Clouds *clouds = nullptr; // Free using ->Drop()

View File

@ -301,7 +301,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
collisionMoveResult result = collisionMoveSimple(env, m_client,
pos_max_d, m_collisionbox, player_stepheight, dtime,
&position, &m_speed, accel_f);
&position, &m_speed, accel_f, NULL, true, true);
bool could_sneak = control.sneak && !free_move && !in_liquid &&
!is_climbing && physics_override_sneak;
@ -923,7 +923,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
collisionMoveResult result = collisionMoveSimple(env, m_client,
pos_max_d, m_collisionbox, player_stepheight, dtime,
&position, &m_speed, accel_f);
&position, &m_speed, accel_f, NULL, true, true);
// Positition was slightly changed; update standing node pos
if (touching_ground)
@ -1175,7 +1175,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
// try at peak of jump, zero step height
collisionMoveResult jump_result = collisionMoveSimple(env, m_client, pos_max_d,
m_collisionbox, 0.0f, dtime, &jump_pos, &jump_speed, v3f(0.0f));
m_collisionbox, 0.0f, dtime, &jump_pos, &jump_speed, v3f(0.0f), NULL, true, true);
// see if we can get a little bit farther horizontally if we had
// jumped

View File

@ -788,6 +788,24 @@ void getNodeTile(MapNode mn, const v3s16 &p, const v3s16 &dir, MeshMakeData *dat
tile.rotation = tile.world_aligned ? 0 : dir_to_tile[tile_index + 1];
}
std::set<content_t> splitToContentT(std::string str, const NodeDefManager *ndef)
{
str += "\n";
std::set<content_t> dat;
std::string buf;
for (char c : str) {
if (c == ',' || c == '\n') {
if (! buf.empty()) {
dat.insert(ndef->getId(buf));
}
buf.clear();
} else if (c != ' ') {
buf += c;
}
}
return dat;
}
static void getTileInfo(
// Input:
MeshMakeData *data,
@ -799,19 +817,19 @@ static void getTileInfo(
v3s16 &face_dir_corrected,
u16 *lights,
u8 &waving,
TileSpec &tile
TileSpec &tile,
bool xray,
std::set<content_t> xraySet
)
{
VoxelManipulator &vmanip = data->m_vmanip;
const NodeDefManager *ndef = data->m_client->ndef();
v3s16 blockpos_nodes = data->m_blockpos * MAP_BLOCKSIZE;
content_t cXray = ndef->getId(g_settings->get("xray_node"));
bool xray = g_settings->getBool("xray");
const MapNode &n0 = vmanip.getNodeRefUnsafe(blockpos_nodes + p);
content_t c0 = n0.getContent();
if (xray && c0 == cXray)
if (xray && xraySet.find(c0) != xraySet.end())
c0 = CONTENT_AIR;
// Don't even try to get n1 if n0 is already CONTENT_IGNORE
@ -823,7 +841,7 @@ static void getTileInfo(
const MapNode &n1 = vmanip.getNodeRefUnsafeCheckFlags(blockpos_nodes + p + face_dir);
content_t c1 = n1.getContent();
if (xray && c1 == cXray)
if (xray && xraySet.find(c1) != xraySet.end())
c1 = CONTENT_AIR;
if (c1 == CONTENT_IGNORE) {
@ -889,7 +907,9 @@ static void updateFastFaceRow(
v3s16 translate_dir,
const v3f &&translate_dir_f,
const v3s16 &&face_dir,
std::vector<FastFace> &dest)
std::vector<FastFace> &dest,
bool xray,
std::set<content_t> xraySet)
{
static thread_local const bool waving_liquids =
g_settings->getBool("enable_shaders") &&
@ -909,7 +929,7 @@ static void updateFastFaceRow(
// Get info of first tile
getTileInfo(data, p, face_dir,
makes_face, p_corrected, face_dir_corrected,
lights, waving, tile);
lights, waving, tile, xray, xraySet);
// Unroll this variable which has a significant build cost
TileSpec next_tile;
@ -931,7 +951,9 @@ static void updateFastFaceRow(
next_makes_face, next_p_corrected,
next_face_dir_corrected, next_lights,
waving,
next_tile);
next_tile,
xray,
xraySet);
if (next_makes_face == makes_face
&& next_p_corrected == p_corrected + translate_dir
@ -981,7 +1003,7 @@ static void updateFastFaceRow(
}
static void updateAllFastFaceRows(MeshMakeData *data,
std::vector<FastFace> &dest)
std::vector<FastFace> &dest, bool xray, std::set<content_t> xraySet)
{
/*
Go through every y,z and get top(y+) faces in rows of x+
@ -993,7 +1015,9 @@ static void updateAllFastFaceRows(MeshMakeData *data,
v3s16(1, 0, 0), //dir
v3f (1, 0, 0),
v3s16(0, 1, 0), //face dir
dest);
dest,
xray,
xraySet);
/*
Go through every x,y and get right(x+) faces in rows of z+
@ -1005,7 +1029,9 @@ static void updateAllFastFaceRows(MeshMakeData *data,
v3s16(0, 0, 1), //dir
v3f (0, 0, 1),
v3s16(1, 0, 0), //face dir
dest);
dest,
xray,
xraySet);
/*
Go through every y,z and get back(z+) faces in rows of x+
@ -1017,7 +1043,9 @@ static void updateAllFastFaceRows(MeshMakeData *data,
v3s16(1, 0, 0), //dir
v3f (1, 0, 0),
v3s16(0, 0, 1), //face dir
dest);
dest,
xray,
xraySet);
}
static void applyTileColor(PreMeshBuffer &pmb)
@ -1064,18 +1092,25 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
std::vector<FastFace> fastfaces_new;
fastfaces_new.reserve(512);
/*
X-Ray
*/
bool xray = g_settings->getBool("xray");
std::set<content_t> xraySet;
if (xray)
xraySet = splitToContentT(g_settings->get("xray_nodes"), data->m_client->ndef());
/*
We are including the faces of the trailing edges of the block.
This means that when something changes, the caller must
also update the meshes of the blocks at the leading edges.
NOTE: This is the slowest part of this method.
*/
*/
{
// 4-23ms for MAP_BLOCKSIZE=16 (NOTE: probably outdated)
//TimeTaker timer2("updateAllFastFaceRows()");
updateAllFastFaceRows(data, fastfaces_new);
updateAllFastFaceRows(data, fastfaces_new, xray, xraySet);
}
// End of slow part

View File

@ -18,18 +18,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <iostream>
#include "core.h"
#include "client/camera.h"
#include "client/client.h"
#include "client/clientmap.h"
#include "client/hud.h"
#include "client/minimap.h"
#include "gui/tracers.h"
#include "client/content_cao.h"
#include "settings.h"
RenderingCore::RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers)
RenderingCore::RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud)
: device(_device), driver(device->getVideoDriver()), smgr(device->getSceneManager()),
guienv(device->getGUIEnvironment()), client(_client), camera(client->getCamera()),
mapper(client->getMinimap()), hud(_hud), tracers(_tracers)
mapper(client->getMinimap()), hud(_hud)
{
screensize = driver->getScreenSize();
virtual_size = screensize;
@ -54,7 +56,7 @@ void RenderingCore::updateScreenSize()
}
void RenderingCore::draw(video::SColor _skycolor, bool _show_hud, bool _show_minimap,
bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers)
bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers, bool _draw_esp)
{
v2u32 ss = driver->getScreenSize();
if (screensize != ss) {
@ -67,11 +69,54 @@ void RenderingCore::draw(video::SColor _skycolor, bool _show_hud, bool _show_min
draw_wield_tool = _draw_wield_tool;
draw_crosshair = _draw_crosshair;
draw_tracers = _draw_tracers;
draw_esp = _draw_esp;
beforeDraw();
drawAll();
}
void RenderingCore::drawTracersAndESP()
{
ClientEnvironment &env = client->getEnv();
Camera *camera = client->getCamera();
v3f camera_offset = intToFloat(camera->getOffset(), BS);
v3f eye_pos = (camera->getPosition() + camera->getDirection() - camera_offset);
video::SMaterial material, oldmaterial;
oldmaterial = driver->getMaterial2D();
material.setFlag(video::EMF_LIGHTING, false);
material.setFlag(video::EMF_BILINEAR_FILTER, false);
material.setFlag(video::EMF_ZBUFFER, false);
material.setFlag(video::EMF_ZWRITE_ENABLE, false);
driver->setMaterial(material);
auto allObjects = env.getAllActiveObjects();
for (auto &it : allObjects) {
ClientActiveObject *cao = it.second;
if (cao->isLocalPlayer() || cao->getParent())
continue;
GenericCAO *obj = dynamic_cast<GenericCAO *>(cao);
if (! obj)
continue;
aabb3f box;
if (! obj->getSelectionBox(&box))
continue;
v3f pos = obj->getPosition();
pos -= camera_offset;
box.MinEdge += pos;
box.MaxEdge += pos;
pos = box.getCenter();
if (draw_esp)
driver->draw3DBox(box, video::SColor(255, 255, 255, 255));
if (draw_tracers && (!g_settings->getBool("trace_players_only") || cao->isPlayer()))
driver->draw3DLine(eye_pos, pos, video::SColor(255, 255, 255, 255));
}
driver->setMaterial(oldmaterial);
}
void RenderingCore::draw3D()
{
smgr->drawAll();
@ -79,8 +124,8 @@ void RenderingCore::draw3D()
if (!show_hud)
return;
hud->drawSelectionMesh();
if (draw_tracers)
tracers->draw(driver, client);
if (draw_tracers || draw_esp)
drawTracersAndESP();
if (draw_wield_tool)
camera->drawWieldedTool();
}

View File

@ -25,7 +25,6 @@ class Camera;
class Client;
class Hud;
class Minimap;
class Tracers;
class RenderingCore
{
@ -38,6 +37,7 @@ protected:
bool draw_wield_tool;
bool draw_crosshair;
bool draw_tracers;
bool draw_esp;
IrrlichtDevice *device;
video::IVideoDriver *driver;
@ -48,8 +48,7 @@ protected:
Camera *camera;
Minimap *mapper;
Hud *hud;
Tracers *tracers;
void updateScreenSize();
virtual void initTextures() {}
virtual void clearTextures() {}
@ -57,12 +56,13 @@ protected:
virtual void beforeDraw() {}
virtual void drawAll() = 0;
void drawTracersAndESP();
void draw3D();
void drawHUD();
void drawPostFx();
public:
RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers);
RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud);
RenderingCore(const RenderingCore &) = delete;
RenderingCore(RenderingCore &&) = delete;
virtual ~RenderingCore();
@ -72,7 +72,7 @@ public:
void initialize();
void draw(video::SColor _skycolor, bool _show_hud, bool _show_minimap,
bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers);
bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers, bool _draw_esp);
inline v2u32 getVirtualSize() const { return virtual_size; }
};

View File

@ -27,23 +27,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "sidebyside.h"
RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevice *device,
Client *client, Hud *hud, Tracers *tracers)
Client *client, Hud *hud)
{
if (stereo_mode == "none")
return new RenderingCorePlain(device, client, hud, tracers);
return new RenderingCorePlain(device, client, hud);
if (stereo_mode == "anaglyph")
return new RenderingCoreAnaglyph(device, client, hud, tracers);
return new RenderingCoreAnaglyph(device, client, hud);
if (stereo_mode == "interlaced")
return new RenderingCoreInterlaced(device, client, hud, tracers);
return new RenderingCoreInterlaced(device, client, hud);
#ifdef STEREO_PAGEFLIP_SUPPORTED
if (stereo_mode == "pageflip")
return new RenderingCorePageflip(device, client, hud, tracers);
return new RenderingCorePageflip(device, client, hud);
#endif
if (stereo_mode == "sidebyside")
return new RenderingCoreSideBySide(device, client, hud, tracers);
return new RenderingCoreSideBySide(device, client, hud);
if (stereo_mode == "topbottom")
return new RenderingCoreSideBySide(device, client, hud, tracers, true);
return new RenderingCoreSideBySide(device, client, hud, true);
if (stereo_mode == "crossview")
return new RenderingCoreSideBySide(device, client, hud, tracers, false, true);
return new RenderingCoreSideBySide(device, client, hud, false, true);
throw std::invalid_argument("Invalid rendering mode: " + stereo_mode);
}

View File

@ -24,4 +24,4 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "core.h"
RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevice *device,
Client *client, Hud *hud, Tracers *tracers);
Client *client, Hud *hud);

View File

@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/tile.h"
RenderingCoreInterlaced::RenderingCoreInterlaced(
IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers)
: RenderingCoreStereo(_device, _client, _hud, _tracers)
IrrlichtDevice *_device, Client *_client, Hud *_hud)
: RenderingCoreStereo(_device, _client, _hud)
{
initMaterial();
}

View File

@ -38,6 +38,6 @@ protected:
void merge();
public:
RenderingCoreInterlaced(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers);
RenderingCoreInterlaced(IrrlichtDevice *_device, Client *_client, Hud *_hud);
void drawAll() override;
};

View File

@ -27,8 +27,8 @@ inline u32 scaledown(u32 coef, u32 size)
}
RenderingCorePlain::RenderingCorePlain(
IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers)
: RenderingCore(_device, _client, _hud, _tracers)
IrrlichtDevice *_device, Client *_client, Hud *_hud)
: RenderingCore(_device, _client, _hud)
{
scale = g_settings->getU16("undersampling");
}

View File

@ -33,6 +33,6 @@ protected:
void upscale();
public:
RenderingCorePlain(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers);
RenderingCorePlain(IrrlichtDevice *_device, Client *_client, Hud *_hud);
void drawAll() override;
};

View File

@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/hud.h"
RenderingCoreSideBySide::RenderingCoreSideBySide(
IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers, bool _horizontal, bool _flipped)
: RenderingCoreStereo(_device, _client, _hud, _tracers), horizontal(_horizontal), flipped(_flipped)
IrrlichtDevice *_device, Client *_client, Hud *_hud, bool _horizontal, bool _flipped)
: RenderingCoreStereo(_device, _client, _hud), horizontal(_horizontal), flipped(_flipped)
{
}

View File

@ -37,7 +37,7 @@ protected:
void resetEye() override;
public:
RenderingCoreSideBySide(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers,
RenderingCoreSideBySide(IrrlichtDevice *_device, Client *_client, Hud *_hud,
bool _horizontal = false, bool _flipped = false);
void drawAll() override;
};

View File

@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "settings.h"
RenderingCoreStereo::RenderingCoreStereo(
IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers)
: RenderingCore(_device, _client, _hud, _tracers)
IrrlichtDevice *_device, Client *_client, Hud *_hud)
: RenderingCore(_device, _client, _hud)
{
eye_offset = BS * g_settings->getFloat("3d_paralax_strength");
}

View File

@ -34,5 +34,5 @@ protected:
void renderBothImages();
public:
RenderingCoreStereo(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers);
RenderingCoreStereo(IrrlichtDevice *_device, Client *_client, Hud *_hud);
};

View File

@ -591,10 +591,10 @@ std::vector<irr::video::E_DRIVER_TYPE> RenderingEngine::getSupportedVideoDrivers
return drivers;
}
void RenderingEngine::_initialize(Client *client, Hud *hud, Tracers *tracers)
void RenderingEngine::_initialize(Client *client, Hud *hud)
{
const std::string &draw_mode = g_settings->get("3d_mode");
core.reset(createRenderingCore(draw_mode, m_device, client, hud, tracers));
core.reset(createRenderingCore(draw_mode, m_device, client, hud));
core->initialize();
}
@ -604,9 +604,9 @@ void RenderingEngine::_finalize()
}
void RenderingEngine::_draw_scene(video::SColor skycolor, bool show_hud,
bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers)
bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers, bool draw_esp)
{
core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair, draw_tracers);
core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair, draw_tracers, draw_esp);
}
const char *RenderingEngine::getVideoDriverName(irr::video::E_DRIVER_TYPE type)

View File

@ -118,15 +118,15 @@ public:
}
inline static void draw_scene(video::SColor skycolor, bool show_hud,
bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers)
bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers, bool draw_esp)
{
s_singleton->_draw_scene(skycolor, show_hud, show_minimap,
draw_wield_tool, draw_crosshair, draw_tracers);
draw_wield_tool, draw_crosshair, draw_tracers, draw_esp);
}
inline static void initialize(Client *client, Hud *hud, Tracers *tracers)
inline static void initialize(Client *client, Hud *hud)
{
s_singleton->_initialize(client, hud, tracers);
s_singleton->_initialize(client, hud);
}
inline static void finalize() { s_singleton->_finalize(); }
@ -149,9 +149,9 @@ private:
bool clouds = true);
void _draw_scene(video::SColor skycolor, bool show_hud, bool show_minimap,
bool draw_wield_tool, bool draw_crosshair, bool draw_tracers);
bool draw_wield_tool, bool draw_crosshair, bool draw_tracers, bool draw_esp);
void _initialize(Client *client, Hud *hud, Tracers *tracers);
void _initialize(Client *client, Hud *hud);
void _finalize();

View File

@ -227,7 +227,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
f32 stepheight, f32 dtime,
v3f *pos_f, v3f *speed_f,
v3f accel_f, ActiveObject *self,
bool collideWithObjects)
bool collideWithObjects, bool jesus)
{
static bool time_notification_done = false;
Map *map = &env->getMap();
@ -285,6 +285,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
v3s16 max = floatToInt(maxpos_f + box_0.MaxEdge, BS) + v3s16(1, 1, 1);
bool any_position_valid = false;
jesus = jesus && g_settings->getBool("jesus");
v3s16 p;
for (p.X = min.X; p.X <= max.X; p.X++)
@ -300,7 +301,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
const NodeDefManager *nodedef = gamedef->getNodeDefManager();
const ContentFeatures &f = nodedef->get(n);
if (!(f.walkable || (g_settings->getBool("jesus") && f.isLiquid())))
if (!(f.walkable || (jesus && f.isLiquid())))
continue;
int n_bouncy_value = itemgroup_get(f.groups, "bouncy");

View File

@ -70,7 +70,7 @@ collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef,
f32 stepheight, f32 dtime,
v3f *pos_f, v3f *speed_f,
v3f accel_f, ActiveObject *self=NULL,
bool collideWithObjects=true);
bool collideWithObjects=true, bool jesus=false);
// Helper function:
// Checks for collision of a moving aabbox with a static aabbox

View File

@ -66,7 +66,7 @@ void set_default_settings(Settings *settings)
// Cheats
settings->setDefault("xray", "false");
settings->setDefault("xray_node", "default:stone");
settings->setDefault("xray_nodes", "default:stone,mcl_core:stone");
settings->setDefault("fullbright", "false");
settings->setDefault("priv_bypass", "true");
settings->setDefault("fastdig", "false");
@ -92,6 +92,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("spamclick", "false");
settings->setDefault("no_force_rotate", "false");
settings->setDefault("enable_tracers", "false");
settings->setDefault("enable_esp", "false");
settings->setDefault("no_slow", "false");
settings->setDefault("trace_players_only", "true");

View File

@ -25,6 +25,5 @@ set(gui_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/intlGUIEditBox.cpp
${CMAKE_CURRENT_SOURCE_DIR}/modalMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/profilergraph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tracers.cpp
PARENT_SCOPE
)

View File

@ -1,46 +0,0 @@
/*
Dragonfire
Copyright (C) 2020 Elias Fleckenstein <eliasfleckenstein@web.de>
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 <vector>
#include "client/client.h"
#include "client/camera.h"
#include "tracers.h"
#include "constants.h"
#include "settings.h"
#include "client/content_cao.h"
void Tracers::draw(video::IVideoDriver* driver, Client *client)
{
ClientEnvironment &env = client->getEnv();
LocalPlayer *player = env.getLocalPlayer();
Camera *camera = client->getCamera();
v3f player_pos = player->getPosition();
v3f head_pos = camera->getPosition() + camera->getDirection();
std::vector<DistanceSortedActiveObject> allObjects;
env.getActiveObjects(player_pos, 1000000, allObjects);
for (const auto &allObject : allObjects) {
ClientActiveObject *obj = allObject.obj;
if (obj->isLocalPlayer() || obj->getParent())
continue;
GenericCAO *cao = env.getGenericCAO(obj->getId());
if (!g_settings->getBool("trace_players_only") || (cao && cao->isPlayer()))
driver->draw3DLine(head_pos, obj->getPosition(), video::SColor(255, 255, 255, 255));
}
}

View File

@ -1,28 +0,0 @@
/*
Dragonfire
Copyright (C) 2020 Elias Fleckenstein <eliasfleckenstein@web.de>
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_extrabloated.h"
class Tracers
{
public:
void draw(video::IVideoDriver* driver, Client *client);
};

View File

@ -496,6 +496,13 @@ int ModApiClient::l_set_keypress(lua_State *L)
return 1;
}
// drop_selected_item()
int ModApiClient::l_drop_selected_item(lua_State *L)
{
g_game->dropSelectedItem();
return 0;
}
void ModApiClient::Initialize(lua_State *L, int top)
{
API_FCT(get_current_modname);
@ -528,4 +535,5 @@ void ModApiClient::Initialize(lua_State *L, int top)
API_FCT(dig_node);
API_FCT(get_inventory);
API_FCT(set_keypress);
API_FCT(drop_selected_item);
}

View File

@ -116,9 +116,12 @@ private:
// get_inventory(location)
static int l_get_inventory(lua_State *L);
// l_set_keypress(key_setting, pressed)
// set_keypress(key_setting, pressed)
static int l_set_keypress(lua_State *L);
// drop_selected_item()
static int l_drop_selected_item(lua_State *L);
public:
static void Initialize(lua_State *L, int top);
};