Dateien nach "/" hochladen

This commit is contained in:
2026-03-07 12:39:37 +00:00
parent 4ab1cb87e3
commit 822953dddf
3 changed files with 87 additions and 20 deletions

7
ai.lua
View File

@@ -113,12 +113,15 @@ local function try_fire(self_ent, target_pos)
local cd = weapon == "plasma" and SHOOT_COOLDOWN_PLASMA or SHOOT_COOLDOWN_BULLET
if (now - (self_ent._ai_last_shot or 0)) < cd then return false end
-- Spider ammo check
-- Ammo check per weapon type
if weapon == "plasma" then
local ammo = self_ent._spider_ammo or SPIDER_AMMO_MAX
if ammo < SPIDER_AMMO_MIN_TO_FIRE then return false end
-- Consume ammo
self_ent._spider_ammo = math.max(0, ammo - SPIDER_AMMO_COST)
elseif weapon == "bullet" then
local ammo = self_ent._fang_ammo or FANG_AMMO_MAX
if ammo < FANG_AMMO_MIN_TO_FIRE then return false end
self_ent._fang_ammo = math.max(0, ammo - FANG_AMMO_COST)
end
local my_pos = self_ent.object:get_pos()