Dateien nach "/" hochladen
This commit is contained in:
8
ai.lua
8
ai.lua
@@ -113,6 +113,14 @@ 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 pruefen
|
||||
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
|
||||
-- Ammo verbrauchen
|
||||
self_ent._spider_ammo = math.max(0, ammo - SPIDER_AMMO_COST)
|
||||
end
|
||||
|
||||
local my_pos = self_ent.object:get_pos()
|
||||
local aim = {x=target_pos.x, y=target_pos.y+1.2, z=target_pos.z}
|
||||
local origin = {x=my_pos.x, y=my_pos.y+4.0, z=my_pos.z}
|
||||
|
||||
Reference in New Issue
Block a user