From 7cb521725569b7eda98af40f7e4b4eb63afff633 Mon Sep 17 00:00:00 2001 From: "Esteban I. Ruiz Moreno" Date: Tue, 4 Jun 2013 23:26:52 -0300 Subject: Close console when it loses focus but it is still on screen --- src/game.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 22bd8c429..2d43d05b8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1684,6 +1684,10 @@ void the_game( { input->clear(); } + if (!guienv->hasFocus(gui_chat_console) && gui_chat_console->isOpen()) + { + gui_chat_console->closeConsoleAtOnce(); + } // Input handler step() (used by the random input generator) input->step(dtime); -- cgit v1.2.3 From 2cdf0ff4abaa045545440c8694b47371766a7b64 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Wed, 17 Apr 2013 20:13:47 +0200 Subject: Play player_damage.ogg when recieving damage and additionally play player_falling_damage.ogg when recieving falling damage --- src/game.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 2d43d05b8..baf161e88 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -729,6 +729,18 @@ public: sm->m_sound->playSound(sm->m_ndef->get(nde->n).sound_dug, false); } + static void playerDamage(MtEvent *e, void *data) + { + SoundMaker *sm = (SoundMaker*)data; + sm->m_sound->playSound(SimpleSoundSpec("player_damage", 0.5), false); + } + + static void playerFallingDamage(MtEvent *e, void *data) + { + SoundMaker *sm = (SoundMaker*)data; + sm->m_sound->playSound(SimpleSoundSpec("player_falling_damage", 0.5), false); + } + void registerReceiver(MtEventManager *mgr) { mgr->reg("ViewBobbingStep", SoundMaker::viewBobbingStep, this); @@ -737,6 +749,8 @@ public: mgr->reg("CameraPunchLeft", SoundMaker::cameraPunchLeft, this); mgr->reg("CameraPunchRight", SoundMaker::cameraPunchRight, this); mgr->reg("NodeDug", SoundMaker::nodeDug, this); + mgr->reg("PlayerDamage", SoundMaker::playerDamage, this); + mgr->reg("PlayerFallingDamage", SoundMaker::playerFallingDamage, this); } void step(float dtime) @@ -2202,6 +2216,9 @@ void the_game( player->hurt_tilt_timer = 1.5; player->hurt_tilt_strength = event.player_damage.amount/2; player->hurt_tilt_strength = rangelim(player->hurt_tilt_strength, 2.0, 10.0); + + MtEvent *e = new SimpleTriggerEvent("PlayerDamage"); + gamedef->event()->put(e); } else if(event.type == CE_PLAYER_FORCE_MOVE) { -- cgit v1.2.3 From 21d6b39fd734af632aa4847935ac5f2a4ad6dc61 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Thu, 13 Jun 2013 14:32:53 +0200 Subject: Enable word wrapping in profiler IGUIStaticText (freetype needs this) --- src/game.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index baf161e88..cbb0d9183 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1380,6 +1380,7 @@ void the_game( false, false); guitext_profiler->setBackgroundColor(video::SColor(120,0,0,0)); guitext_profiler->setVisible(false); + guitext_profiler->setWordWrap(true); /* Some statistics are collected in these -- cgit v1.2.3 From 7a58c1d4ca7a59f05043ff3c2caeab16c0a78a0d Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Thu, 13 Jun 2013 12:41:23 +0000 Subject: Reset dig_time when switching to a tool that cant dig the current node --- src/game.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index cbb0d9183..30d9c7faf 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2706,7 +2706,12 @@ void the_game( gamedef->event()->put(e); } - dig_time += dtime; + if(dig_time_complete < 100000.0) + dig_time += dtime; + else { + dig_time = 0; + client.setCrack(-1, nodepos); + } camera.setDigging(0); // left click animation } -- cgit v1.2.3 From 53066024f6a91d5f83241b379b94d8557d43a646 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Wed, 19 Jun 2013 14:30:22 +0000 Subject: Add drowning --- src/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 30d9c7faf..88be47b39 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3310,7 +3310,7 @@ void the_game( if (show_hud) { hud.drawHotbar(v2s32(displaycenter.X, screensize.Y), - client.getHP(), client.getPlayerItem()); + client.getHP(), client.getPlayerItem(), client.getBreath()); } /* -- cgit v1.2.3 From 9b6f1d647c612bddbc994357b9e9fc8348868234 Mon Sep 17 00:00:00 2001 From: PilzAdam Date: Wed, 19 Jun 2013 21:00:14 +0000 Subject: Dont dig or place nodes if interact priv is missing (clientside) --- src/game.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 88be47b39..f00e4c949 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2589,7 +2589,8 @@ void the_game( Handle digging */ - if(nodig_delay_timer <= 0.0 && input->getLeftState()) + if(nodig_delay_timer <= 0.0 && input->getLeftState() + && client.checkPrivilege("interact")) { if(!digging) { @@ -2716,8 +2717,10 @@ void the_game( camera.setDigging(0); // left click animation } - if(input->getRightClicked() || - repeat_rightclick_timer >= g_settings->getFloat("repeat_rightclick_time")) + if((input->getRightClicked() || + repeat_rightclick_timer >= + g_settings->getFloat("repeat_rightclick_time")) && + client.checkPrivilege("interact")) { repeat_rightclick_timer = 0; infostream<<"Ground right-clicked"< Date: Wed, 19 Jun 2013 21:09:18 +0000 Subject: Play placing sound only if place prediction was successful --- src/game.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index f00e4c949..833117959 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -834,7 +834,7 @@ public: } }; -void nodePlacementPrediction(Client &client, +bool nodePlacementPrediction(Client &client, const ItemDefinition &playeritem_def, v3s16 nodepos, v3s16 neighbourpos) { @@ -854,7 +854,7 @@ void nodePlacementPrediction(Client &client, if(nodedef->get(n_under).buildable_to) p = nodepos; else if (!nodedef->get(map.getNode(p)).buildable_to) - return; + return false; }catch(InvalidPositionException &e){} // Find id of predicted node content_t id; @@ -864,7 +864,7 @@ void nodePlacementPrediction(Client &client, <get(map.getNode(pp)).walkable) - return; + return false; } // Add node to client map MapNode n(id, 0, param2); try{ // This triggers the required mesh update too client.addNode(p, n); + return true; }catch(InvalidPositionException &e){ errorstream<<"Node placement prediction failed for " <