mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-15 13:53:09 +02:00
commit
2589a68ad8
@ -83,7 +83,7 @@ local upgrade_functions = {
|
||||
local force = market.force
|
||||
local surface = market.surface
|
||||
local spawn_point = force.get_spawn_position(surface)
|
||||
this.spawn_point[player.name] = spawn_point
|
||||
this.spawn_point[player.index] = spawn_point
|
||||
surface.play_sound({path = 'utility/scenario_message', position = player.position, volume_modifier = 1})
|
||||
return false
|
||||
end
|
||||
|
@ -2,6 +2,11 @@ local table_insert = table.insert
|
||||
|
||||
local ScenarioTable = require 'maps.scrap_towny_ffa.table'
|
||||
local Event = require 'utils.event'
|
||||
|
||||
local function position_tostring(position)
|
||||
return '[x=' .. position.x .. ',y=' .. position.y .. ']'
|
||||
end
|
||||
|
||||
local upgrade_functions = {
|
||||
-- Upgrade Backpack
|
||||
[1] = function(player)
|
||||
@ -64,7 +69,7 @@ local upgrade_functions = {
|
||||
local position = player.position
|
||||
position = surface.find_non_colliding_position('character', position, 0, 0.25)
|
||||
if position ~= nil and player ~= nil then
|
||||
this.spawn_point[player.name] = {x = position.x, y = position.y}
|
||||
this.spawn_point[player.index] = {x = position.x, y = position.y}
|
||||
surface.play_sound({path = 'utility/scenario_message', position = player.position, volume_modifier = 1})
|
||||
else
|
||||
surface.create_entity(
|
||||
@ -179,8 +184,9 @@ local function refresh_offers(event)
|
||||
if market.name ~= 'crash-site-spaceship-market' then
|
||||
return
|
||||
end
|
||||
local position = market.position
|
||||
local spaceship = this.spaceships[position.x][position.y]
|
||||
|
||||
local key = position_tostring(market.position)
|
||||
local spaceship = this.spaceships[key]
|
||||
if not spaceship then
|
||||
return
|
||||
end
|
||||
@ -197,7 +203,8 @@ local function offer_purchased(event)
|
||||
if not upgrade_functions[offer_index] then
|
||||
return
|
||||
end
|
||||
local spaceship = this.spaceships[market.position.x][market.position.y]
|
||||
local key = position_tostring(market.position)
|
||||
local spaceship = this.spaceships[key]
|
||||
if not spaceship then
|
||||
return
|
||||
end
|
||||
@ -243,9 +250,10 @@ end
|
||||
|
||||
local function kill_spaceship(entity)
|
||||
local this = ScenarioTable.get_table()
|
||||
local spaceship = this.spaceships[entity.position.x][entity.position.y]
|
||||
local key = position_tostring(entity.position)
|
||||
local spaceship = this.spaceships[key]
|
||||
if spaceship ~= nil then
|
||||
this.spaceships[entity.position.x][entity.position.y] = nil
|
||||
this.spaceships[key] = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -172,7 +172,7 @@ function Public.get_new_spawn_point(player, surface)
|
||||
end
|
||||
end
|
||||
-- should never be invalid or blocked
|
||||
this.spawn_point[player.name] = position
|
||||
this.spawn_point[player.index] = position
|
||||
--log("player " .. player.name .. " assigned new spawn point at {" .. position.x .. "," .. position.y .. "}")
|
||||
return position
|
||||
end
|
||||
@ -180,7 +180,7 @@ end
|
||||
-- gets a new or existing spawn point for the player
|
||||
function Public.get_spawn_point(player, surface)
|
||||
local this = ScenarioTable.get_table()
|
||||
local position = this.spawn_point[player.name]
|
||||
local position = this.spawn_point[player.index]
|
||||
-- if there is a spawn point and less than three strikes
|
||||
if position ~= nil and this.strikes[player.name] < 3 then
|
||||
-- check that the spawn point is not blocked
|
||||
|
@ -20,7 +20,7 @@ local function on_entity_died(event)
|
||||
if not event.entity.valid then
|
||||
return
|
||||
end
|
||||
if event.entity.type ~= 'unit-spawner' then
|
||||
if event.entity.name ~= 'biter-spawner' then
|
||||
return
|
||||
end
|
||||
local e = math.ceil(Evolution.get_biter_evolution(event.entity) * 10)
|
||||
|
@ -245,11 +245,17 @@ local function set_player_to_rogue(player)
|
||||
log('player nil or not valid!')
|
||||
return
|
||||
end
|
||||
|
||||
player.force = 'rogue'
|
||||
local group = game.permissions.get_group('rogue')
|
||||
if group == nil then
|
||||
group = game.permissions.create_group('rogue')
|
||||
end
|
||||
|
||||
if not player.object_name == 'LuaPlayer' then
|
||||
log('Given object is not of LuaPlayer!')
|
||||
return
|
||||
end
|
||||
group.add_player(player)
|
||||
player.tag = '[Rogue]'
|
||||
Map.disable_world_map(player)
|
||||
|
Loading…
x
Reference in New Issue
Block a user