1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2025-01-10 00:28:22 +02:00

Trying to fix the weird bug with player name being a number. Changes to use player index in a LOT of places, probably introduced some new bugs. Changed gui tab to have text at the start. Change enemy bases to visibly die if being removed inside the player's spawn radius.

This commit is contained in:
Oarcinae 2019-08-16 11:30:19 -05:00
parent d08e149dfa
commit 6ba7fd8899
7 changed files with 110 additions and 92 deletions

View File

@ -212,6 +212,10 @@ script.on_event(defines.events.on_player_created, function(event)
InitOarcGuiTabs(player) InitOarcGuiTabs(player)
end) end)
script.on_event(defines.events.on_player_removed, function(event)
OarcEnemiesPlayerRemovedEvent(event)
end)
script.on_event(defines.events.on_player_respawned, function(event) script.on_event(defines.events.on_player_respawned, function(event)
SeparateSpawnsPlayerRespawned(event) SeparateSpawnsPlayerRespawned(event)

View File

@ -53,11 +53,12 @@ end
function CreateOarcGuiButton(player) function CreateOarcGuiButton(player)
if (mod_gui.get_button_flow(player).oarc_button == nil) then if (mod_gui.get_button_flow(player).oarc_button == nil) then
local b = mod_gui.get_button_flow(player).add{name="oarc_button", local b = mod_gui.get_button_flow(player).add{name="oarc_button",
caption="CLICK ME FOR MORE INFO",
type="sprite-button", type="sprite-button",
sprite="utility/expand_dots", -- sprite="utility/expand_dots",
style=mod_gui.button_style} style=mod_gui.button_style}
b.style.padding=2 b.style.padding=2
b.style.width=20 -- b.style.width=20
end end
end end
@ -86,6 +87,13 @@ function ClickOarcGuiButton(event)
local name = event.element.name local name = event.element.name
if (name ~= "oarc_button") then return end if (name ~= "oarc_button") then return end
if (event.element.caption ~= "") then
event.element.caption = ""
event.element.style.width = 20
event.element.sprite="utility/expand_dots"
end
if (not DoesOarcGuiExist(player)) then if (not DoesOarcGuiExist(player)) then
CreateOarcGuiTabsPane(player) CreateOarcGuiTabsPane(player)
else else

View File

@ -289,7 +289,11 @@ function ModifyEnemySpawnsNearPlayerStartingAreas(event)
-- No enemies inside safe radius! -- No enemies inside safe radius!
if (getDistance(enemy_pos, closest_spawn.pos) < global.ocfg.spawn_config.safe_area.safe_radius) then if (getDistance(enemy_pos, closest_spawn.pos) < global.ocfg.spawn_config.safe_area.safe_radius) then
if (event.entity.type == "unit-spawner") then
event.entity.die(game.forces["neutral"])
else
event.entity.destroy() event.entity.destroy()
end
-- Warn distance is all SMALL only. -- Warn distance is all SMALL only.
elseif (getDistance(enemy_pos, closest_spawn.pos) < global.ocfg.spawn_config.safe_area.warn_radius) then elseif (getDistance(enemy_pos, closest_spawn.pos) < global.ocfg.spawn_config.safe_area.warn_radius) then

View File

@ -5,7 +5,7 @@
-- This is what an attack request should look like: -- This is what an attack request should look like:
-- attack_request_example = { -- attack_request_example = {
-- target_player=player_name, -- REQUIRED (Player Name) -- target_player=player_index, -- REQUIRED (Player index)
-- target_type=TYPE, -- REQUIRED (OE_ATTACK_TYPE) -- target_type=TYPE, -- REQUIRED (OE_ATTACK_TYPE)
-- attempts=3, -- REQUIRED (Must be at least 1! Otherwise it won't do anything.) -- attempts=3, -- REQUIRED (Must be at least 1! Otherwise it won't do anything.)
-- process_stg=TYPE, -- REQUIRED (Normally starts with OE_PROCESS_STG_FIND_TARGET) -- process_stg=TYPE, -- REQUIRED (Normally starts with OE_PROCESS_STG_FIND_TARGET)
@ -81,7 +81,7 @@ function OarcEnemiesSectorScanned(event)
-- 1 in a X chance of triggering an attack on radars? -- 1 in a X chance of triggering an attack on radars?
if (math.random(1,global.oe_params.radar_scan_attack_chance) == 1) then if (math.random(1,global.oe_params.radar_scan_attack_chance) == 1) then
OarcEnemiesBuildingAttack(player.name, "radar") OarcEnemiesBuildingAttack(player.index, "radar")
end end
end end
@ -100,7 +100,7 @@ function OarcEnemiesRocketLaunched(event)
surface=silo.surface, surface=silo.surface,
target_pos=silo.position} target_pos=silo.position}
local rocket_launch_attack = {target_player = player_name, local rocket_launch_attack = {target_player = player.index,
target_type = OE_TARGET_TYPE_ENTITY, target_type = OE_TARGET_TYPE_ENTITY,
attempts=1, attempts=1,
process_stg=OE_PROCESS_STG_FIND_SPAWN, process_stg=OE_PROCESS_STG_FIND_SPAWN,
@ -114,7 +114,7 @@ end
function OarcEnemiesForceCreated(event) function OarcEnemiesForceCreated(event)
if (not event.force) then return end if (not event.force) then return end
global.oe.tech_levels[event.force.name] = 0 global.oe.tech_levels[event.force.index] = 0
end end
function CountForceTechCompleted(force) function CountForceTechCompleted(force)
@ -210,32 +210,30 @@ end
function OarcEnemiesResearchFinishedEvent(event) function OarcEnemiesResearchFinishedEvent(event)
if not (event.research and event.research.force) then return end if not (event.research and event.research.force) then return end
local force_name = event.research.force.name local force = event.research.force
if (global.oe.tech_levels[force_name] == nil) then if (global.oe.tech_levels[force.index] == nil) then
global.oe.tech_levels[force_name] = CountForceTechCompleted(game.forces[force_name]) global.oe.tech_levels[force.index] = CountForceTechCompleted(force)
else else
global.oe.tech_levels[force_name] = global.oe.tech_levels[force_name] + 1 global.oe.tech_levels[force.index] = global.oe.tech_levels[force.index] + 1
end end
-- Trigger an attack on science! -- Trigger an attack on science!
OarcEnemiesScienceLabAttack(event.research.force.name) OarcEnemiesScienceLabAttack(force.index)
end end
-- Attack science labs of a given force! -- Attack science labs of a given force!
function OarcEnemiesScienceLabAttack(force_name) function OarcEnemiesScienceLabAttack(force_index)
-- For each player (connected only), find a random science lab, -- For each player (connected only), find a random science lab,
for _,player in pairs(game.connected_players) do for _,player in pairs(game.forces[force_index].connected_players) do
if (player.force.name == force_name) then OarcEnemiesBuildingAttack(player.index, "lab")
OarcEnemiesBuildingAttack(player.name, "lab")
end
end end
end end
-- Request an attack on a given player's building type. -- Request an attack on a given player's building type.
function OarcEnemiesBuildingAttack(player_name, entity_type) function OarcEnemiesBuildingAttack(player_index, entity_type)
-- Make sure player exists and is connected. -- Make sure player exists and is connected.
if (not game.players[player_name] or if (not game.players[player_index] or
not game.players[player_name].connected) then return end not game.players[player_index].connected) then return end
-- Check we don't have too many ongoing attacks. -- Check we don't have too many ongoing attacks.
if (#global.oe.attacks >= OE_ATTACKS_MAX) then if (#global.oe.attacks >= OE_ATTACKS_MAX) then
@ -243,7 +241,7 @@ function OarcEnemiesBuildingAttack(player_name, entity_type)
return return
end end
local building_attack = {target_player = player_name, local building_attack = {target_player = player_index,
target_type = OE_TARGET_TYPE_BUILDING, target_type = OE_TARGET_TYPE_BUILDING,
attempts=3, attempts=3,
process_stg=OE_PROCESS_STG_FIND_TARGET, process_stg=OE_PROCESS_STG_FIND_TARGET,
@ -253,13 +251,13 @@ function OarcEnemiesBuildingAttack(player_name, entity_type)
end end
-- Attack a player's character -- Attack a player's character
function OarcEnemiesPlayerAttackCharacter(player_name) function OarcEnemiesPlayerAttackCharacter(player_index)
-- Validation checks. -- Validation checks.
if (not game.players[player_name] or if (not game.players[player_index] or
not game.players[player_name].connected or not game.players[player_index].connected or
not game.players[player_name].character or not game.players[player_index].character or
not game.players[player_name].character.valid) then not game.players[player_index].character.valid) then
log("OarcEnemiesPlayerAttackCharacter - player not connected or is dead?") log("OarcEnemiesPlayerAttackCharacter - player not connected or is dead?")
return return
end end
@ -271,7 +269,7 @@ function OarcEnemiesPlayerAttackCharacter(player_name)
end end
-- Create the attack request -- Create the attack request
local player_attack = {target_player = player_name, local player_attack = {target_player = player_index,
target_type = OE_TARGET_TYPE_PLAYER, target_type = OE_TARGET_TYPE_PLAYER,
attempts=3, attempts=3,
process_stg=OE_PROCESS_STG_FIND_TARGET} process_stg=OE_PROCESS_STG_FIND_TARGET}
@ -282,29 +280,37 @@ end
-- First time player init stuff -- First time player init stuff
function OarcEnemiesPlayerCreatedEvent(event) function OarcEnemiesPlayerCreatedEvent(event)
if (game.players[event.player_index] == nil) then return end if (game.players[event.player_index] == nil) then return end
local p_name = game.players[event.player_index].name
if (global.oe.player_timers[p_name] == nil) then if (global.oe.player_timers[event.player_index] == nil) then
global.oe.player_timers[p_name] = {character=GetRandomizedPlayerTimer(0, 60*10), global.oe.player_timers[event.player_index] = {character=GetRandomizedPlayerTimer(0, 60*10),
generic=GetRandomizedPlayerTimer(0, 0)} generic=GetRandomizedPlayerTimer(0, 0)}
end end
if (global.oe.buildings[p_name] == nil) then if (global.oe.buildings[event.player_index] == nil) then
global.oe.buildings[p_name] = {} global.oe.buildings[event.player_index] = {}
end end
local force = game.players[event.player_index].force local force = game.players[event.player_index].force
if (global.oe.tech_levels[force.name] == nil) then if (global.oe.tech_levels[force.index] == nil) then
global.oe.tech_levels[force.name] = CountForceTechCompleted(force) global.oe.tech_levels[force.index] = CountForceTechCompleted(force)
end end
-- Setup tracking of first time chat bubble displays -- Setup tracking of first time chat bubble displays
if (global.oe.player_sbubbles[p_name] == nil) then if (global.oe.player_sbubbles[event.player_index] == nil) then
global.oe.player_sbubbles[p_name] = {uh_oh=false, global.oe.player_sbubbles[event.player_index] = {uh_oh=false,
rocket=false} rocket=false}
end end
end end
function OarcEnemiesPlayerRemovedEvent(event)
if (game.players[event.player_index] == nil) then return end
global.oe.player_timers[event.player_index] = nil
global.oe.buildings[event.player_index] = nil
global.oe.player_sbubbles[event.player_index] = nil
end
function OarcEnemiesChunkGenerated(event) function OarcEnemiesChunkGenerated(event)
if (not event.area or not event.area.left_top) then if (not event.area or not event.area.left_top) then
log("ERROR - OarcEnemiesChunkGenerated") log("ERROR - OarcEnemiesChunkGenerated")
@ -491,19 +497,25 @@ function OarcEnemiesEntityDiedEvent(event)
-- If there is just a force, then just attack the area. -- If there is just a force, then just attack the area.
if (not event.cause) then if (not event.cause) then
if (event.force.name == "neutral") then return end -- Catch non-player destruction.
death_attack.process_stg = OE_PROCESS_STG_CREATE_GROUP death_attack.process_stg = OE_PROCESS_STG_CREATE_GROUP
death_attack.spawn_pos = event.entity.position death_attack.spawn_pos = event.entity.position
death_attack.target_type = OE_TARGET_TYPE_AREA death_attack.target_type = OE_TARGET_TYPE_AREA
death_attack.target_chunk = GetChunkPosFromTilePos(event.entity.position) death_attack.target_chunk = GetChunkPosFromTilePos(event.entity.position)
death_attack.evo,death_attack.size = GetEnemyGroup{player=nil, death_attack.evo,death_attack.size = GetEnemyGroup{player=nil,
force_name=event.force.name, force_index=event.force.index,
surface=game.surfaces[GAME_SURFACE_NAME], surface=game.surfaces[GAME_SURFACE_NAME],
target_pos=event.entity.position, target_pos=event.entity.position,
min_size=8,min_evo=0.25} min_size=8,min_evo=0.25}
-- If we have a cause, go attack that cause. -- If we have a cause, go attack that cause.
else else
if (event.cause.force.name == "neutral") then return end -- Catch non-player destruction.
local player = nil local player = nil
if (event.cause.type == "character") then if (event.cause.type == "character") then
player = event.cause.player player = event.cause.player
@ -515,13 +527,13 @@ function OarcEnemiesEntityDiedEvent(event)
-- if (not player or not player.connected) then return end -- if (not player or not player.connected) then return end
death_attack.process_stg = OE_PROCESS_STG_SPAWN_PATH_REQ death_attack.process_stg = OE_PROCESS_STG_SPAWN_PATH_REQ
death_attack.target_player = player.name death_attack.target_player = player.index
death_attack.target_type = OE_TARGET_TYPE_ENTITY death_attack.target_type = OE_TARGET_TYPE_ENTITY
death_attack.target_entity = event.cause death_attack.target_entity = event.cause
death_attack.target_chunk = GetChunkPosFromTilePos(player.character.position) death_attack.target_chunk = GetChunkPosFromTilePos(player.character.position)
death_attack.evo,death_attack.size = GetEnemyGroup{player=player, death_attack.evo,death_attack.size = GetEnemyGroup{player=player,
force_name=event.force.name, force_index=event.force.index,
surface=game.surfaces[GAME_SURFACE_NAME], surface=game.surfaces[GAME_SURFACE_NAME],
target_pos=event.entity.position, target_pos=event.entity.position,
min_size=8,min_evo=0.25} min_size=8,min_evo=0.25}
@ -562,31 +574,31 @@ function OarcEnemiesTrackBuildings(e)
return return
end end
if (global.oe.buildings[e.last_user.name] == nil) then if (global.oe.buildings[e.last_user.index] == nil) then
global.oe.buildings[e.last_user.name] = {} global.oe.buildings[e.last_user.index] = {}
end end
if (global.oe.buildings[e.last_user.name][e.type] == nil) then if (global.oe.buildings[e.last_user.index][e.type] == nil) then
global.oe.buildings[e.last_user.name][e.type] = {} global.oe.buildings[e.last_user.index][e.type] = {}
end end
table.insert(global.oe.buildings[e.last_user.name][e.type], e) table.insert(global.oe.buildings[e.last_user.index][e.type], e)
end end
end end
function GetRandomBuildingAny(player_name, entity_type_or_types) function GetRandomBuildingAny(player_index, entity_type_or_types)
if (type(entity_type_or_types) == "table") then if (type(entity_type_or_types) == "table") then
return GetRandomBuildingMultipleTypes(player_name, entity_type_or_types) return GetRandomBuildingMultipleTypes(player_index, entity_type_or_types)
else else
return GetRandomBuildingSingleType(player_name, entity_type_or_types) return GetRandomBuildingSingleType(player_index, entity_type_or_types)
end end
end end
function GetRandomBuildingMultipleTypes(player_name, entity_types) function GetRandomBuildingMultipleTypes(player_index, entity_types)
local rand_list = {} local rand_list = {}
for _,e_type in pairs(entity_types) do for _,e_type in pairs(entity_types) do
local rand_building = GetRandomBuildingSingleType(player_name, e_type) local rand_building = GetRandomBuildingSingleType(player_index, e_type)
if (rand_building) then if (rand_building) then
table.insert(rand_list, rand_building) table.insert(rand_list, rand_building)
end end
@ -598,7 +610,7 @@ function GetRandomBuildingMultipleTypes(player_name, entity_types)
end end
end end
function GetRandomBuildingSingleType(player_name, entity_type, count) function GetRandomBuildingSingleType(player_index, entity_type, count)
-- We only use this if there are lots of invalid entries, likely from destroyed buildings -- We only use this if there are lots of invalid entries, likely from destroyed buildings
local count_internal = 0 local count_internal = 0
@ -613,18 +625,18 @@ function GetRandomBuildingSingleType(player_name, entity_type, count)
return nil return nil
end end
if (not global.oe.buildings[player_name][entity_type] or if (not global.oe.buildings[player_index][entity_type] or
(#global.oe.buildings[player_name][entity_type] == 0)) then (#global.oe.buildings[player_index][entity_type] == 0)) then
-- log("GetRandomBuildingSingleType - none found " .. entity_type) -- log("GetRandomBuildingSingleType - none found " .. entity_type)
return nil return nil
end end
local rand_key = GetRandomKeyFromTable(global.oe.buildings[player_name][entity_type]) local rand_key = GetRandomKeyFromTable(global.oe.buildings[player_index][entity_type])
local random_building = global.oe.buildings[player_name][entity_type][rand_key] local random_building = global.oe.buildings[player_index][entity_type][rand_key]
if (not random_building or not random_building.valid) then if (not random_building or not random_building.valid) then
table.remove(global.oe.buildings[player_name][entity_type], rand_key) table.remove(global.oe.buildings[player_index][entity_type], rand_key)
return GetRandomBuildingSingleType(player_name, entity_type, count_internal-1) return GetRandomBuildingSingleType(player_index, entity_type, count_internal-1)
else else
return random_building return random_building
end end

View File

@ -148,7 +148,7 @@ function GetTechLevelEvoSize(tech_level)
end end
-- Get the evo and size given optional params -- Get the evo and size given optional params
-- args = {player, force_name, surface, target_pos, min_evo, max_eevo, min_size, max_size} -- args = {player, force_index, surface, target_pos, min_evo, max_eevo, min_size, max_size}
function GetEnemyGroup(args) function GetEnemyGroup(args)
-- Default values -- Default values
@ -162,7 +162,7 @@ function GetEnemyGroup(args)
-- Given a player, use that for time played AND for player force. -- Given a player, use that for time played AND for player force.
if (args.player and args.player.connected) then if (args.player and args.player.connected) then
local ticks_online = args.player.online_time local ticks_online = args.player.online_time
local tech_levels = global.oe.tech_levels[args.player.force.name] local tech_levels = global.oe.tech_levels[args.player.force.index]
e,s = GetPlayerTimeEvoSize(ticks_online) e,s = GetPlayerTimeEvoSize(ticks_online)
evo = evo + e evo = evo + e
@ -173,8 +173,8 @@ function GetEnemyGroup(args)
size = size + s size = size + s
-- Support only force given, no player (should be RARE) -- Support only force given, no player (should be RARE)
elseif (args.force_name) then elseif (args.force_index) then
local tech_levels = global.oe.tech_levels[args.force_name] local tech_levels = global.oe.tech_levels[args.force_index]
e,s = GetTechLevelEvoSize(tech_levels) e,s = GetTechLevelEvoSize(tech_levels)
evo = evo + e evo = evo + e

View File

@ -28,12 +28,10 @@ local function ExpandOarcEnemiesGui(player)
frame.add{type="button", caption="Turret Attack", name="oe_attack_turret"} frame.add{type="button", caption="Turret Attack", name="oe_attack_turret"}
local oe_info="General Info:" .. "\n" .. local oe_info="General Info:" .. "\n" ..
-- "Units: " .. #global.oe.units .. "\n" ..
"Attacks: " .. #global.oe.attacks .. "\n" .. "Attacks: " .. #global.oe.attacks .. "\n" ..
-- "Labs: " .. #global.oe.science_labs[player.name] .. "\n" .. "Tech levels: " .. global.oe.tech_levels[player.force.index] .. "\n" ..
"Tech levels: " .. global.oe.tech_levels[player.force.name] .. "\n" .. "Next Player Attack: " .. global.oe.player_timers[player.index]["character"] .. "\n" ..
"Next Player Attack: " .. global.oe.player_timers[player.name]["character"] .. "\n" .. "Next Building Attack: " .. global.oe.player_timers[player.index]["generic"] ..
"Next Building Attack: " .. global.oe.player_timers[player.name]["generic"] ..
" " " "
AddLabel(frame, "oe_info", oe_info, my_longer_label_style) AddLabel(frame, "oe_info", oe_info, my_longer_label_style)
end end
@ -49,35 +47,27 @@ function OarcEnemiesGuiClick(event)
end end
if (name == "oe_attack_player") then if (name == "oe_attack_player") then
OarcEnemiesPlayerAttackCharacter(player.name) OarcEnemiesPlayerAttackCharacter(player.index)
end end
if (name == "oe_attack_any") then if (name == "oe_attack_any") then
OarcEnemiesBuildingAttack(player.name, {"ammo-turret", OarcEnemiesBuildingAttack(player.index, OE_GENERIC_TARGETS)
"electric-turret",
"fluid-turret",
"artillery-turret",
"mining-drill",
"furnace",
"reactor",
"assembling-machine",
"generator"})
end end
if (name == "oe_attack_labs") then if (name == "oe_attack_labs") then
OarcEnemiesScienceLabAttack(player.force.name) OarcEnemiesScienceLabAttack(player.force.index)
end end
if (name == "oe_attack_furnace") then if (name == "oe_attack_furnace") then
OarcEnemiesBuildingAttack(player.name, "furnace") OarcEnemiesBuildingAttack(player.index, "furnace")
end end
if (name == "oe_attack_mining") then if (name == "oe_attack_mining") then
OarcEnemiesBuildingAttack(player.name, "mining-drill") OarcEnemiesBuildingAttack(player.index, "mining-drill")
end end
if (name == "oe_attack_turret") then if (name == "oe_attack_turret") then
OarcEnemiesBuildingAttack(player.name, {"ammo-turret", OarcEnemiesBuildingAttack(player.index, {"ammo-turret",
"electric-turret", "electric-turret",
"fluid-turret", "fluid-turret",
"artillery-turret"}) "artillery-turret"})

View File

@ -122,22 +122,22 @@ function ProcessAttackCleanupInvalidGroups(key, attack)
end end
function ProcessPlayerTimersEverySecond() function ProcessPlayerTimersEverySecond()
for name,timer_table in pairs(global.oe.player_timers) do for p_index,timer_table in pairs(global.oe.player_timers) do
if (game.players[name] and game.players[name].connected) then if (game.players[p_index] and game.players[p_index].connected) then
for timer_name,timer in pairs(timer_table) do for timer_name,timer_val in pairs(timer_table) do
if (timer > 0) then if (timer_val > 0) then
global.oe.player_timers[name][timer_name] = timer-1 global.oe.player_timers[p_index][timer_name] = timer_val-1
else else
if (timer_name == "character") then if (timer_name == "character") then
OarcEnemiesPlayerAttackCharacter(name) OarcEnemiesPlayerAttackCharacter(p_index)
global.oe.player_timers[name][timer_name] = global.oe.player_timers[p_index][timer_name] =
GetRandomizedPlayerTimer(game.players[name].online_time/TICKS_PER_SECOND, 0) GetRandomizedPlayerTimer(game.players[p_index].online_time/TICKS_PER_SECOND, 0)
elseif (timer_name == "generic") then elseif (timer_name == "generic") then
OarcEnemiesBuildingAttack(name, OE_GENERIC_TARGETS) OarcEnemiesBuildingAttack(p_index, OE_GENERIC_TARGETS)
global.oe.player_timers[name][timer_name] = global.oe.player_timers[p_index][timer_name] =
GetRandomizedPlayerTimer(game.players[name].online_time/TICKS_PER_SECOND, 0) GetRandomizedPlayerTimer(game.players[p_index].online_time/TICKS_PER_SECOND, 0)
end end
end end
end end
@ -171,7 +171,7 @@ function ProcessAttackFindTarget(key, attack)
global.oe.attacks[key].target_entity = random_building global.oe.attacks[key].target_entity = random_building
local e,s = GetEnemyGroup{player=player, local e,s = GetEnemyGroup{player=player,
force_name=player.force.name, force_index=player.force.index,
surface=game.surfaces[GAME_SURFACE_NAME], surface=game.surfaces[GAME_SURFACE_NAME],
target_pos=random_building.position} target_pos=random_building.position}
@ -190,7 +190,7 @@ function ProcessAttackFindTarget(key, attack)
global.oe.attacks[key].target_entity = player.character global.oe.attacks[key].target_entity = player.character
local e,s = GetEnemyGroup{player=player, local e,s = GetEnemyGroup{player=player,
force_name=player.force.name, force_index=player.force.index,
surface=game.surfaces[GAME_SURFACE_NAME], surface=game.surfaces[GAME_SURFACE_NAME],
target_pos=player.character.position} target_pos=player.character.position}