Add casts to numeric config options.

This commit is contained in:
Lars 2022-09-16 10:40:40 -07:00
parent aaf861e497
commit c70adf6f7a
3 changed files with 6 additions and 6 deletions

@ -282,9 +282,9 @@ for _, dmg in pairs(actualDamage) do
damage[_] = actualDamage[_]
end
local player_dmg_multiplier = minetest.settings:get("rangedweapons_player_dmg_multiplier") or 1.0
local headshot_dmg_multiplier = minetest.settings:get("rangedweapons_headshot_dmg_multiplier") or 1.75
local mob_dmg_multiplier = minetest.settings:get("rangedweapons_mob_dmg_multiplier") or 1.0
local player_dmg_multiplier = tonumber(minetest.settings:get("rangedweapons_player_dmg_multiplier")) or 1.0
local headshot_dmg_multiplier = tonumber(minetest.settings:get("rangedweapons_headshot_dmg_multiplier")) or 1.75
local mob_dmg_multiplier = tonumber(minetest.settings:get("rangedweapons_mob_dmg_multiplier")) or 1.0
if moveresult.collisions[1].object:is_player() then
for _, player_dmg in pairs(damage) do
@ -327,7 +327,7 @@ moveresult.collisions[1].object:punch(owner, 1.0, {
damage_groups = damage,}, nil)
owner:hud_change(hit, "text", hit_texture)
local bloodyness = minetest.settings:get("rangedweapons_bloodyness") or 10
local bloodyness = tonumber(minetest.settings:get("rangedweapons_bloodyness")) or 10
for i=1,math.random(math.ceil(bloodyness*0.66),math.ceil(bloodyness*1.5)) do
minetest.add_particle({
pos = self.object:get_pos(),

@ -39,7 +39,7 @@ minetest.sound_play("rengedweapons_ricochet", {pos = pos, gain = 0.75})
end
end
local max_gun_efficiency = minetest.settings:get("rangedweapons_max_gun_efficiency") or 300
local max_gun_efficiency = tonumber(minetest.settings:get("rangedweapons_max_gun_efficiency")) or 300
rangedweapons_gain_skill = function(player,skill,chance)

@ -79,7 +79,7 @@ end
end
})
local min_gun_efficiency = minetest.settings:get("rangedweapons_min_gun_efficiency") or 40
local min_gun_efficiency = tonumber(minetest.settings:get("rangedweapons_min_gun_efficiency")) or 40
local timer = 0
minetest.register_globalstep(function(dtime, player)