You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2026-06-20 16:32:28 +02:00
Various Fixes
This commit is contained in:
+3
-3
@@ -8,16 +8,16 @@ require "player_list"
|
||||
require "poll"
|
||||
require "score"
|
||||
|
||||
--require "maps.tools.cheat_mode"
|
||||
require "maps.tools.cheat_mode"
|
||||
|
||||
---- enable maps here ----
|
||||
--require "maps.biter_battles"
|
||||
require "maps.cave_miner"
|
||||
--require "maps.cave_miner"
|
||||
--require "maps.deep_jungle"
|
||||
--require "maps.lost_desert"
|
||||
--require "maps.labyrinth"
|
||||
--require "maps.spaghettorio"
|
||||
--require "maps.spiral_troopers"
|
||||
require "maps.spiral_troopers"
|
||||
--require "maps.empty_map"
|
||||
-----------------------------
|
||||
|
||||
|
||||
+12
-8
@@ -95,6 +95,14 @@ for x = 111, 200, 1 do
|
||||
y = y + 1
|
||||
end
|
||||
|
||||
local function shuffle(tbl)
|
||||
local size = #tbl
|
||||
for i = size, 1, -1 do
|
||||
local rand = math.random(size)
|
||||
tbl[i], tbl[rand] = tbl[rand], tbl[i]
|
||||
end
|
||||
return tbl
|
||||
end
|
||||
|
||||
local function create_cave_miner_button(player)
|
||||
if player.gui.top["caver_miner_stats_toggle_button"] then player.gui.top["caver_miner_stats_toggle_button"].destroy() end
|
||||
@@ -466,6 +474,8 @@ local function secret_shop(pos)
|
||||
{price = {{"raw-fish", math.random(200,350)}}, offer = {type = 'give-item', item = 'fast-loader'}},
|
||||
{price = {{"raw-fish", math.random(400,600)}}, offer = {type = 'give-item', item = 'express-loader'}}
|
||||
}
|
||||
secret_market_items = shuffle(secret_market_items)
|
||||
|
||||
local surface = game.surfaces[1]
|
||||
local market = surface.create_entity {name = "market", position = pos}
|
||||
market.destructible = false
|
||||
@@ -473,14 +483,8 @@ local function secret_shop(pos)
|
||||
market.add_market_item({price = {}, offer = {type = 'nothing', effect_description = 'Withdraw Fish - 2% Bank Fee'}})
|
||||
market.add_market_item({price = {}, offer = {type = 'nothing', effect_description = 'Show Account Balance'}})
|
||||
|
||||
local market_items_to_add = math.random(8,12)
|
||||
while market_items_to_add >= 0 do
|
||||
local i = math.random(1,#secret_market_items)
|
||||
if secret_market_items[i] then
|
||||
market.add_market_item(secret_market_items[i])
|
||||
market_items_to_add = market_items_to_add - 1
|
||||
secret_market_items[i] = nil
|
||||
end
|
||||
for i = 1, math.random(8,12), 1 do
|
||||
market.add_market_item(secret_market_items[i])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+1
-1
@@ -408,7 +408,7 @@ local function on_gui_click(event)
|
||||
end
|
||||
end
|
||||
|
||||
--Poke other players
|
||||
--Poke other players
|
||||
if string.sub(event.element.name, 1, 11) == "poke_player" then
|
||||
local poked_player = string.sub(event.element.name, 13, string.len(event.element.name))
|
||||
if player.name == poked_player then return end
|
||||
|
||||
+2
-1
@@ -54,7 +54,7 @@ local rewards_loot = {
|
||||
|
||||
local function create_reward_button(player)
|
||||
if not player.gui.top.rewards then
|
||||
local button = player.gui.top.add({ type = "sprite-button", name = "rewards", sprite = "item/submachine-gun" })
|
||||
local b = player.gui.top.add({ type = "sprite-button", name = "rewards", sprite = "item/submachine-gun" })
|
||||
b.style.minimal_height = 38
|
||||
b.style.minimal_width = 38
|
||||
b.style.top_padding = 2
|
||||
@@ -177,6 +177,7 @@ local function reward_messages(data)
|
||||
end
|
||||
|
||||
local function kill_rewards(event)
|
||||
if not event.cause then return end
|
||||
local player = event.cause.player
|
||||
local pinsert = player.insert
|
||||
local score = global.score[player.force.name]
|
||||
|
||||
@@ -330,7 +330,7 @@ local function on_entity_died(event)
|
||||
local proximity_list = {}
|
||||
|
||||
-- Handles worm kills with no cause
|
||||
if event.entity.type == "turret" and string.find(event.entity.name, "worm") then
|
||||
if event.entity.type == "turret" then --------------
|
||||
local radius = 24
|
||||
local position = event.entity.position
|
||||
local insert = table.insert
|
||||
@@ -344,23 +344,29 @@ local function on_entity_died(event)
|
||||
|
||||
-- Unit/Spawner Kills
|
||||
if event.entity.type == "unit" or event.entity.type == "unit-spawner" then
|
||||
if event.cause.name then player = event.cause.player end
|
||||
--Check for passengers
|
||||
if event.cause.type == "car" then
|
||||
if event.cause then
|
||||
|
||||
if event.cause.name == "player" then player = event.cause.player end
|
||||
|
||||
--Check for passengers
|
||||
if event.cause.type == "car" then
|
||||
player = event.cause.get_driver()
|
||||
passenger = event.cause.get_passenger()
|
||||
if player then player = player.player end
|
||||
if passenger then passenger = passenger.player end
|
||||
end
|
||||
if event.cause.type == "locomotive" then
|
||||
player = event.cause.get_driver()
|
||||
passenger = event.cause.get_passenger()
|
||||
if player then player = player.player end
|
||||
if passenger then passenger = passenger.player end
|
||||
train_passengers = event.cause.train.passengers
|
||||
end
|
||||
|
||||
if not train_passengers and not passenger and not player then return end
|
||||
if event.cause.force.name == event.entity.force.name then return end
|
||||
init_player_table(player)
|
||||
if not global.score[event.force.name] then global.score[event.force.name] = {} end
|
||||
if not global.score[event.force.name].players then global.score[event.force.name].players = {} end
|
||||
if not global.score[event.force.name].players then global.score[event.force.name].players[player.name] = {} end
|
||||
end
|
||||
if event.cause.type == "locomotive" then
|
||||
player = event.cause.get_driver()
|
||||
train_passengers = event.cause.train.passengers
|
||||
end
|
||||
if not train_passengers and not passenger and not player then return end
|
||||
if event.cause.force.name == event.entity.force.name then return end
|
||||
if not global.score[event.force.name] then global.score[event.force.name] = {} end
|
||||
if not global.score[event.force.name].players then global.score[event.force.name].players = {} end
|
||||
if not global.score[event.force.name].players then global.score[event.force.name].players[player.name] = {} end
|
||||
end
|
||||
|
||||
if score_table[event.entity.name] then
|
||||
|
||||
Reference in New Issue
Block a user