Make bullet maximum lifetime configurable

This commit is contained in:
Lars 2024-05-30 18:13:18 -07:00
parent ff4c974a7e
commit d719189262
2 changed files with 5 additions and 1 deletions

@ -27,6 +27,7 @@ initial_properties = {
}
local use_particles = minetest.settings:get_bool("rangedweapons_impact_particles", true)
local max_lifetime = tonumber(minetest.settings:get("rangedweapons_bullet_lifetime")) or 10.0
rangedweapons_shot_bullet.on_step = function(self, dtime, moveresult)
----------------------------------------
@ -66,7 +67,7 @@ self.object:set_properties({collide_with_objects = true})
self.object:set_properties({collisionbox = {-size, -size, -size, size, size, size}})
end
if self.timer > 10 then
if self.timer > max_lifetime then
self.object:remove()
end

@ -16,6 +16,9 @@ rangedweapons_other_weapon_crafting (Other Weapon Crafting) bool true
# If true, a gun can always be reloaded (just need at least one matching bullet in the inventory)
rangedweapons_infinite_ammo (Inifinite Ammo) bool false
# Maximum lifetime of a bullet (or rocket)
rangedweapons_bullet_lifetime (Bullet Lifetime) int 10
# Damage multiplier for hits on other players
rangedweapons_player_dmg_multiplier (Player Damage Multiplier) float 1.0