I'm working on a mod onboard_computer and I would like to allow a non-player entity to attack a position.
Ex:
Code: Select all
-- car is an entity type="car" (car, tank...)
-- player is the player who started the script
car.passenger = car.surface.create_entity({
name = "player",
force = player.force,
position = car.position,
source = player.character,
fast_replace = true,
player = player
})
-- position is a position where an enemy has been detected
car.passenger.shooting_state = {
state = defines.shooting.shooting_selected,
position = position
}
Do I do it wrong?
(Another subject also raised the concern: viewtopic.php?f=34&t=51354)