mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-08 00:39:30 +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 = {
|
||||
['artillery-shell'] = -1.3,
|
||||
['biological'] = 0,
|
||||
['beam'] = 0,
|
||||
['bullet'] = 0,
|
||||
['cannon-shell'] = 0,
|
||||
['capsule'] = 0,
|
||||
['electric'] = 0,
|
||||
['flamethrower'] = 0,
|
||||
['grenade'] = 0,
|
||||
['laser'] = 0,
|
||||
['landmine'] = 0,
|
||||
['melee'] = 0,
|
||||
['rocket'] = 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
|
||||
|
||||
e.technologies['refined-flammables-1'].researched = true
|
||||
@ -49,27 +40,16 @@ local function enemy_weapon_damage()
|
||||
local data = {
|
||||
['artillery-shell'] = 0.05,
|
||||
['biological'] = 0.06,
|
||||
['beam'] = 0.08,
|
||||
['bullet'] = 0.08,
|
||||
['capsule'] = 0.08,
|
||||
['electric'] = 0.08,
|
||||
['flamethrower'] = 0.08,
|
||||
--['grenade'] = 0.08,
|
||||
['laser'] = 0.08,
|
||||
['landmine'] = 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
|
||||
local new = Difficulty.get().difficulty_vote_value * v
|
||||
|
||||
@ -81,6 +61,4 @@ end
|
||||
|
||||
Event.add(Public.events.breached_wall, enemy_weapon_damage)
|
||||
|
||||
--Event.on_nth_tick(54000, enemy_weapon_damage)
|
||||
|
||||
return Public
|
||||
|
@ -1,3 +1,4 @@
|
||||
local Event = require 'utils.event'
|
||||
local WPT = require 'maps.mountain_fortress_v3.table'
|
||||
|
||||
local nom_msg = {'munch', 'munch', 'yum'}
|
||||
@ -193,8 +194,7 @@ local function on_player_dropped_item(event)
|
||||
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_changed_position, on_player_changed_position)
|
||||
Event.add(defines.events.on_player_dropped_item, on_player_dropped_item)
|
||||
Event.add(defines.events.on_player_changed_position, on_player_changed_position)
|
||||
|
||||
return Public
|
||||
|
@ -227,7 +227,12 @@ local function set_train_final_health(final_damage_amount)
|
||||
local poison_deployed = WPT.get('poison_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
|
||||
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)
|
||||
WPT.set().poison_deployed = true
|
||||
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
|
||||
local carriages = WPT.get('carriages')
|
||||
|
||||
|
@ -3,6 +3,7 @@ local Color = require 'utils.color_presets'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
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 Public = {}
|
||||
@ -856,7 +857,8 @@ function Public.create_car(ic, event)
|
||||
return car
|
||||
end
|
||||
|
||||
function Public.remove_invalid_cars(ic)
|
||||
function Public.remove_invalid_cars()
|
||||
local ic = IC.get()
|
||||
for k, car in pairs(ic.cars) do
|
||||
if type(car.entity) ~= 'boolean' then
|
||||
if not validate_entity(car.entity) then
|
||||
@ -971,7 +973,8 @@ function Public.use_door_with_entity(ic, player, door)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.item_transfer(ic)
|
||||
function Public.item_transfer()
|
||||
local ic = IC.get()
|
||||
for _, car in pairs(ic.cars) do
|
||||
if validate_entity(car.entity) then
|
||||
if car.transfer_entities then
|
||||
|
@ -84,11 +84,10 @@ local function on_player_driving_changed_state(event)
|
||||
end
|
||||
|
||||
local function on_tick()
|
||||
local ic = IC.get()
|
||||
local tick = game.tick
|
||||
|
||||
if tick % 10 == 1 then
|
||||
Functions.item_transfer(ic)
|
||||
Functions.item_transfer()
|
||||
end
|
||||
|
||||
if tick % 240 == 0 then
|
||||
@ -96,7 +95,7 @@ local function on_tick()
|
||||
end
|
||||
|
||||
if tick % 400 == 0 then
|
||||
Functions.remove_invalid_cars(ic)
|
||||
Functions.remove_invalid_cars()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -206,12 +206,14 @@ local remove_lights_token =
|
||||
end
|
||||
)
|
||||
|
||||
function Public.glimpse_of_lights(icw)
|
||||
function Public.glimpse_of_lights()
|
||||
local surface = WPT.get('loco_surface')
|
||||
if not surface or not surface.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local icw = ICW.get()
|
||||
|
||||
local hazardous_debris = icw.hazardous_debris
|
||||
if not hazardous_debris then
|
||||
return
|
||||
@ -240,12 +242,13 @@ function Public.glimpse_of_lights(icw)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.hazardous_debris(icw)
|
||||
local speed = icw.speed
|
||||
function Public.hazardous_debris()
|
||||
local surface = WPT.get('loco_surface')
|
||||
if not surface or not surface.valid then
|
||||
return
|
||||
end
|
||||
local icw = ICW.get()
|
||||
local speed = icw.speed
|
||||
|
||||
local hazardous_debris = icw.hazardous_debris
|
||||
if not hazardous_debris then
|
||||
@ -1077,7 +1080,8 @@ function Public.reconstruct_all_trains(icw)
|
||||
delete_empty_surfaces(icw)
|
||||
end
|
||||
|
||||
function Public.item_transfer(icw)
|
||||
function Public.item_transfer()
|
||||
local icw = ICW.get()
|
||||
local wagon
|
||||
icw.current_wagon_index, wagon = next(icw.wagons, icw.current_wagon_index)
|
||||
if not wagon then
|
||||
@ -1136,7 +1140,8 @@ function Public.draw_minimap(icw, player, surface, position)
|
||||
element.position = position
|
||||
end
|
||||
|
||||
function Public.update_minimap(icw)
|
||||
function Public.update_minimap()
|
||||
local icw = ICW.get()
|
||||
for k, player in pairs(game.connected_players) do
|
||||
local player_data = get_player_data(icw, player)
|
||||
if player.character and player.character.valid then
|
||||
|
@ -92,15 +92,14 @@ local function on_gui_click(event)
|
||||
end
|
||||
|
||||
local function on_tick()
|
||||
local icw = ICW.get()
|
||||
local tick = game.tick
|
||||
if tick % 10 == 0 then
|
||||
Functions.item_transfer(icw)
|
||||
Functions.hazardous_debris(icw)
|
||||
-- Functions.glimpse_of_lights(icw)
|
||||
Functions.item_transfer()
|
||||
Functions.hazardous_debris()
|
||||
-- Functions.glimpse_of_lights()
|
||||
end
|
||||
if tick % 240 == 0 then
|
||||
Functions.update_minimap(icw)
|
||||
Functions.update_minimap()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -416,14 +416,16 @@ local function fish_tag()
|
||||
locomotive_tag.destroy()
|
||||
end
|
||||
end
|
||||
WPT.set().locomotive_tag =
|
||||
WPT.set(
|
||||
'locomotive_tag',
|
||||
locomotive_cargo.force.add_chart_tag(
|
||||
locomotive_cargo.surface,
|
||||
{
|
||||
icon = {type = 'item', name = 'raw-fish'},
|
||||
position = locomotive_cargo.position,
|
||||
text = ' '
|
||||
}
|
||||
locomotive_cargo.surface,
|
||||
{
|
||||
icon = {type = 'item', name = 'raw-fish'},
|
||||
position = locomotive_cargo.position,
|
||||
text = ' '
|
||||
}
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
@ -491,7 +493,6 @@ local function set_locomotive_health()
|
||||
end
|
||||
|
||||
local function validate_index()
|
||||
local icw_table = ICW.get_table()
|
||||
local locomotive = WPT.get('locomotive')
|
||||
if not locomotive then
|
||||
return
|
||||
@ -500,6 +501,7 @@ local function validate_index()
|
||||
return
|
||||
end
|
||||
|
||||
local icw_table = ICW.get_table()
|
||||
local icw_locomotive = WPT.get('icw_locomotive')
|
||||
local loco_surface = icw_locomotive.surface
|
||||
local unit_surface = locomotive.unit_number
|
||||
@ -1390,7 +1392,7 @@ end
|
||||
|
||||
local function create_market(data, rebuild)
|
||||
local surface = data.surface
|
||||
local this = data.this
|
||||
local this = WPT.get()
|
||||
|
||||
if not this.locomotive then
|
||||
return
|
||||
@ -1666,26 +1668,26 @@ local function divide_contents()
|
||||
end
|
||||
|
||||
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()
|
||||
if not this.locomotive then
|
||||
return
|
||||
end
|
||||
|
||||
if not this.locomotive.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local unit_surface = this.locomotive.unit_number
|
||||
local unit_surface = locomotive.unit_number
|
||||
local surface = game.surfaces[icw_table.wagons[unit_surface].surface.index]
|
||||
local market = WPT.get('market')
|
||||
|
||||
local data = {
|
||||
this = this,
|
||||
surface = surface
|
||||
}
|
||||
if not this.market then
|
||||
if not market then
|
||||
create_market(data)
|
||||
elseif not this.market.valid then
|
||||
elseif not market.valid then
|
||||
create_market(data, true)
|
||||
end
|
||||
end
|
||||
@ -1814,18 +1816,6 @@ local function on_player_driving_changed_state(event)
|
||||
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)
|
||||
if not frame then
|
||||
return
|
||||
@ -2383,18 +2373,19 @@ end
|
||||
|
||||
function Public.transfer_pollution()
|
||||
local locomotive = WPT.get('locomotive')
|
||||
local active_surface_index = WPT.get('active_surface_index')
|
||||
local icw_locomotive = WPT.get('icw_locomotive')
|
||||
local surface = icw_locomotive.surface
|
||||
if not surface or not surface.valid then
|
||||
if not locomotive or not locomotive.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local active_surface_index = WPT.get('active_surface_index')
|
||||
local active_surface = game.surfaces[active_surface_index]
|
||||
if not active_surface or not active_surface.valid then
|
||||
return
|
||||
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
|
||||
end
|
||||
|
||||
@ -2430,6 +2421,7 @@ function Public.enable_robotic_defense(pos)
|
||||
if not locomotive.valid then
|
||||
return
|
||||
end
|
||||
|
||||
pos = pos or locomotive.position
|
||||
create_defense_system({x = pos.x, y = pos.y}, 'destroyer-capsule', pos)
|
||||
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_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_left_game, on_player_left_game)
|
||||
|
||||
return Public
|
||||
|
@ -515,17 +515,4 @@ end
|
||||
Event.on_nth_tick(10, on_tick)
|
||||
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
|
||||
|
@ -363,7 +363,7 @@ local function randomness_scrap(data)
|
||||
local spill_items_to_surface = WPT.get('spill_items_to_surface')
|
||||
|
||||
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 r2 = math.ceil(scrap_yield_amounts[harvest] * (1.7 + (amount_bonus * 1.7)))
|
||||
local harvest_amount = math.random(r1, r2)
|
||||
|
Loading…
Reference in New Issue
Block a user