mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-10 00:43:27 +02:00
commit
8bb71c4d49
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -15,7 +15,7 @@
|
||||
|
||||
global.table_of_properties = {}
|
||||
|
||||
global.table_of_properties.required_number_of_players = 1
|
||||
global.table_of_properties.required_number_of_players = 2
|
||||
|
||||
global.table_of_properties.countdown_in_seconds = 28800
|
||||
|
||||
@ -37,13 +37,19 @@
|
||||
|
||||
global.table_of_spots = {}
|
||||
|
||||
global.table_of_spawns = {}
|
||||
|
||||
global.table_of_squads = {}
|
||||
|
||||
global.table_of_circles = {}
|
||||
global.table_of_drawings = {}
|
||||
|
||||
global.table_of_delays = {}
|
||||
|
||||
local table_of_colors = { squad = { r = 75, g = 155, b = 45 }, team = { r = 65, g = 120, b = 200 }, enemy = { r = 190, g = 55, b = 50 }, neutral = { r = 77, g = 77, b = 77 }, damage = { r = 255, g = 0, b = 255 }, white = { r = 255, g = 255, b = 255 } }
|
||||
|
||||
local table_of_loots = { { name = 'piercing-rounds-magazine', count = 50 }, { name = 'uranium-rounds-magazine', count = 50 }, { name = 'combat-shotgun', count = 1 }, { name = 'shotgun-shell', count = 20 }, { name = 'piercing-shotgun-shell', count = 20 }, { name = 'flamethrower', count = 1 }, { name = 'flamethrower-ammo', count = 50 }, { name = 'rocket-launcher', count = 1 }, { name = 'rocket', count = 10 }, { name = 'explosive-rocket', count = 20 }, { name = 'grenade', count = 40 }, { name = 'cluster-grenade', count = 20 }, { name = 'cannon-shell', count = 8 }, { name = 'explosive-cannon-shell', count = 8 }, { name = 'uranium-cannon-shell', count = 8 }, { name = 'explosive-uranium-cannon-shell', count = 8 }, { name = 'modular-armor', count = 1 }, { name = 'power-armor', count = 1 }, { name = 'power-armor-mk2', count = 1 }, { name = 'exoskeleton-equipment', count = 1 }, { name = 'battery-mk2-equipment', count = 1 }, { name = 'energy-shield-equipment', count = 1 }, { name = 'fusion-reactor-equipment', count = 1 }, { name = 'solid-fuel', count = 50 }, { name = 'rocket-fuel', count = 10 }, { name = 'nuclear-fuel', count = 1 }, { name = 'gate', count = 20 }, { name = 'stone-wall', count = 40 } }
|
||||
local table_of_loots = { { name = 'iron-ore', count = 50 }, { name = 'copper-ore', count = 50 }, { name = 'stone', count = 50 }, { name = 'coal', count = 50 }, { name = 'defender-capsule', count = 10 }, { name = 'land-mine', count = 20 }, { name = 'gun-turret', count = 5 }, { name = 'piercing-rounds-magazine', count = 50 }, { name = 'uranium-rounds-magazine', count = 10 }, { name = 'combat-shotgun', count = 1 }, { name = 'shotgun-shell', count = 20 }, { name = 'piercing-shotgun-shell', count = 20 }, { name = 'flamethrower', count = 1 }, { name = 'flamethrower-ammo', count = 20 }, { name = 'rocket-launcher', count = 1 }, { name = 'rocket', count = 20 }, { name = 'explosive-rocket', count = 10 }, { name = 'atomic-bomb', count = 1 }, { name = 'grenade', count = 20 }, { name = 'cluster-grenade', count = 10 }, { name = 'cannon-shell', count = 20 }, { name = 'explosive-cannon-shell', count = 10 }, { name = 'uranium-cannon-shell', count = 5 }, { name = 'explosive-uranium-cannon-shell', count = 5 }, { name = 'modular-armor', count = 1 }, { name = 'power-armor', count = 1 }, { name = 'power-armor-mk2', count = 1 }, { name = 'exoskeleton-equipment', count = 1 }, { name = 'battery-mk2-equipment', count = 1 }, { name = 'energy-shield-equipment', count = 1 }, { name = 'fusion-reactor-equipment', count = 1 }, { name = 'solid-fuel', count = 20 }, { name = 'rocket-fuel', count = 10 }, { name = 'nuclear-fuel', count = 1 }, { name = 'gate', count = 10 }, { name = 'stone-wall', count = 20 } }
|
||||
|
||||
local table_of_slots = { 'stone-wall', 'gun-turret', 'wood', 'repair-pack', 'raw-fish', 'defender-capsule', 'rocket', 'explosive-rocket', 'atomic-bomb', 'flamethrower-ammo', 'land-mine', 'firearm-magazine', 'piercing-rounds-magazine', 'uranium-rounds-magazine', 'grenade', 'cluster-grenade', 'cannon-shell', 'explosive-cannon-shell', 'uranium-cannon-shell', 'explosive-uranium-cannon-shell' }
|
||||
|
||||
local table_of_ores = { 'iron-ore', 'copper-ore', 'stone', 'coal' }
|
||||
|
||||
@ -51,57 +57,52 @@
|
||||
|
||||
local event = require 'utils.event'
|
||||
|
||||
local map_intro = [[
|
||||
- - - T A N K C O N Q U E S T - - -
|
||||
local map_intro = [[ - - - T A N K C O N Q U E S T - - -
|
||||
|
||||
Your objective is to defend your team's tickets and withdraw the tickets from the
|
||||
other team as quickly as possible.
|
||||
When the round is running, the ticket overview is shown in the header. Your objective
|
||||
is to defend your team's tickets and withdraw the tickets from the opposing team as
|
||||
quickly as possible.
|
||||
|
||||
There are two ways to withdraw the tickets from the opposing team. First, by killing
|
||||
the player and second, by taking the spots. A spot withdraw 0.05 tickets per second
|
||||
from the opposing team.
|
||||
|
||||
The battlefield has two special features: First, there is a point of interest in the
|
||||
north and south. And second, there are loot boxes scattered throughout the battlefield.
|
||||
|
||||
PvP battles and the conquest of the spots are the deciding factor to win the round.
|
||||
|
||||
Each force has a number of tickets. Per conquered spot, 0.05 tickets are deducted
|
||||
per second. If a player loses his life, 1 ticket is deducted from his own force.
|
||||
|
||||
The battlefield is created when at least two players are online.
|
||||
|
||||
There is no biter evolution from pollution, time or destruction.
|
||||
]]
|
||||
There is no biter evolution from pollution, time or destruction.]]
|
||||
|
||||
local function draw_gui_map_intro_button( player )
|
||||
local function draw_gui_intro_button( player )
|
||||
|
||||
if player.gui.top[ 'map_intro_button' ] then return end
|
||||
if player.gui.top[ 'draw_gui_intro_button' ] then return end
|
||||
|
||||
local element_button = player.gui.top.add( { type = 'sprite-button', caption = '?', name = 'map_intro_button', tooltip = 'Map Intro' } )
|
||||
local element_button = player.gui.top.add( { type = 'sprite-button', name = 'draw_gui_intro_button', caption = '?', tooltip = 'Map Intro' } )
|
||||
|
||||
element_button.style.width = 38
|
||||
|
||||
element_button.style.height = 38
|
||||
|
||||
element_button.style.font_color = { r = 0.5, g = 0.3, b = 0.99 }
|
||||
|
||||
element_button.style.font = 'heading-1'
|
||||
|
||||
element_button.style.minimal_height = 38
|
||||
|
||||
element_button.style.minimal_width = 38
|
||||
|
||||
element_button.style.top_padding = 1
|
||||
|
||||
element_button.style.left_padding = 1
|
||||
|
||||
element_button.style.right_padding = 1
|
||||
|
||||
element_button.style.bottom_padding = 1
|
||||
|
||||
end
|
||||
|
||||
local function draw_gui_map_intro( player )
|
||||
local function draw_gui_intro_frame( player )
|
||||
|
||||
if player.gui.center[ 'map_intro_frame' ] then player.gui.center[ 'map_intro_frame' ].destroy() end
|
||||
if player.gui.center[ 'draw_gui_intro_frame' ] then player.gui.center[ 'draw_gui_intro_frame' ].destroy() end
|
||||
|
||||
local element_frame = player.gui.center.add { type = 'frame', name = 'map_intro_frame', direction = 'vertical' }
|
||||
local element_frame = player.gui.center.add( { type = 'frame', name = 'draw_gui_intro_frame', direction = 'vertical' } )
|
||||
|
||||
local element_frame = element_frame.add { type = 'frame' }
|
||||
element_frame = element_frame.add( { type = 'frame' } )
|
||||
|
||||
local element_label = element_frame.add { type = 'label', caption = map_intro, name = 'map_intro_text' }
|
||||
local element_label = element_frame.add( { type = 'label', name = 'draw_gui_intro_content', caption = map_intro } )
|
||||
|
||||
element_label.style.top_padding = 10
|
||||
element_label.style.top_padding = 15
|
||||
|
||||
element_label.style.single_line = false
|
||||
|
||||
@ -133,13 +134,9 @@
|
||||
|
||||
force.set_cease_fire( 'player', true )
|
||||
|
||||
force.friendly_fire = false
|
||||
|
||||
force.share_chart = true
|
||||
|
||||
local force = game.forces.force_player_two
|
||||
|
||||
if global.table_of_properties[ force.name ] == nil then global.table_of_properties[ force.name ] = { name = force.name, enemy = 'force_player_one', icon = '☣', available_tickets = global.table_of_properties.amount_of_tickets } end
|
||||
if global.table_of_properties[ force.name ] == nil then global.table_of_properties[ force.name ] = { name = force.name, enemy = 'force_player_one', icon = '☢', available_tickets = global.table_of_properties.amount_of_tickets } end
|
||||
|
||||
force.set_friend( 'force_biter_one', true )
|
||||
|
||||
@ -147,10 +144,6 @@
|
||||
|
||||
force.set_cease_fire( 'player', true )
|
||||
|
||||
force.friendly_fire = false
|
||||
|
||||
force.share_chart = true
|
||||
|
||||
local force = game.forces[ 'force_biter_one' ]
|
||||
|
||||
force.set_friend( 'force_player_two', true )
|
||||
@ -161,8 +154,6 @@
|
||||
|
||||
force.set_friend( 'player', true )
|
||||
|
||||
force.share_chart = false
|
||||
|
||||
local force = game.forces[ 'force_biter_two' ]
|
||||
|
||||
force.set_friend( 'force_player_one', true )
|
||||
@ -173,8 +164,6 @@
|
||||
|
||||
force.set_friend( 'player', true )
|
||||
|
||||
force.share_chart = false
|
||||
|
||||
local force = game.forces.force_spectator
|
||||
|
||||
force.set_spawn_position( { x = 0, y = 0 }, game.surfaces.nauvis )
|
||||
@ -193,8 +182,6 @@
|
||||
|
||||
force.set_cease_fire( 'enemy', true )
|
||||
|
||||
force.share_chart = true
|
||||
|
||||
local force = game.forces[ 'player' ]
|
||||
|
||||
force.set_cease_fire( 'force_player_one', true )
|
||||
@ -207,8 +194,6 @@
|
||||
|
||||
force.set_cease_fire( 'force_spectator', true )
|
||||
|
||||
force.share_chart = false
|
||||
|
||||
local spectator = game.permissions.create_group( 'permission_spectator' )
|
||||
|
||||
for action_name, _ in pairs( defines.input_action ) do spectator.set_allows_action( defines.input_action[ action_name ], false ) end
|
||||
@ -225,6 +210,8 @@
|
||||
|
||||
game.forces[ force.name ].technologies[ 'artillery-shell-speed-1' ].enabled = false
|
||||
|
||||
game.forces[ force.name ].technologies[ 'follower-robot-count-1' ].researched = true
|
||||
|
||||
game.forces[ force.name ].technologies[ 'atomic-bomb' ].enabled = false
|
||||
|
||||
game.forces[ force.name ].set_turret_attack_modifier( 'flamethrower-turret', 4 )
|
||||
@ -233,10 +220,16 @@
|
||||
|
||||
game.forces[ force.name ].set_turret_attack_modifier( 'gun-turret', 4 )
|
||||
|
||||
-- game.forces[ force.name ].set_ammo_damage_modifier( 'cannon-shell', - 0.2 )
|
||||
game.forces[ force.name ].set_ammo_damage_modifier( 'cannon-shell', 1 )
|
||||
|
||||
game.forces[ force.name ].set_ammo_damage_modifier( 'grenade', 1 )
|
||||
|
||||
game.forces[ force.name ].research_queue_enabled = true
|
||||
|
||||
game.forces[ force.name ].friendly_fire = false
|
||||
|
||||
game.forces[ force.name ].share_chart = true
|
||||
|
||||
end
|
||||
|
||||
game.permissions.get_group( 'Default' ).set_allows_action( defines.input_action.grab_blueprint_record, false )
|
||||
@ -247,8 +240,6 @@
|
||||
|
||||
game.forces[ 'enemy' ].evolution_factor = 0.4
|
||||
|
||||
data.raw.projectile[ 'slowdown-capsule' ].action.force = 'all'
|
||||
|
||||
end
|
||||
|
||||
function initialize_surface()
|
||||
@ -311,11 +302,11 @@
|
||||
|
||||
if player.gui.top[ 'draw_gui_button' ] then player.gui.top[ 'draw_gui_button' ].destroy() end
|
||||
|
||||
player.gui.top.add{ type = 'sprite-button', name = 'draw_gui_button', sprite = 'item/tank', tooltip = 'MENU' }
|
||||
player.gui.top.add( { type = 'sprite-button', name = 'draw_gui_button', sprite = 'item/tank', tooltip = 'MENU' } )
|
||||
|
||||
-- player.gui.top.add{ type = 'sprite-button', name = 'draw_gui_button', sprite = 'item/heavy-armor', tooltip = 'SCORE' }
|
||||
-- player.gui.top.add( { type = 'sprite-button', name = 'draw_gui_button_score', sprite = 'item/heavy-armor', tooltip = 'SCORE' } )
|
||||
|
||||
-- player.gui.top.add{ type = 'sprite-button', name = 'draw_gui_button', sprite = 'item/personal-roboport-equipment', tooltip = 'SQUAD' }
|
||||
-- player.gui.top.add( { type = 'sprite-button', name = 'draw_gui_button_squad', sprite = 'item/personal-roboport-equipment', tooltip = 'SQUAD' } )
|
||||
|
||||
end
|
||||
|
||||
@ -329,9 +320,9 @@
|
||||
|
||||
if #global.table_of_spots == 0 then return end
|
||||
|
||||
local element_frame = player.gui.top.add{ type = 'frame', name = 'draw_gui_status', direction = 'horizontal' }
|
||||
local element_frame = player.gui.top.add( { type = 'frame', name = 'draw_gui_status', direction = 'horizontal' } )
|
||||
|
||||
element_frame.style.minimal_height = 38
|
||||
element_frame.style.height = 38
|
||||
|
||||
element_frame.style.margin = 0
|
||||
|
||||
@ -343,7 +334,7 @@
|
||||
|
||||
element_frame.style.vertical_align = 'center'
|
||||
|
||||
local element_progressbar = element_frame.add{ type = 'progressbar', value = 100 }
|
||||
local element_progressbar = element_frame.add( { type = 'progressbar', value = 100 } )
|
||||
|
||||
element_progressbar.style.width = 125
|
||||
|
||||
@ -353,17 +344,17 @@
|
||||
|
||||
element_progressbar.style.color = table_of_colors.team
|
||||
|
||||
local element_label = element_frame.add{ type = 'label', caption = math.floor( global.table_of_properties[ player.force.name ].available_tickets ) }
|
||||
|
||||
element_label.style.right_padding = 20
|
||||
local element_label = element_frame.add( { type = 'label', caption = math.floor( global.table_of_properties[ player.force.name ].available_tickets ) } )
|
||||
|
||||
element_label.style.font_color = table_of_colors.white
|
||||
|
||||
local element_label = element_frame.add{ type = 'label', caption = global.table_of_properties[ player.force.name ].icon }
|
||||
local element_label = element_frame.add( { type = 'label', caption = global.table_of_properties[ player.force.name ].icon } )
|
||||
|
||||
element_label.style.left_padding = 20
|
||||
|
||||
element_label.style.font_color = table_of_colors.white
|
||||
|
||||
local element_label = element_frame.add{ type = 'label', caption = seconds_to_clock( global.table_of_properties.countdown_in_seconds ) }
|
||||
local element_label = element_frame.add( { type = 'label', caption = seconds_to_clock( global.table_of_properties.countdown_in_seconds ) } )
|
||||
|
||||
element_label.style.left_padding = 20
|
||||
|
||||
@ -371,17 +362,17 @@
|
||||
|
||||
element_label.style.font_color = table_of_colors.white
|
||||
|
||||
local element_label = element_frame.add{ type = 'label', caption = global.table_of_properties[ global.table_of_properties[ player.force.name ].enemy ].icon }
|
||||
local element_label = element_frame.add( { type = 'label', caption = global.table_of_properties[ global.table_of_properties[ player.force.name ].enemy ].icon } )
|
||||
|
||||
element_label.style.font_color = table_of_colors.white
|
||||
|
||||
local element_label = element_frame.add{ type = 'label', caption = math.floor( global.table_of_properties[ global.table_of_properties[ player.force.name ].enemy ].available_tickets ) }
|
||||
local element_label = element_frame.add( { type = 'label', caption = math.floor( global.table_of_properties[ global.table_of_properties[ player.force.name ].enemy ].available_tickets ) } )
|
||||
|
||||
element_label.style.left_padding = 20
|
||||
|
||||
element_label.style.font_color = table_of_colors.white
|
||||
|
||||
local element_progressbar = element_frame.add{ type = 'progressbar', value = 100 }
|
||||
local element_progressbar = element_frame.add( { type = 'progressbar', value = 100 } )
|
||||
|
||||
element_progressbar.style.width = 125
|
||||
|
||||
@ -405,9 +396,7 @@
|
||||
|
||||
if #global.table_of_spots == 0 then return end
|
||||
|
||||
local element_frame = player.gui.top.add{ type = 'frame', name = 'draw_gui_spots', direction = 'horizontal' }
|
||||
|
||||
element_frame.style.minimal_width = 38
|
||||
local element_frame = player.gui.top.add( { type = 'frame', name = 'draw_gui_spots', direction = 'horizontal' } )
|
||||
|
||||
element_frame.style.height = 38
|
||||
|
||||
@ -415,13 +404,13 @@
|
||||
|
||||
element_frame.style.padding = 0
|
||||
|
||||
element_frame.style.vertical_align = 'top'
|
||||
element_frame.style.vertical_align = 'center'
|
||||
|
||||
element_frame.style.horizontal_align = 'center'
|
||||
|
||||
for _, spot in pairs( global.table_of_spots ) do
|
||||
|
||||
local element_label = element_frame.add{ type = 'label', caption = spot.properties.name }
|
||||
local element_label = element_frame.add( { type = 'label', caption = spot.properties.name } )
|
||||
|
||||
element_label.style.width = 38
|
||||
|
||||
@ -459,15 +448,21 @@
|
||||
|
||||
if player.gui.center[ 'draw_gui_menu' ] then player.gui.center[ 'draw_gui_menu' ].destroy() end
|
||||
|
||||
local element_frame = player.gui.center.add{ type = 'frame', name = 'draw_gui_menu', direction = 'vertical' }
|
||||
local element_frame = player.gui.center.add( { type = 'frame', name = 'draw_gui_menu', direction = 'vertical' } )
|
||||
|
||||
element_frame.style.padding = 0
|
||||
|
||||
element_frame.style.margin = 0
|
||||
|
||||
if player.force.name ~= 'force_spectator' then element_frame.add{ type = 'sprite-button', name = 'event_on_click_lobby', caption = 'LOBBY' } end
|
||||
if game.permissions.get_group( 'Default' ).players[ player.index ] == nil then
|
||||
|
||||
if player.force.name == 'force_spectator' then element_frame.add{ type = 'sprite-button', name = 'event_on_click_join', caption = 'JOIN' } end
|
||||
element_frame.add( { type = 'sprite-button', name = 'event_on_click_join', caption = 'JOIN' } )
|
||||
|
||||
else
|
||||
|
||||
element_frame.add( { type = 'sprite-button', name = 'event_on_click_lobby', caption = 'LOBBY' } )
|
||||
|
||||
end
|
||||
|
||||
for _, element_item in pairs( element_frame.children ) do
|
||||
|
||||
@ -491,7 +486,7 @@
|
||||
|
||||
if player.gui.center[ 'draw_gui_score' ] then player.gui.center[ 'draw_gui_score' ].destroy() end
|
||||
|
||||
local element_frame = player.gui.center.add{ type = 'frame', name = 'draw_gui_score', direction = 'vertical' }
|
||||
local element_frame = player.gui.center.add( { type = 'frame', name = 'draw_gui_score', direction = 'vertical' } )
|
||||
|
||||
element_frame.style.padding = 0
|
||||
|
||||
@ -501,7 +496,7 @@
|
||||
|
||||
element_frame.style.horizontal_align = 'center'
|
||||
|
||||
local element_table = element_frame.add{ type = 'table', column_count = 14, draw_horizontal_lines = true }
|
||||
local element_table = element_frame.add( { type = 'table', column_count = 14, draw_horizontal_lines = true } )
|
||||
|
||||
element_table.style.padding = 0
|
||||
|
||||
@ -517,35 +512,35 @@
|
||||
|
||||
element_table.style.horizontal_align = 'center'
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = global.table_of_properties[ player.force.name ].icon }
|
||||
local element_label = element_table.add( { type = 'label', caption = global.table_of_properties[ player.force.name ].icon } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = '#' }
|
||||
local element_label = element_table.add( { type = 'label', caption = '#' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'NAME' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'NAME' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'CLASS' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'CLASS' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'K' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'K' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'D' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'D' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'POINTS' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'POINTS' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = global.table_of_properties[ global.table_of_properties[ player.force.name ].enemy ].icon }
|
||||
local element_label = element_table.add( { type = 'label', caption = global.table_of_properties[ global.table_of_properties[ player.force.name ].enemy ].icon } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = '#' }
|
||||
local element_label = element_table.add( { type = 'label', caption = '#' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'NAME' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'NAME' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'CLASS' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'CLASS' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'K' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'K' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'D' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'D' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'POINTS' }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'POINTS' } )
|
||||
|
||||
for index = 1, 28 do local element_label = element_table.add{ type = 'label', caption = '•' } end
|
||||
for index = 1, 28 do local element_label = element_table.add( { type = 'label', caption = '•' } ) end
|
||||
|
||||
for _, element_item in pairs( element_table.children ) do
|
||||
|
||||
@ -571,7 +566,7 @@
|
||||
|
||||
if global.table_of_properties.game_stage ~= 'ongoing_game' then return end
|
||||
|
||||
local element_frame = player.gui.left.add{ type = 'frame', name = 'draw_gui_squad', direction = 'vertical' }
|
||||
local element_frame = player.gui.left.add( { type = 'frame', name = 'draw_gui_squad', direction = 'vertical' } )
|
||||
|
||||
element_frame.style.minimal_width = 50
|
||||
|
||||
@ -583,7 +578,7 @@
|
||||
|
||||
element_frame.style.left_margin = 5
|
||||
|
||||
local element_table = element_frame.add{ type = 'table', column_count = 4 }
|
||||
local element_table = element_frame.add( { type = 'table', column_count = 4 } )
|
||||
|
||||
element_table.style.padding = 0
|
||||
|
||||
@ -591,25 +586,25 @@
|
||||
|
||||
for index = 1, 8 do
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = 'SQUAD ' .. index }
|
||||
local element_label = element_table.add( { type = 'label', caption = 'SQUAD ' .. index } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label' }
|
||||
local element_label = element_table.add( { type = 'label' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label' }
|
||||
local element_label = element_table.add( { type = 'label' } )
|
||||
|
||||
local element_button = element_table.add{ type = 'sprite-button', name = 'aaa_' .. index, caption = 'JOIN' }
|
||||
local element_button = element_table.add( { type = 'sprite-button', name = 'aaa_' .. index, caption = 'JOIN' } )
|
||||
|
||||
element_button.style.width = 50
|
||||
|
||||
element_button.style.height = 25
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = '•' }
|
||||
local element_label = element_table.add( { type = 'label', caption = '•' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = '•' }
|
||||
local element_label = element_table.add( { type = 'label', caption = '•' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = '•' }
|
||||
local element_label = element_table.add( { type = 'label', caption = '•' } )
|
||||
|
||||
local element_label = element_table.add{ type = 'label', caption = '•' }
|
||||
local element_label = element_table.add( { type = 'label', caption = '•' } )
|
||||
|
||||
end
|
||||
|
||||
@ -633,6 +628,58 @@
|
||||
|
||||
end
|
||||
|
||||
function draw_gui_spawn( player )
|
||||
|
||||
if player.gui.center[ 'draw_gui_spawn' ] then player.gui.center[ 'draw_gui_spawn' ].destroy() end
|
||||
|
||||
if global.table_of_properties.game_stage ~= 'ongoing_game' then return end
|
||||
|
||||
local element_frame = player.gui.center.add( { type = 'frame', name = 'draw_gui_spawn', direction = 'horizontal' } )
|
||||
|
||||
local element_button = element_frame.add( { type = 'button', name = 'event_on_click_spawn_base', caption = 'BASE' } )
|
||||
|
||||
-- element_button.style.color = table_of_colors.damage
|
||||
|
||||
element_button.style.font_color = table_of_colors.white
|
||||
|
||||
for index, spot in pairs( global.table_of_spots ) do
|
||||
|
||||
local element_button = element_frame.add( { type = 'button', name = 'event_on_click_spawn_' .. index, caption = spot.properties.name } )
|
||||
|
||||
-- element_button.enabled = false
|
||||
|
||||
local color = table_of_colors.neutral
|
||||
|
||||
-- if spot.properties.force.name == global.table_of_properties[ player.force.name ].name and spot.properties.value >= 50 then element_button.enabled = true end
|
||||
|
||||
if spot.properties.force.name == global.table_of_properties[ player.force.name ].name and spot.properties.value > 0 then color = table_of_colors.team end
|
||||
|
||||
if spot.properties.force.name == global.table_of_properties[ player.force.name ].enemy and spot.properties.value > 0 then color = table_of_colors.enemy end
|
||||
|
||||
element_button.style.font_color = color
|
||||
|
||||
end
|
||||
|
||||
for _, element_item in pairs( element_frame.children ) do
|
||||
|
||||
element_item.style.width = 100
|
||||
|
||||
element_item.style.height = 100
|
||||
|
||||
element_item.style.padding = 0
|
||||
|
||||
element_item.style.margin = 0
|
||||
|
||||
element_item.style.vertical_align = 'center'
|
||||
|
||||
element_item.style.horizontal_align = 'center'
|
||||
|
||||
element_item.style.font = 'heading-2'
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function create_a_tank( player )
|
||||
|
||||
player.insert( { name = 'light-armor', count = 1 } )
|
||||
@ -641,7 +688,9 @@
|
||||
|
||||
player.insert( { name = 'firearm-magazine', count = 50 } )
|
||||
|
||||
player.insert( { name = 'raw-fish', count = 3 } )
|
||||
player.insert( { name = 'raw-fish', count = 10 } )
|
||||
|
||||
player.insert( { name = 'explosive-cannon-shell', count = 5 } )
|
||||
|
||||
local table_of_entities = player.surface.find_entities_filtered( { name = 'tank', force = player.force.name } )
|
||||
|
||||
@ -737,13 +786,13 @@
|
||||
|
||||
local table_of_players = {}
|
||||
|
||||
local draw_spot_border = rendering.draw_rectangle{ surface = surface, target = spot.position, color = spot.color, left_top = { spot.position.x - 9, spot.position.y - 9 }, right_bottom = { spot.position.x + 9, spot.position.y + 9 }, width = 5, filled = false, draw_on_ground = true }
|
||||
local draw_spot_border = rendering.draw_rectangle( { surface = surface, target = spot.position, color = spot.color, left_top = { spot.position.x - 9, spot.position.y - 9 }, right_bottom = { spot.position.x + 9, spot.position.y + 9 }, width = 5, filled = false, draw_on_ground = true } )
|
||||
|
||||
local draw_spot_force = rendering.draw_text{ text = spot.force.name, surface = surface, target = { spot.position.x, spot.position.y + 0.5 }, color = spot.color, scale = 5, alignment = 'center' }
|
||||
local draw_spot_force = rendering.draw_text( { text = spot.force.name, surface = surface, target = { spot.position.x, spot.position.y + 0.5 }, color = spot.color, scale = 5, alignment = 'center' } )
|
||||
|
||||
local draw_spot_value = rendering.draw_text{ text = spot.value, surface = surface, target = { spot.position.x, spot.position.y - 4 }, color = spot.color, scale = 5, alignment = 'center' }
|
||||
local draw_spot_value = rendering.draw_text( { text = spot.value, surface = surface, target = { spot.position.x, spot.position.y - 4 }, color = spot.color, scale = 5, alignment = 'center' } )
|
||||
|
||||
local draw_spot_name = rendering.draw_text{ text = spot.name, surface = surface, target = { spot.position.x, spot.position.y - 2 }, color = spot.color, scale = 5, alignment = 'center' }
|
||||
local draw_spot_name = rendering.draw_text( { text = spot.name, surface = surface, target = { spot.position.x, spot.position.y - 2 }, color = spot.color, scale = 5, alignment = 'center' } )
|
||||
|
||||
local table_of_drawings = { name = draw_spot_name, value = draw_spot_value, force = draw_spot_force, border = draw_spot_border }
|
||||
|
||||
@ -939,37 +988,45 @@
|
||||
|
||||
if not player.character then return end
|
||||
|
||||
if #game.forces.force_player_one.connected_players == #game.forces.force_player_two.connected_players then
|
||||
game.permissions.get_group( 'Default' ).add_player( player )
|
||||
|
||||
local table_of_forces = { 'force_player_one', 'force_player_two' }
|
||||
if player.force.name == 'force_spectator' then
|
||||
|
||||
player.force = game.forces[ table_of_forces[ math.random( 1, #table_of_forces ) ] ]
|
||||
if #game.forces.force_player_one.connected_players == #game.forces.force_player_two.connected_players then
|
||||
|
||||
elseif #game.forces.force_player_one.connected_players < #game.forces.force_player_two.connected_players then
|
||||
local table_of_forces = { 'force_player_one', 'force_player_two' }
|
||||
|
||||
player.force = game.forces.force_player_one
|
||||
player.force = game.forces[ table_of_forces[ math.random( 1, #table_of_forces ) ] ]
|
||||
|
||||
else
|
||||
elseif #game.forces.force_player_one.connected_players < #game.forces.force_player_two.connected_players then
|
||||
|
||||
player.force = game.forces.force_player_two
|
||||
player.force = game.forces.force_player_one
|
||||
|
||||
else
|
||||
|
||||
player.force = game.forces.force_player_two
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local position = player.force.get_spawn_position( surface )
|
||||
|
||||
global.table_of_spawns[ player.index ] = position
|
||||
|
||||
if surface.is_chunk_generated( position ) then player.teleport( surface.find_non_colliding_position( 'character', position, 3, 0.5 ), surface ) else player.teleport( position, surface ) end
|
||||
|
||||
game.permissions.get_group( 'Default' ).add_player( player.name )
|
||||
player.character.destructible = true
|
||||
|
||||
game.print( player.name .. ' joined ' .. global.table_of_properties[ player.force.name ].icon )
|
||||
|
||||
rendering.draw_text{ text = global.table_of_properties[ player.force.name ].icon, target = player.character, target_offset = { 0, - 3.7 }, surface = player.surface, color = table_of_colors.white, scale = 2, alignment = 'center' }
|
||||
player_icon_add( player )
|
||||
|
||||
create_a_tank( player )
|
||||
|
||||
-- draw_gui_spawn( player ) -- only for tests
|
||||
|
||||
for _, spot in pairs( global.table_of_spots ) do player.force.chart( game.surfaces.tank_conquest, { { x = spot.properties.position.x - 10, y = spot.properties.position.y - 10 }, { x = spot.properties.position.x + 10, y = spot.properties.position.y + 10 } } ) end
|
||||
|
||||
player.character.destructible = true
|
||||
game.print( player.name .. ' joined ' .. global.table_of_properties[ player.force.name ].icon )
|
||||
|
||||
end
|
||||
|
||||
@ -981,18 +1038,10 @@
|
||||
|
||||
if not player.character then return end
|
||||
|
||||
game.permissions.get_group( 'permission_spectator' ).add_player( player )
|
||||
|
||||
player.force = game.forces.force_spectator
|
||||
|
||||
local position = player.force.get_spawn_position( surface )
|
||||
|
||||
if surface.is_chunk_generated( position ) then player.teleport( surface.find_non_colliding_position( 'character', position, 3, 0.5 ), surface ) else player.teleport( position, surface ) end
|
||||
|
||||
game.permissions.get_group( 'permission_spectator' ).add_player( player.name )
|
||||
|
||||
player.character.destructible = false
|
||||
|
||||
player.character.clear_items_inside()
|
||||
|
||||
if global.table_of_tanks[ player.index ] ~= nil and global.table_of_tanks[ player.index ].valid then
|
||||
|
||||
global.table_of_tanks[ player.index ].clear_items_inside()
|
||||
@ -1003,6 +1052,24 @@
|
||||
|
||||
global.table_of_tanks[ player.index ] = nil
|
||||
|
||||
local position = { x = 0, y = 0 }
|
||||
|
||||
global.table_of_spawns[ player.index ] = position
|
||||
|
||||
if surface.is_chunk_generated( position ) then player.teleport( surface.find_non_colliding_position( 'character', position, 3, 0.5 ), surface ) else player.teleport( position, surface ) end
|
||||
|
||||
player.character.destructible = false
|
||||
|
||||
player_icon_remove( player )
|
||||
|
||||
player.character.clear_items_inside()
|
||||
|
||||
end
|
||||
|
||||
function event_on_click_spawn( player )
|
||||
|
||||
game.print( 'A' )
|
||||
|
||||
end
|
||||
|
||||
function shuffle( table_of_items )
|
||||
@ -1061,7 +1128,7 @@
|
||||
|
||||
end
|
||||
|
||||
for _, player in pairs( game.connected_players ) do if player.force.name == spot.properties.force.name and spot.properties.value == 100 then player.force.chart( game.surfaces.tank_conquest, { { x = spot.properties.position.x - 10, y = spot.properties.position.y - 10 }, { x = spot.properties.position.x + 10, y = spot.properties.position.y + 10 } } ) end end
|
||||
for _, player in pairs( game.connected_players ) do if player.force.name == spot.properties.force.name and spot.properties.value > 0 then player.force.chart( game.surfaces.tank_conquest, { { x = spot.properties.position.x - 10, y = spot.properties.position.y - 10 }, { x = spot.properties.position.x + 10, y = spot.properties.position.y + 10 } } ) end end
|
||||
|
||||
for _, player in pairs( spot.players ) do
|
||||
|
||||
@ -1177,11 +1244,11 @@
|
||||
|
||||
local position = game.forces.force_player_one.get_spawn_position( game.surfaces.tank_conquest )
|
||||
|
||||
map_functions.draw_noise_tile_circle( { x = position.x - 50, y = 60 }, 'water', game.surfaces.tank_conquest, math.random( 8, 10 ) )
|
||||
map_functions.draw_noise_tile_circle( { x = position.x - 50, y = 10 }, 'water', game.surfaces.tank_conquest, math.random( 8, 10 ) )
|
||||
|
||||
local radius, angle, sides = 10, 1, #table_of_ores
|
||||
|
||||
local table_of_positions = draw_a_polygon( { x = position.x - 50, y = 60 }, radius, angle, sides )
|
||||
local table_of_positions = draw_a_polygon( { x = position.x - 50, y = 10 }, radius, angle, sides )
|
||||
|
||||
for index = 1, #table_of_positions do map_functions.draw_smoothed_out_ore_circle( table_of_positions[ index + 1 ], table_of_ores[ index ], game.surfaces.tank_conquest, 15, 3000 ) end
|
||||
|
||||
@ -1189,21 +1256,21 @@
|
||||
|
||||
local position = game.forces.force_player_two.get_spawn_position( game.surfaces.tank_conquest )
|
||||
|
||||
map_functions.draw_noise_tile_circle( { x = position.x + 50, y = 60 }, 'water', game.surfaces.tank_conquest, math.random( 8, 10 ) )
|
||||
map_functions.draw_noise_tile_circle( { x = position.x + 50, y = 10 }, 'water', game.surfaces.tank_conquest, math.random( 8, 10 ) )
|
||||
|
||||
local radius, angle, sides = 10, 1, #table_of_ores
|
||||
|
||||
local table_of_positions = draw_a_polygon( { x = position.x + 50, y = 60 }, radius, angle, sides )
|
||||
local table_of_positions = draw_a_polygon( { x = position.x + 50, y = 10 }, radius, angle, sides )
|
||||
|
||||
for index = 1, #table_of_positions do map_functions.draw_smoothed_out_ore_circle( table_of_positions[ index + 1 ], table_of_ores[ index ], game.surfaces.tank_conquest, 15, 3000 ) end
|
||||
|
||||
create_a_base( 'force_player_two', position )
|
||||
|
||||
local position = { x = 0, y = - 350 }
|
||||
local position = { x = 0, y = - 500 }
|
||||
|
||||
create_a_point_of_interest( blueprint_poi_laser_json, position )
|
||||
|
||||
local position = { x = 0, y = 450 }
|
||||
local position = { x = 0, y = 500 }
|
||||
|
||||
create_a_point_of_interest( blueprint_poi_fire_json, position )
|
||||
|
||||
@ -1213,7 +1280,7 @@
|
||||
|
||||
local length_of_names = math.random( 3, #table_of_names )
|
||||
|
||||
local position, radius, angle, sides = { x = 0, y = 50 }, math.random( 150, 250 ), math.random( 0.1, 6.3 ), length_of_names
|
||||
local position, radius, angle, sides = { x = 0, y = 0 }, math.random( 150, 250 ), math.random( 0.1, 6.3 ), length_of_names
|
||||
|
||||
local table_of_positions = draw_a_polygon( position, radius, angle, sides )
|
||||
|
||||
@ -1241,9 +1308,9 @@
|
||||
|
||||
if global.table_of_properties.game_stage == 'preparing_spawn_positions' then
|
||||
|
||||
game.forces.force_player_one.set_spawn_position( { x = - 500, y = 50 }, game.surfaces.tank_conquest )
|
||||
game.forces.force_player_one.set_spawn_position( { x = - 500, y = 0 }, game.surfaces.tank_conquest )
|
||||
|
||||
game.forces.force_player_two.set_spawn_position( { x = 500, y = 50 }, game.surfaces.tank_conquest )
|
||||
game.forces.force_player_two.set_spawn_position( { x = 500, y = 0 }, game.surfaces.tank_conquest )
|
||||
|
||||
game.forces.force_spectator.set_spawn_position( { x = 0, y = 0 }, game.surfaces.tank_conquest )
|
||||
|
||||
@ -1275,15 +1342,15 @@
|
||||
|
||||
else
|
||||
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { x = 0, y = 0 }, 1 )
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { 0, 0 }, 1 )
|
||||
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { - 500, 50 }, 1 )
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { - 500, 0 }, 1 )
|
||||
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { 500, 50 }, 1 )
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { 500, 0 }, 1 )
|
||||
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { 0, - 350 }, 1 )
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { 0, - 500 }, 1 )
|
||||
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { 0, 450 }, 1 )
|
||||
game.surfaces.tank_conquest.request_to_generate_chunks( { 0, 500 }, 1 )
|
||||
|
||||
end
|
||||
|
||||
@ -1355,13 +1422,11 @@
|
||||
|
||||
local player = game.players[ event.player_index ]
|
||||
|
||||
if event.element.valid and event.element.name == 'close_map_intro_frame' then player.gui.center[ 'map_intro_frame' ].destroy() return end
|
||||
if event.element.valid and event.element.name == 'draw_gui_intro_content' then player.gui.center[ 'draw_gui_intro_frame' ].destroy() return end
|
||||
|
||||
if event.element.valid and event.element.name == 'map_intro_text' then player.gui.center[ 'map_intro_frame' ].destroy() return end
|
||||
if event.element.valid and event.element.name == 'draw_gui_intro_button' then
|
||||
|
||||
if event.element.valid and event.element.name == 'map_intro_button' then
|
||||
|
||||
if player.gui.center[ 'map_intro_frame' ] then player.gui.center[ 'map_intro_frame' ].destroy() else draw_gui_map_intro( player ) end
|
||||
if player.gui.center[ 'draw_gui_intro_frame' ] then player.gui.center[ 'draw_gui_intro_frame' ].destroy() else draw_gui_intro_frame( player ) end
|
||||
|
||||
end
|
||||
|
||||
@ -1385,6 +1450,10 @@
|
||||
|
||||
if event.element.valid and event.element.name == 'event_on_click_lobby' then
|
||||
|
||||
global.table_of_delays[ player.index ] = game.tick
|
||||
|
||||
game.print( player.name .. ' is spectating' )
|
||||
|
||||
event_on_click_lobby( player )
|
||||
|
||||
if player.gui.center[ 'draw_gui_menu' ] then player.gui.center[ 'draw_gui_menu' ].destroy() end
|
||||
@ -1393,9 +1462,25 @@
|
||||
|
||||
if event.element.valid and event.element.name == 'event_on_click_join' then
|
||||
|
||||
event_on_click_join( player )
|
||||
if game.tick - global.table_of_delays[ player.index ] < 3600 then
|
||||
|
||||
if player.gui.center[ 'draw_gui_menu' ] then player.gui.center[ 'draw_gui_menu' ].destroy() end
|
||||
player.print( 'Not ready to return. Please wait ' .. 60 - ( math.floor( ( game.tick - global.table_of_delays[ player.index ] ) / 60 ) ) .. ' seconds.' )
|
||||
|
||||
else
|
||||
|
||||
global.table_of_delays[ player.index ] = nil
|
||||
|
||||
event_on_click_join( player )
|
||||
|
||||
if player.gui.center[ 'draw_gui_menu' ] then player.gui.center[ 'draw_gui_menu' ].destroy() end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if event.element.valid and event.element.name == 'event_on_click_spawn_1' then
|
||||
|
||||
event_on_click_spawn( player )
|
||||
|
||||
end
|
||||
|
||||
@ -1503,15 +1588,15 @@
|
||||
|
||||
for spot_index, spot_item in pairs( global.table_of_spots ) do
|
||||
|
||||
if global.table_of_spots[ spot_index ].players[ event.player_index ] ~= nil then global.table_of_spots[ spot_index ].players[ event.player_index ] = nil end
|
||||
if global.table_of_spots[ spot_index ].players[ player.index ] ~= nil then global.table_of_spots[ spot_index ].players[ player.index ] = nil end
|
||||
|
||||
for _, position in pairs( spot_item.positions ) do
|
||||
|
||||
if math.floor( player.position.x ) == position.x and math.floor( player.position.y ) == position.y or math.ceil( player.position.x ) == position.x and math.ceil( player.position.y ) == position.y then
|
||||
|
||||
if global.table_of_spots[ spot_index ].players[ event.player_index ] == nil then
|
||||
if global.table_of_spots[ spot_index ].players[ player.index ] == nil then
|
||||
|
||||
global.table_of_spots[ spot_index ].players[ event.player_index ] = player
|
||||
global.table_of_spots[ spot_index ].players[ player.index ] = player
|
||||
|
||||
break
|
||||
|
||||
@ -1521,7 +1606,7 @@
|
||||
|
||||
end
|
||||
|
||||
if global.table_of_spots[ spot_index ].players[ event.player_index ] ~= nil then break end
|
||||
if global.table_of_spots[ spot_index ].players[ player.index ] ~= nil then break end
|
||||
|
||||
end
|
||||
|
||||
@ -1535,7 +1620,15 @@
|
||||
|
||||
local player = game.players[ event.player_index ]
|
||||
|
||||
rendering.draw_text{ text = global.table_of_properties[ player.force.name ].icon, target = player.character, target_offset = { 0, - 3.7 }, surface = player.surface, color = table_of_colors.white, scale = 2, alignment = 'center' }
|
||||
local surface = player.surface
|
||||
|
||||
if player.gui.center[ 'draw_gui_spawn' ] then player.gui.center[ 'draw_gui_spawn' ].destroy() end
|
||||
|
||||
local position = global.table_of_spawns[ player.index ]
|
||||
|
||||
if surface.is_chunk_generated( position ) then player.teleport( surface.find_non_colliding_position( 'character', position, 3, 0.5 ), surface ) else player.teleport( position, surface ) end
|
||||
|
||||
player_icon_add( player )
|
||||
|
||||
create_a_tank( player )
|
||||
|
||||
@ -1549,6 +1642,8 @@
|
||||
|
||||
local player = game.players[ event.player_index ]
|
||||
|
||||
global.table_of_spawns[ player.index ] = player.force.get_spawn_position( player.surface )
|
||||
|
||||
local table_of_entities = player.surface.find_entities_filtered( { name = 'character-corpse' } )
|
||||
|
||||
for _, entity in pairs( table_of_entities ) do
|
||||
@ -1559,6 +1654,10 @@
|
||||
|
||||
end
|
||||
|
||||
-- draw_gui_spawn( player )
|
||||
|
||||
player_icon_remove( player )
|
||||
|
||||
if global.table_of_tanks[ player.index ] ~= nil and global.table_of_tanks[ player.index ].valid then
|
||||
|
||||
global.table_of_tanks[ player.index ].clear_items_inside()
|
||||
@ -1573,7 +1672,7 @@
|
||||
|
||||
if force ~= nil and force.available_tickets > 0 then force.available_tickets = force.available_tickets - 1 end
|
||||
|
||||
for _, spot in pairs( global.table_of_spots ) do if spot.players[ event.player_index ] ~= nil then spot.players[ event.player_index ] = nil end end
|
||||
for _, spot in pairs( global.table_of_spots ) do if spot.players[ player.index ] ~= nil then spot.players[ player.index ] = nil end end
|
||||
|
||||
local player_death_message = global.table_of_properties[ player.force.name ].icon .. ' ' .. player.name .. ' was killed.'
|
||||
|
||||
@ -1625,7 +1724,7 @@
|
||||
|
||||
local player = game.players[ event.player_index ]
|
||||
|
||||
player.character.clear_items_inside()
|
||||
player_icon_remove( player )
|
||||
|
||||
if global.table_of_tanks[ player.index ] ~= nil and global.table_of_tanks[ player.index ].valid then
|
||||
|
||||
@ -1637,7 +1736,9 @@
|
||||
|
||||
global.table_of_tanks[ player.index ] = nil
|
||||
|
||||
for _, spot in pairs( global.table_of_spots ) do if spot.players[ event.player_index ] ~= nil then spot.players[ event.player_index ] = nil end end
|
||||
global.table_of_spawns[ player.index ] = nil
|
||||
|
||||
for _, spot in pairs( global.table_of_spots ) do if spot.players[ player.index ] ~= nil then spot.players[ player.index ] = nil end end
|
||||
|
||||
end
|
||||
|
||||
@ -1651,11 +1752,11 @@
|
||||
|
||||
player.force = game.forces.force_spectator
|
||||
|
||||
draw_gui_map_intro_button( player )
|
||||
draw_gui_intro_button( player )
|
||||
|
||||
if player.online_time == 0 then
|
||||
|
||||
draw_gui_map_intro( player )
|
||||
draw_gui_intro_frame( player )
|
||||
|
||||
local position = player.force.get_spawn_position( surface )
|
||||
|
||||
@ -1663,10 +1764,12 @@
|
||||
|
||||
player.character.destructible = false
|
||||
|
||||
game.permissions.get_group( 'permission_spectator' ).add_player( player.name )
|
||||
game.permissions.get_group( 'permission_spectator' ).add_player( player )
|
||||
|
||||
elseif player.surface.name == 'tank_conquest' then
|
||||
|
||||
player.character.clear_items_inside()
|
||||
|
||||
draw_gui_button( player )
|
||||
|
||||
event_on_click_join( player )
|
||||
@ -1681,59 +1784,49 @@
|
||||
|
||||
end
|
||||
|
||||
for index, slot in pairs( table_of_slots ) do
|
||||
|
||||
player.set_quick_bar_slot( index, slot )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
event.add( defines.events.on_player_joined_game, on_player_joined_game )
|
||||
|
||||
-- /silent-command circle_add( game.players[ 1 ] )
|
||||
function player_icon_add( player )
|
||||
|
||||
-- /silent-command circle_change( game.players[ 1 ] )
|
||||
if global.table_of_drawings[ player.index ] == nil then
|
||||
|
||||
-- /silent-command circle_remove( game.players[ 1 ] )
|
||||
-- local icon = rendering.draw_circle( { target = player.character, target_offset = { x = 0, y = - 3.7 }, force = game.forces.force_player_one, surface = player.surface, color = table_of_colors.team, radius = 0.3, filled = true, only_in_alt_mode = false } )
|
||||
|
||||
function circle_add( player )
|
||||
-- local color = { r = player.color.r * 0.6 + 0.35, g = player.color.g * 0.6 + 0.35, b = player.color.b * 0.6 + 0.35, a = 1 }
|
||||
|
||||
player.force = game.forces.force_player_one
|
||||
local icon = rendering.draw_text( { text = global.table_of_properties[ player.force.name ].icon, target = player.character, target_offset = { 0, - 3.7 }, surface = player.surface, color = table_of_colors.white, scale = 2, alignment = 'center' } )
|
||||
|
||||
if global.table_of_circles == nil then global.table_of_circles = {} end
|
||||
|
||||
if global.table_of_circles[ player.index ] == nil then
|
||||
|
||||
-- local one = rendering.draw_circle( { target = player.character, target_offset = { x = 0, y = - 2.5 }, force = game.forces.force_player_one, surface = player.surface, color = table_of_colors.team, radius = 0.2, filled = true, only_in_alt_mode = false } )
|
||||
|
||||
-- local two = rendering.draw_circle( { target = player.character, target_offset = { x = 1, y = - 2.5 }, force = game.forces.force_player_two, surface = player.surface, color = table_of_colors.enemy, radius = 0.2, filled = true, only_in_alt_mode = false } )
|
||||
|
||||
local one = rendering.draw_circle( { target = player.position, force = game.forces.force_player_one, surface = player.surface, color = table_of_colors.team, radius = 3, filled = true, only_in_alt_mode = false } )
|
||||
|
||||
local two = rendering.draw_circle( { target = { x = player.position.x + 200, y = player.position.y }, force = game.forces.force_player_two, surface = player.surface, color = table_of_colors.enemy, radius = 3, filled = true, only_in_alt_mode = false } )
|
||||
|
||||
global.table_of_circles[ player.index ] = { one = one, two = two }
|
||||
global.table_of_drawings[ player.index ] = icon
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function circle_change( player )
|
||||
function player_icon_change( player )
|
||||
|
||||
if global.table_of_circles[ player.index ] ~= nil then
|
||||
if global.table_of_drawings[ player.index ] ~= nil then
|
||||
|
||||
local one = global.table_of_circles[ player.index ].one
|
||||
|
||||
local two = global.table_of_circles[ player.index ].two
|
||||
local icon = global.table_of_drawings[ player.index ]
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function circle_remove( player )
|
||||
function player_icon_remove( player )
|
||||
|
||||
if global.table_of_circles[ player.index ] ~= nil then
|
||||
if global.table_of_drawings[ player.index ] ~= nil then
|
||||
|
||||
rendering.destroy( global.table_of_circles[ player.index ].one )
|
||||
rendering.destroy( global.table_of_drawings[ player.index ] )
|
||||
|
||||
rendering.destroy( global.table_of_circles[ player.index ].two )
|
||||
|
||||
global.table_of_circles[ player.index ] = nil
|
||||
global.table_of_drawings[ player.index ] = nil
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user