1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-09 13:37:02 +02:00

overgrowth - fix crashes

This commit is contained in:
hanakocz 2020-02-24 07:17:31 +01:00 committed by GitHub
parent 4fb93c7695
commit 26fc4d261d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ require "modules.trees_randomly_die"
require "maps.overgrowth_map_info" require "maps.overgrowth_map_info"
require "functions.soft_reset" local Reset = require "functions.soft_reset"
local rpg_t = require 'modules.rpg' local rpg_t = require 'modules.rpg'
local kaboom = require "functions.omegakaboom" local kaboom = require "functions.omegakaboom"
@ -52,7 +52,7 @@ local starting_items = {
["pistol"] = 1, ["pistol"] = 1,
["firearm-magazine"] = 8 ["firearm-magazine"] = 8
} }
--[[
local function create_particles(surface, name, position, amount, cause_position) local function create_particles(surface, name, position, amount, cause_position)
local math_random = math.random local math_random = math.random
@ -80,8 +80,8 @@ local function create_particles(surface, name, position, amount, cause_position)
} }
}) })
end end
end end
]]
local function spawn_market(surface, position) local function spawn_market(surface, position)
local market = surface.create_entity({name = "market", position = position, force = "neutral"}) local market = surface.create_entity({name = "market", position = position, force = "neutral"})
--market.destructible = false --market.destructible = false
@ -139,7 +139,7 @@ function reset_map()
global.trees_grow_chunks_charted = {} global.trees_grow_chunks_charted = {}
global.trees_grow_chunks_charted_counter = 0 global.trees_grow_chunks_charted_counter = 0
global.current_surface = soft_reset_map(global.current_surface, get_surface_settings(), starting_items) global.current_surface = Reset.soft_reset_map(global.current_surface, get_surface_settings(), starting_items)
reset_difficulty_poll() reset_difficulty_poll()
@ -150,7 +150,7 @@ function reset_map()
game.map_settings.enemy_evolution.time_factor = difficulties_votes_evo[4] game.map_settings.enemy_evolution.time_factor = difficulties_votes_evo[4]
if rpg then rpg_reset_all_players() end if rpg then rpg_t.rpg_reset_all_players() end
end end
local function on_player_joined_game(event) local function on_player_joined_game(event)
@ -195,12 +195,12 @@ local function on_player_mined_entity(event)
trap(entity) trap(entity)
if event.player_index then if event.player_index then
create_particles(entity.surface, "wooden-particle", entity.position, 128, game.players[event.player_index].position) --create_particles(entity.surface, "wooden-particle", entity.position, 128, game.players[event.player_index].position)
game.players[event.player_index].insert({name = "coin", count = 1}) game.players[event.player_index].insert({name = "coin", count = 1})
return return
end end
create_particles(entity.surface, "wooden-particle", entity.position, 128) --create_particles(entity.surface, "wooden-particle", entity.position, 128)
if event.cause then if event.cause then
if event.cause.force.name == "enemy" then return end if event.cause.force.name == "enemy" then return end