~gpcf/advtrains

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Make the speed at which trains kill users of the Minetest World configurable using the advtrains_kill_speed setting

Details
Message ID
<Wzo1D9scdMMTvq0O7Cwt9XqGJt892waDLa5E1MMNmR-5BMLc_IFhlJ7FVzKnR3wUt7TObIck0fr9i1t3YER9fA5glHg0TZ-VyWd6PcNT8pA=@protonmail.com>
DKIM signature
missing
Download raw message
Patch: +4 -1
commit 95a19850334be0eb8ccd9baf8d65c72ccdc6eaf9 (HEAD -> master)
Author: 56independent <56independent@protonmail.com>
Date:   Thu Feb 24 12:33:54 2022 +0000

    Make kill speed configurable

diff --git a/advtrains/settingtypes.txt b/advtrains/settingtypes.txt
index 2b627cb..dd9bda9 100644
--- a/advtrains/settingtypes.txt
+++ b/advtrains/settingtypes.txt
@@ -61,3 +61,6 @@ advtrains_save_interval (Save Interval) int 60 20 3600
#    If enabled, trains only collide with nodes with "normal" drawtype.
advtrains_forgiving_collision (Forgiving Collision mode) bool false

#   Speed trains kill at
#   In n/s
advtrains_kill_speed (Speed in m/s) int 3
\ No newline at end of file
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index 35c3726..72b6026 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -771,7 +771,7 @@ function advtrains.train_step_c(id, train, dtime)
                                               end

                                               --- 8b damage players ---
                                               if is_loaded_area and train.velocity > 3 and (setting_overrun_mode=="drop" or setting_overrun_mode=="normal") then
                                               if is_loaded_area and train.velocity > minetest.settings:get("advtrains_kill_speed") and (setting_overrun_mode=="drop" or setting_overrun_mode=="normal") then
                                                       local testpts = minetest.pos_to_string(testpos)
                                                       local player=advtrains.playersbypts[testpts]
                                                       if player and player:get_hp()>0 and advtrains.is_damage_enabled(player:get_player_name()) then
diff --git a/advtrains_interlocking/demosignals.lua
Details
Message ID
<87sfs0s76q.fsf@forksworld.de>
In-Reply-To
<Wzo1D9scdMMTvq0O7Cwt9XqGJt892waDLa5E1MMNmR-5BMLc_IFhlJ7FVzKnR3wUt7TObIck0fr9i1t3YER9fA5glHg0TZ-VyWd6PcNT8pA=@protonmail.com> (view parent)
DKIM signature
missing
Download raw message
> -                                               if is_loaded_area and train.velocity > 3 and (setting_overrun_mode=="drop" or setting_overrun_mode=="normal") then
> +                                               if is_loaded_area and train.velocity > minetest.settings:get("advtrains_kill_speed") and (setting_overrun_mode=="drop" or setting_overrun_mode=="normal") then

I have pointed out the use of "velocity" over "speed" for consistency in
the previous email. The relevant settings should also be added to the
settingtypes.txt file. Blockhead's patch addresses both issues.
Reply to thread Export thread (mbox)