You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-11-29 22:47:52 +02:00
Beams - fix abuse
This commit is contained in:
@@ -3,7 +3,23 @@ local Global = require 'utils.global'
|
||||
local Gui = require 'utils.gui'
|
||||
|
||||
local this = {
|
||||
renders = {}
|
||||
renders = {},
|
||||
valid_targets = {
|
||||
'character',
|
||||
'tank',
|
||||
'car',
|
||||
'lab',
|
||||
'locomotive',
|
||||
'cargo-wagon',
|
||||
'fluid-wagon',
|
||||
'artillery-wagon',
|
||||
'artillery-turret',
|
||||
'laser-turret',
|
||||
'gun-turret',
|
||||
'flamethrower-turret',
|
||||
'silo',
|
||||
'spidertron'
|
||||
}
|
||||
}
|
||||
|
||||
local Public = {}
|
||||
@@ -20,25 +36,6 @@ Global.register(
|
||||
end
|
||||
)
|
||||
|
||||
local target_entities = {
|
||||
'character',
|
||||
'tank',
|
||||
'car',
|
||||
'radar',
|
||||
'lab',
|
||||
'furnace',
|
||||
'locomotive',
|
||||
'cargo-wagon',
|
||||
'fluid-wagon',
|
||||
'artillery-wagon',
|
||||
'artillery-turret',
|
||||
'laser-turret',
|
||||
'gun-turret',
|
||||
'flamethrower-turret',
|
||||
'silo',
|
||||
'spidertron'
|
||||
}
|
||||
|
||||
local sqrt = math.sqrt
|
||||
local random = math.random
|
||||
local remove = table.remove
|
||||
@@ -58,7 +55,7 @@ end
|
||||
function Public:new_target()
|
||||
local surface = game.get_surface(self.surface_id)
|
||||
local position
|
||||
local entities = surface.find_entities_filtered {type = target_entities}
|
||||
local entities = surface.find_entities_filtered {type = this.valid_targets}
|
||||
if entities and #entities > 0 then
|
||||
position = entities[random(#entities)].position
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user