Code: Select all
<SOME_LuaSurface>.create_entity{
position = <TARGET_POSITION>,
force = <ENEMY_FORCE>,
name = 'artillery-flare',
frame_speed=0, vertical_speed=0, height=0, movement={0,0}}
But target mark is visible to other force. How to hide it?
Code: Select all
<SOME_LuaSurface>.create_entity{
position = <TARGET_POSITION>,
force = <ENEMY_FORCE>,
name = 'artillery-flare',
frame_speed=0, vertical_speed=0, height=0, movement={0,0}}
Code: Select all
local on_player_used_capsule = function(event)
if event.item.name == 'artillery-targeting-remote' then
local player = game.players[event.player_index]
local surface = player.surface
local flares = surface.find_entities_filtered{name = 'artillery-flare', position = event.position, force = player.force }
local flare
for _, f in pairs(flares) do
if f.position.x == event.position.x and f.position.y == event.position.y then
flare = f
break
end
end
if not flare then return end
flare.destroy()
flare = surface.create_entity{
name='artillery-flare',
position=event.position,
force=player.force,
frame_speed=0, vertical_speed=2147483648, height=2147483648, movement={0,0},
}
local targetbox = surface.create_entity{
name='highlight-box',
position=event.position,
bounding_box={{event.position.x-0.5,event.position.y-0.5},{event.position.x+0.5,event.position.y+0.5}},
box_type='not-allowed',
time_to_live=120,
blink_interval=5,
render_player_index=event.player_index,
}
end
end