mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-05-13 21:56:29 +02:00
Artillery Remote History
This commit is contained in:
parent
ed0d43757e
commit
01e5b4114f
@ -122,6 +122,22 @@ local function on_built_entity(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_player_used_capsule(event)
|
||||
local player = game.players[event.player_index]
|
||||
local position = event.position
|
||||
local used_item = event.item
|
||||
if used_item.name == "artillery-targeting-remote" then
|
||||
if not global.artillery_history then global.artillery_history = {} end
|
||||
if #global.artillery_history > 999 then global.artillery_history = {} end
|
||||
local str = player.name .. " at X:"
|
||||
str = str .. math.floor(position.x)
|
||||
str = str .. " Y:"
|
||||
str = str .. math.floor(position.y)
|
||||
table.insert(global.artillery_history, str)
|
||||
end
|
||||
end
|
||||
|
||||
event.add(defines.events.on_player_used_capsule, on_player_used_capsule)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
event.add(defines.events.on_player_promoted, on_player_promoted)
|
||||
event.add(defines.events.on_player_demoted, on_player_demoted)
|
||||
|
@ -223,17 +223,36 @@ local function create_admin_panel(player)
|
||||
button.style.minimal_width = 80
|
||||
end
|
||||
|
||||
if global.landfill_history then
|
||||
|
||||
if global.landfill_history or global.artillery_history then
|
||||
local l = frame.add({type = "label", caption = "----------------------------------------------"})
|
||||
local l = frame.add({type = "label", caption = "Landfill History:"})
|
||||
end
|
||||
|
||||
local t = frame.add({type = "table", column_count = 2})
|
||||
|
||||
if global.landfill_history then
|
||||
local tt = t.add({type = "table", column_count = 1})
|
||||
local l = tt.add({type = "label", caption = "Landfill History:"})
|
||||
l.style.font = "default-listbox"
|
||||
l.style.font_color = { r=0.98, g=0.66, b=0.22}
|
||||
local scroll_pane = frame.add({ type = "scroll-pane", direction = "vertical", horizontal_scroll_policy = "never", vertical_scroll_policy = "auto"})
|
||||
local scroll_pane = tt.add({ type = "scroll-pane", direction = "vertical", horizontal_scroll_policy = "never", vertical_scroll_policy = "auto"})
|
||||
scroll_pane.style.maximal_height = 160
|
||||
for i = #global.landfill_history, 1, -1 do
|
||||
scroll_pane.add({type = "label", caption = global.landfill_history[i]})
|
||||
end
|
||||
end
|
||||
|
||||
if global.artillery_history then
|
||||
local tt = t.add({type = "table", column_count = 1})
|
||||
local l = tt.add({type = "label", caption = "Artillery History:"})
|
||||
l.style.font = "default-listbox"
|
||||
l.style.font_color = { r=0.98, g=0.66, b=0.22}
|
||||
local scroll_pane = tt.add({ type = "scroll-pane", direction = "vertical", horizontal_scroll_policy = "never", vertical_scroll_policy = "auto"})
|
||||
scroll_pane.style.maximal_height = 160
|
||||
for i = #global.artillery_history, 1, -1 do
|
||||
scroll_pane.add({type = "label", caption = global.artillery_history[i]})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local admin_functions = {
|
||||
|
@ -9,7 +9,7 @@ require "player_list"
|
||||
require "poll"
|
||||
require "score"
|
||||
|
||||
--require "maps.tools.cheat_mode"
|
||||
require "maps.tools.cheat_mode"
|
||||
|
||||
---- enable maps here ----
|
||||
--require "maps.biter_battles"
|
||||
|
@ -194,7 +194,9 @@ local function create_biter_battle_menu(player)
|
||||
show_mvps(player)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if player.gui.left["biter_battle_menu"] then player.gui.left["biter_battle_menu"].destroy() end
|
||||
|
||||
local frame = player.gui.left.add { type = "frame", name = "biter_battle_menu", direction = "vertical" }
|
||||
|
||||
if player.force.name == "north" or player.force.name == "south" then
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- fish defense -- by mewmew --
|
||||
-- fish defender -- by mewmew --
|
||||
|
||||
local event = require 'utils.event'
|
||||
require "maps.fish_defender_map_intro"
|
||||
@ -702,7 +702,11 @@ local function on_player_joined_game(event)
|
||||
global.wave_grace_period = global.wave_grace_period - 3600
|
||||
if global.wave_grace_period <= 0 then global.wave_grace_period = nil end
|
||||
end
|
||||
create_wave_gui(player)
|
||||
create_wave_gui(player)
|
||||
|
||||
if game.tick > 900 then
|
||||
is_game_lost()
|
||||
end
|
||||
end
|
||||
|
||||
local map_height = 96
|
||||
@ -771,7 +775,29 @@ local function on_chunk_generated(event)
|
||||
end
|
||||
end
|
||||
global.spawn_ores_generated = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if left_top.x <= -256 then
|
||||
if math_random(1, 24) == 1 then
|
||||
local positions = {}
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
insert(positions, {x = left_top.x + x, y = left_top.y + y})
|
||||
end
|
||||
end
|
||||
positions = shuffle(positions)
|
||||
for _, pos in pairs(positions) do
|
||||
if surface.can_place_entity({name = "biter-spawner", force = "enemy", position = pos}) then
|
||||
if math_random(1,4) == 1 then
|
||||
local entity = surface.create_entity({name = "spitter-spawner", force = "enemy", position = pos})
|
||||
else
|
||||
local entity = surface.create_entity({name = "biter-spawner", force = "enemy", position = pos})
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local tiles = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user