From e6bef672750e77d820269b5386ce0a966633cc62 Mon Sep 17 00:00:00 2001 From: NO411 Date: Mon, 31 Jan 2022 17:42:20 +0100 Subject: [PATCH 1/3] Remove unnecessary code --- mods/ITEMS/mcl_shields/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 3ac58fc3c..57701345d 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -464,6 +464,5 @@ minetest.register_on_joinplayer(function(player) shields = {}, blocking = 0, } - mcl_shields.players[player].blocking = 0 remove_shield_hud(player) end) From 33c7ce16103537b074dea98854477a3792ccf37e Mon Sep 17 00:00:00 2001 From: NO411 Date: Mon, 31 Jan 2022 18:08:43 +0100 Subject: [PATCH 2/3] Fix interact behavior to prevent hackers from get interact back through shields --- mods/ENVIRONMENT/mcl_weather/rain.lua | 4 ++-- mods/ITEMS/mcl_shields/init.lua | 7 +++++-- mods/MISC/mcl_privs/init.lua | 24 +++++++++++++++++++----- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index 191062bcd..7efc866bf 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -29,7 +29,7 @@ local psdef= { minpos = vector.new(-6,3,-6), maxpos = vector.new(6,15,6), minvel = vector.new(-vel,-falling_speed,-vel), - maxvel = math.random(vel,-falling_speed+vel,vel), + maxvel = vector.new(vel,-falling_speed+vel,vel), minacc = vector.new(0,0,0), maxacc = vector.new(0,-0.4,0), minexptime = 0.5, @@ -46,7 +46,7 @@ local psdef_backsplash= { minpos = vector.new(-3,-1,-3), maxpos = vector.new(3,0,3), minvel = vector.new(-vel,falling_speed*2,-vel), - maxvel = math.random(vel,falling_speed*2+vel,vel), + maxvel = vector.new(vel,falling_speed*2+vel,vel), minacc = vector.new(0,0,0), maxacc = vector.new(0,0,0), minexptime = 0.1, diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 57701345d..f742bc760 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -183,8 +183,11 @@ local function set_interact(player, interact) local player_name = player:get_player_name() local privs = minetest.get_player_privs(player_name) if privs.interact ~= interact then - privs.interact = interact - minetest.set_player_privs(player_name, privs) + local meta = player:get_meta() + if meta:get_int("ineract_revoked") ~= 1 then + privs.interact = interact + minetest.set_player_privs(player_name, privs) + end end end diff --git a/mods/MISC/mcl_privs/init.lua b/mods/MISC/mcl_privs/init.lua index b0d7a5066..bbf75f37b 100644 --- a/mods/MISC/mcl_privs/init.lua +++ b/mods/MISC/mcl_privs/init.lua @@ -20,12 +20,26 @@ end) for _, action in pairs({"grant", "revoke"}) do minetest["register_on_priv_" .. action](function(name, _, priv) - if priv == "fly" then - local player = minetest.get_player_by_name(name) - if player then - local meta = player:get_meta() + local player = minetest.get_player_by_name(name) + if player then + local meta = player:get_meta() + + if priv == "fly" then meta:set_int("fly_changed", 1) end + + --[[ + so e.g. hackers who have been revoked of the interact privilege + will not automatically get the interact privilege through the mcl shields code back + ]] + + if priv == "interact" then + if action == "revoke" then + meta:set_int("ineract_revoked", 1) + else + meta:set_int("ineract_revoked", 0) + end + end end end) -end \ No newline at end of file +end From 04146d98b0ad3b4103b8111d8576659b88e1679d Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 31 Jan 2022 21:35:21 +0100 Subject: [PATCH 3/3] remove unnecessary on_dimensionchange --- mods/ENVIRONMENT/mcl_weather/rain.lua | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index 7efc866bf..0caef5c6f 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -119,19 +119,6 @@ function mcl_weather.rain.remove_player(player) end end -mcl_worlds.register_on_dimension_change(function(player, dimension) - if dimension ~= "overworld" and dimension ~= "void" then - mcl_weather.rain.remove_sound(player) - mcl_weather.rain.remove_player(player) - elseif dimension == "overworld" then - mcl_weather.rain.update_sound(player) - if mcl_weather.rain.raining then - mcl_weather.rain.add_rain_particles(player) - mcl_weather.rain.add_player(player) - end - end -end) - -- adds and removes rain sound depending how much rain particles around player currently exist. -- have few seconds delay before each check to avoid on/off sound too often -- when player stay on 'edge' where sound should play and stop depending from random raindrop appearance.