mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-10 00:43:27 +02:00
Merge pull request #57 from ComfyFactory/changes_to_mtn
more changes to mtn fortress
This commit is contained in:
commit
11084fba25
@ -9,29 +9,20 @@ function Public.init_enemy_weapon_damage()
|
|||||||
local data = {
|
local data = {
|
||||||
['artillery-shell'] = -1.3,
|
['artillery-shell'] = -1.3,
|
||||||
['biological'] = 0,
|
['biological'] = 0,
|
||||||
|
['beam'] = 0,
|
||||||
['bullet'] = 0,
|
['bullet'] = 0,
|
||||||
['cannon-shell'] = 0,
|
['cannon-shell'] = 0,
|
||||||
['capsule'] = 0,
|
['capsule'] = 0,
|
||||||
['electric'] = 0,
|
['electric'] = 0,
|
||||||
['flamethrower'] = 0,
|
['flamethrower'] = 0,
|
||||||
['grenade'] = 0,
|
['grenade'] = 0,
|
||||||
|
['laser'] = 0,
|
||||||
['landmine'] = 0,
|
['landmine'] = 0,
|
||||||
['melee'] = 0,
|
['melee'] = 0,
|
||||||
['rocket'] = 0,
|
['rocket'] = 0,
|
||||||
['shotgun-shell'] = 0
|
['shotgun-shell'] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
local experimental = get_game_version()
|
|
||||||
if experimental then
|
|
||||||
data['beam'] = 0
|
|
||||||
data['laser'] = 0
|
|
||||||
else
|
|
||||||
data['railgun'] = 0
|
|
||||||
data['combat-robot-beam'] = 0
|
|
||||||
data['combat-robot-laser'] = 0
|
|
||||||
data['laser-turret'] = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
local e = game.forces.enemy
|
local e = game.forces.enemy
|
||||||
|
|
||||||
e.technologies['refined-flammables-1'].researched = true
|
e.technologies['refined-flammables-1'].researched = true
|
||||||
@ -49,27 +40,16 @@ local function enemy_weapon_damage()
|
|||||||
local data = {
|
local data = {
|
||||||
['artillery-shell'] = 0.05,
|
['artillery-shell'] = 0.05,
|
||||||
['biological'] = 0.06,
|
['biological'] = 0.06,
|
||||||
|
['beam'] = 0.08,
|
||||||
['bullet'] = 0.08,
|
['bullet'] = 0.08,
|
||||||
['capsule'] = 0.08,
|
['capsule'] = 0.08,
|
||||||
['electric'] = 0.08,
|
['electric'] = 0.08,
|
||||||
['flamethrower'] = 0.08,
|
['flamethrower'] = 0.08,
|
||||||
--['grenade'] = 0.08,
|
['laser'] = 0.08,
|
||||||
['landmine'] = 0.08,
|
['landmine'] = 0.08,
|
||||||
['melee'] = 0.08
|
['melee'] = 0.08
|
||||||
--['rocket'] = 0.08,
|
|
||||||
--['shotgun-shell'] = 0.08
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local experimental = get_game_version()
|
|
||||||
if experimental then
|
|
||||||
data['beam'] = 0.08
|
|
||||||
data['laser'] = 0.08
|
|
||||||
else
|
|
||||||
data['combat-robot-beam'] = 0.08
|
|
||||||
data['combat-robot-laser'] = 0.08
|
|
||||||
data['laser-turret'] = 0.08
|
|
||||||
end
|
|
||||||
|
|
||||||
for k, v in pairs(data) do
|
for k, v in pairs(data) do
|
||||||
local new = Difficulty.get().difficulty_vote_value * v
|
local new = Difficulty.get().difficulty_vote_value * v
|
||||||
|
|
||||||
@ -81,6 +61,4 @@ end
|
|||||||
|
|
||||||
Event.add(Public.events.breached_wall, enemy_weapon_damage)
|
Event.add(Public.events.breached_wall, enemy_weapon_damage)
|
||||||
|
|
||||||
--Event.on_nth_tick(54000, enemy_weapon_damage)
|
|
||||||
|
|
||||||
return Public
|
return Public
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
local Event = require 'utils.event'
|
||||||
local WPT = require 'maps.mountain_fortress_v3.table'
|
local WPT = require 'maps.mountain_fortress_v3.table'
|
||||||
|
|
||||||
local nom_msg = {'munch', 'munch', 'yum'}
|
local nom_msg = {'munch', 'munch', 'yum'}
|
||||||
@ -193,8 +194,7 @@ local function on_player_dropped_item(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local event = require 'utils.event'
|
Event.add(defines.events.on_player_dropped_item, on_player_dropped_item)
|
||||||
event.add(defines.events.on_player_dropped_item, on_player_dropped_item)
|
Event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||||
event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
|
||||||
|
|
||||||
return Public
|
return Public
|
||||||
|
@ -227,7 +227,12 @@ local function set_train_final_health(final_damage_amount)
|
|||||||
local poison_deployed = WPT.get('poison_deployed')
|
local poison_deployed = WPT.get('poison_deployed')
|
||||||
local robotics_deployed = WPT.get('robotics_deployed')
|
local robotics_deployed = WPT.get('robotics_deployed')
|
||||||
|
|
||||||
if locomotive_health >= 4000 and locomotive_health <= 6000 then
|
local lower_high = locomotive_max_health * 0.4
|
||||||
|
local higher_high = locomotive_max_health * 0.5
|
||||||
|
local lower_low = locomotive_max_health * 0.2
|
||||||
|
local higher_low = locomotive_max_health * 0.3
|
||||||
|
|
||||||
|
if locomotive_health >= lower_high and locomotive_health <= higher_high then
|
||||||
if not poison_deployed then
|
if not poison_deployed then
|
||||||
local carriages = WPT.get('carriages')
|
local carriages = WPT.get('carriages')
|
||||||
|
|
||||||
@ -245,7 +250,7 @@ local function set_train_final_health(final_damage_amount)
|
|||||||
Alert.alert_all_players_location(p, msg)
|
Alert.alert_all_players_location(p, msg)
|
||||||
WPT.set().poison_deployed = true
|
WPT.set().poison_deployed = true
|
||||||
end
|
end
|
||||||
elseif locomotive_health >= 1500 and locomotive_health <= 3900 then
|
elseif locomotive_health >= lower_low and locomotive_health <= higher_low then
|
||||||
if not robotics_deployed then
|
if not robotics_deployed then
|
||||||
local carriages = WPT.get('carriages')
|
local carriages = WPT.get('carriages')
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ local Color = require 'utils.color_presets'
|
|||||||
local Task = require 'utils.task'
|
local Task = require 'utils.task'
|
||||||
local Token = require 'utils.token'
|
local Token = require 'utils.token'
|
||||||
local IC_Gui = require 'maps.mountain_fortress_v3.ic.gui'
|
local IC_Gui = require 'maps.mountain_fortress_v3.ic.gui'
|
||||||
|
local IC = require 'maps.mountain_fortress.ic.table'
|
||||||
local WPT = require 'maps.mountain_fortress_v3.table'
|
local WPT = require 'maps.mountain_fortress_v3.table'
|
||||||
|
|
||||||
local Public = {}
|
local Public = {}
|
||||||
@ -856,7 +857,8 @@ function Public.create_car(ic, event)
|
|||||||
return car
|
return car
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.remove_invalid_cars(ic)
|
function Public.remove_invalid_cars()
|
||||||
|
local ic = IC.get()
|
||||||
for k, car in pairs(ic.cars) do
|
for k, car in pairs(ic.cars) do
|
||||||
if type(car.entity) ~= 'boolean' then
|
if type(car.entity) ~= 'boolean' then
|
||||||
if not validate_entity(car.entity) then
|
if not validate_entity(car.entity) then
|
||||||
@ -971,7 +973,8 @@ function Public.use_door_with_entity(ic, player, door)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.item_transfer(ic)
|
function Public.item_transfer()
|
||||||
|
local ic = IC.get()
|
||||||
for _, car in pairs(ic.cars) do
|
for _, car in pairs(ic.cars) do
|
||||||
if validate_entity(car.entity) then
|
if validate_entity(car.entity) then
|
||||||
if car.transfer_entities then
|
if car.transfer_entities then
|
||||||
|
@ -84,11 +84,10 @@ local function on_player_driving_changed_state(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function on_tick()
|
local function on_tick()
|
||||||
local ic = IC.get()
|
|
||||||
local tick = game.tick
|
local tick = game.tick
|
||||||
|
|
||||||
if tick % 10 == 1 then
|
if tick % 10 == 1 then
|
||||||
Functions.item_transfer(ic)
|
Functions.item_transfer()
|
||||||
end
|
end
|
||||||
|
|
||||||
if tick % 240 == 0 then
|
if tick % 240 == 0 then
|
||||||
@ -96,7 +95,7 @@ local function on_tick()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if tick % 400 == 0 then
|
if tick % 400 == 0 then
|
||||||
Functions.remove_invalid_cars(ic)
|
Functions.remove_invalid_cars()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -206,12 +206,14 @@ local remove_lights_token =
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
function Public.glimpse_of_lights(icw)
|
function Public.glimpse_of_lights()
|
||||||
local surface = WPT.get('loco_surface')
|
local surface = WPT.get('loco_surface')
|
||||||
if not surface or not surface.valid then
|
if not surface or not surface.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local icw = ICW.get()
|
||||||
|
|
||||||
local hazardous_debris = icw.hazardous_debris
|
local hazardous_debris = icw.hazardous_debris
|
||||||
if not hazardous_debris then
|
if not hazardous_debris then
|
||||||
return
|
return
|
||||||
@ -240,12 +242,13 @@ function Public.glimpse_of_lights(icw)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.hazardous_debris(icw)
|
function Public.hazardous_debris()
|
||||||
local speed = icw.speed
|
|
||||||
local surface = WPT.get('loco_surface')
|
local surface = WPT.get('loco_surface')
|
||||||
if not surface or not surface.valid then
|
if not surface or not surface.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local icw = ICW.get()
|
||||||
|
local speed = icw.speed
|
||||||
|
|
||||||
local hazardous_debris = icw.hazardous_debris
|
local hazardous_debris = icw.hazardous_debris
|
||||||
if not hazardous_debris then
|
if not hazardous_debris then
|
||||||
@ -1077,7 +1080,8 @@ function Public.reconstruct_all_trains(icw)
|
|||||||
delete_empty_surfaces(icw)
|
delete_empty_surfaces(icw)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.item_transfer(icw)
|
function Public.item_transfer()
|
||||||
|
local icw = ICW.get()
|
||||||
local wagon
|
local wagon
|
||||||
icw.current_wagon_index, wagon = next(icw.wagons, icw.current_wagon_index)
|
icw.current_wagon_index, wagon = next(icw.wagons, icw.current_wagon_index)
|
||||||
if not wagon then
|
if not wagon then
|
||||||
@ -1136,7 +1140,8 @@ function Public.draw_minimap(icw, player, surface, position)
|
|||||||
element.position = position
|
element.position = position
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.update_minimap(icw)
|
function Public.update_minimap()
|
||||||
|
local icw = ICW.get()
|
||||||
for k, player in pairs(game.connected_players) do
|
for k, player in pairs(game.connected_players) do
|
||||||
local player_data = get_player_data(icw, player)
|
local player_data = get_player_data(icw, player)
|
||||||
if player.character and player.character.valid then
|
if player.character and player.character.valid then
|
||||||
|
@ -92,15 +92,14 @@ local function on_gui_click(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function on_tick()
|
local function on_tick()
|
||||||
local icw = ICW.get()
|
|
||||||
local tick = game.tick
|
local tick = game.tick
|
||||||
if tick % 10 == 0 then
|
if tick % 10 == 0 then
|
||||||
Functions.item_transfer(icw)
|
Functions.item_transfer()
|
||||||
Functions.hazardous_debris(icw)
|
Functions.hazardous_debris()
|
||||||
-- Functions.glimpse_of_lights(icw)
|
-- Functions.glimpse_of_lights()
|
||||||
end
|
end
|
||||||
if tick % 240 == 0 then
|
if tick % 240 == 0 then
|
||||||
Functions.update_minimap(icw)
|
Functions.update_minimap()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -416,14 +416,16 @@ local function fish_tag()
|
|||||||
locomotive_tag.destroy()
|
locomotive_tag.destroy()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
WPT.set().locomotive_tag =
|
WPT.set(
|
||||||
|
'locomotive_tag',
|
||||||
locomotive_cargo.force.add_chart_tag(
|
locomotive_cargo.force.add_chart_tag(
|
||||||
locomotive_cargo.surface,
|
locomotive_cargo.surface,
|
||||||
{
|
{
|
||||||
icon = {type = 'item', name = 'raw-fish'},
|
icon = {type = 'item', name = 'raw-fish'},
|
||||||
position = locomotive_cargo.position,
|
position = locomotive_cargo.position,
|
||||||
text = ' '
|
text = ' '
|
||||||
}
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -491,7 +493,6 @@ local function set_locomotive_health()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function validate_index()
|
local function validate_index()
|
||||||
local icw_table = ICW.get_table()
|
|
||||||
local locomotive = WPT.get('locomotive')
|
local locomotive = WPT.get('locomotive')
|
||||||
if not locomotive then
|
if not locomotive then
|
||||||
return
|
return
|
||||||
@ -500,6 +501,7 @@ local function validate_index()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local icw_table = ICW.get_table()
|
||||||
local icw_locomotive = WPT.get('icw_locomotive')
|
local icw_locomotive = WPT.get('icw_locomotive')
|
||||||
local loco_surface = icw_locomotive.surface
|
local loco_surface = icw_locomotive.surface
|
||||||
local unit_surface = locomotive.unit_number
|
local unit_surface = locomotive.unit_number
|
||||||
@ -1390,7 +1392,7 @@ end
|
|||||||
|
|
||||||
local function create_market(data, rebuild)
|
local function create_market(data, rebuild)
|
||||||
local surface = data.surface
|
local surface = data.surface
|
||||||
local this = data.this
|
local this = WPT.get()
|
||||||
|
|
||||||
if not this.locomotive then
|
if not this.locomotive then
|
||||||
return
|
return
|
||||||
@ -1666,26 +1668,26 @@ local function divide_contents()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function place_market()
|
local function place_market()
|
||||||
local this = WPT.get()
|
local locomotive = WPT.get('locomotive')
|
||||||
|
if not locomotive then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not locomotive.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local icw_table = ICW.get_table()
|
local icw_table = ICW.get_table()
|
||||||
if not this.locomotive then
|
local unit_surface = locomotive.unit_number
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not this.locomotive.valid then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local unit_surface = this.locomotive.unit_number
|
|
||||||
local surface = game.surfaces[icw_table.wagons[unit_surface].surface.index]
|
local surface = game.surfaces[icw_table.wagons[unit_surface].surface.index]
|
||||||
|
local market = WPT.get('market')
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
this = this,
|
|
||||||
surface = surface
|
surface = surface
|
||||||
}
|
}
|
||||||
if not this.market then
|
if not market then
|
||||||
create_market(data)
|
create_market(data)
|
||||||
elseif not this.market.valid then
|
elseif not market.valid then
|
||||||
create_market(data, true)
|
create_market(data, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1814,18 +1816,6 @@ local function on_player_driving_changed_state(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_player_left_game(event)
|
|
||||||
local player = game.players[event.player_index]
|
|
||||||
if not player or not player.valid then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local trusted = Session.get_trusted_table()
|
|
||||||
if trusted[player.name] then
|
|
||||||
trusted[player.name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Public.close_gui_player(frame)
|
function Public.close_gui_player(frame)
|
||||||
if not frame then
|
if not frame then
|
||||||
return
|
return
|
||||||
@ -2383,18 +2373,19 @@ end
|
|||||||
|
|
||||||
function Public.transfer_pollution()
|
function Public.transfer_pollution()
|
||||||
local locomotive = WPT.get('locomotive')
|
local locomotive = WPT.get('locomotive')
|
||||||
local active_surface_index = WPT.get('active_surface_index')
|
if not locomotive or not locomotive.valid then
|
||||||
local icw_locomotive = WPT.get('icw_locomotive')
|
|
||||||
local surface = icw_locomotive.surface
|
|
||||||
if not surface or not surface.valid then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local active_surface_index = WPT.get('active_surface_index')
|
||||||
local active_surface = game.surfaces[active_surface_index]
|
local active_surface = game.surfaces[active_surface_index]
|
||||||
if not active_surface or not active_surface.valid then
|
if not active_surface or not active_surface.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not locomotive or not locomotive.valid then
|
local icw_locomotive = WPT.get('icw_locomotive')
|
||||||
|
local surface = icw_locomotive.surface
|
||||||
|
if not surface or not surface.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2430,6 +2421,7 @@ function Public.enable_robotic_defense(pos)
|
|||||||
if not locomotive.valid then
|
if not locomotive.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
pos = pos or locomotive.position
|
pos = pos or locomotive.position
|
||||||
create_defense_system({x = pos.x, y = pos.y}, 'destroyer-capsule', pos)
|
create_defense_system({x = pos.x, y = pos.y}, 'destroyer-capsule', pos)
|
||||||
if random(1, 4) == 1 then
|
if random(1, 4) == 1 then
|
||||||
@ -2485,6 +2477,5 @@ Event.add(defines.events.on_robot_mined_entity, on_player_and_robot_mined_entity
|
|||||||
Event.add(defines.events.on_console_chat, on_console_chat)
|
Event.add(defines.events.on_console_chat, on_console_chat)
|
||||||
Event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
|
Event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
|
||||||
Event.add(defines.events.on_player_driving_changed_state, on_player_driving_changed_state)
|
Event.add(defines.events.on_player_driving_changed_state, on_player_driving_changed_state)
|
||||||
Event.add(defines.events.on_player_left_game, on_player_left_game)
|
|
||||||
|
|
||||||
return Public
|
return Public
|
||||||
|
@ -515,17 +515,4 @@ end
|
|||||||
Event.on_nth_tick(10, on_tick)
|
Event.on_nth_tick(10, on_tick)
|
||||||
Event.on_init(on_init)
|
Event.on_init(on_init)
|
||||||
|
|
||||||
local gMeta = getmetatable(_ENV)
|
|
||||||
if not gMeta then
|
|
||||||
gMeta = {}
|
|
||||||
setmetatable(_ENV, gMeta)
|
|
||||||
end
|
|
||||||
|
|
||||||
gMeta.__newindex = function(_, n, v)
|
|
||||||
log('Desync warning: attempt to write to undeclared var ' .. n)
|
|
||||||
global[n] = v
|
|
||||||
end
|
|
||||||
gMeta.__index = function(_, n)
|
|
||||||
return global[n]
|
|
||||||
end
|
|
||||||
return Public
|
return Public
|
||||||
|
@ -363,7 +363,7 @@ local function randomness_scrap(data)
|
|||||||
local spill_items_to_surface = WPT.get('spill_items_to_surface')
|
local spill_items_to_surface = WPT.get('spill_items_to_surface')
|
||||||
|
|
||||||
local harvest = scrap_raffle[random(1, size_of_scrap_raffle)]
|
local harvest = scrap_raffle[random(1, size_of_scrap_raffle)]
|
||||||
local amount_bonus = (game.forces.enemy.evolution_factor * 2) + (game.forces.player.mining_drill_productivity_bonus * 2)
|
local amount_bonus = game.forces.player.mining_drill_productivity_bonus * 2
|
||||||
local r1 = math.ceil(scrap_yield_amounts[harvest] * (0.3 + (amount_bonus * 0.3)))
|
local r1 = math.ceil(scrap_yield_amounts[harvest] * (0.3 + (amount_bonus * 0.3)))
|
||||||
local r2 = math.ceil(scrap_yield_amounts[harvest] * (1.7 + (amount_bonus * 1.7)))
|
local r2 = math.ceil(scrap_yield_amounts[harvest] * (1.7 + (amount_bonus * 1.7)))
|
||||||
local harvest_amount = math.random(r1, r2)
|
local harvest_amount = math.random(r1, r2)
|
||||||
|
Loading…
Reference in New Issue
Block a user