1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-30 23:17:53 +02:00

Mtn v3 - minor changes

This commit is contained in:
Gerkiz 2023-11-23 16:00:02 +01:00
parent e4eb7b2f18
commit 946729bdc1
6 changed files with 36 additions and 35 deletions

View File

@ -1,5 +1,6 @@
local Public = require 'maps.mountain_fortress_v3.table'
Public.stateful = require 'maps.mountain_fortress_v3.stateful.main'
Public.balance = require 'maps.mountain_fortress_v3.balance'
Public.basic_markets = require 'maps.mountain_fortress_v3.basic_markets'
Public.biters_yield_coins = require 'maps.mountain_fortress_v3.biters_yield_coins'
@ -27,6 +28,5 @@ Public.friendly_pet = require 'maps.mountain_fortress_v3.locomotive.friendly_pet
Public.market = require 'maps.mountain_fortress_v3.locomotive.market'
Public.permission_groups = require 'maps.mountain_fortress_v3.locomotive.permission_groups'
Public.spawn_locomotive = require 'maps.mountain_fortress_v3.locomotive.spawn_locomotive'
Public.stateful = require 'maps.mountain_fortress_v3.stateful.main'
return Public

View File

@ -1002,16 +1002,19 @@ function Public.render_direction(surface)
text = 'Welcome to Wintery Mountain Fortress v3!'
end
rendering.draw_text {
text = 'Season: ' .. Public.stateful.get_stateful('season'),
surface = surface,
target = {-0, 12},
color = {r = 0.98, g = 0.77, b = 0.22},
scale = 3,
font = 'heading-1',
alignment = 'center',
scale_with_zoom = false
}
Public.set(
'current_season',
rendering.draw_text {
text = 'Season: ' .. Public.stateful.get_stateful('season'),
surface = surface,
target = {-0, 12},
color = {r = 0.98, g = 0.77, b = 0.22},
scale = 3,
font = 'heading-1',
alignment = 'center',
scale_with_zoom = false
}
)
if counter then
rendering.draw_text {

View File

@ -226,6 +226,8 @@ function Public.locomotive_spawn(surface, position)
for _ = 1, extra_wagons do
local new_wagon = surface.create_entity({name = 'cargo-wagon', position = new_position, force = 'player', defines.direction.north})
if new_wagon and new_wagon.valid then
new_wagon.minable = false
new_wagon.operable = true
inc = inc + 7
new_position = {x = pos.x, y = pos.y + inc}
ICW.register_wagon(new_wagon)

View File

@ -450,7 +450,7 @@ local killed_enemies_token =
local actual = Public.get_killed_enemies_count('biter', 'spitter')
local expected = this.objectives.killed_enemies
if actual >= expected then
return true, {'stateful.enemies_killed'}, {'stateful.done', format_number(expected, true), format_number(expected)}, {'stateful.generic_tooltip'}, {'stateful.tooltip_completed'}
return true, {'stateful.enemies_killed'}, {'stateful.done', format_number(expected, true), format_number(expected, true)}, {'stateful.generic_tooltip'}, {'stateful.tooltip_completed'}
end
return false, {'stateful.enemies_killed'}, {'stateful.not_done', format_number(actual, true), format_number(expected, true)}, {'stateful.generic_tooltip'}, {'stateful.tooltip_not_completed'}
@ -855,6 +855,10 @@ local apply_settings_token =
settings.current_date = tonumber(current_time)
end
if not settings.season then
settings.season = 1
end
this.current_date = settings.current_date
this.buffs = settings.buffs
@ -863,6 +867,9 @@ local apply_settings_token =
this.rounds_survived = settings.rounds_survived
this.season = settings.season
local current_season = Public.get('current_season')
rendering.set_text(current_season, 'Season: ' .. this.season)
Public.reset_stateful()
Public.increase_enemy_damage_and_health()
end
@ -1291,10 +1298,10 @@ if _DEBUG then
{name = 'worker_robots_speed_modifier', modifier = 'force', state = 0.05},
{name = 'worker_robots_speed_modifier', modifier = 'force', state = 0.05},
{name = 'distance', modifier = 'rpg_distance', modifiers = {'character_resource_reach_distance_bonus', 'character_item_pickup_distance_bonus', 'character_loot_pickup_distance_bonus', 'character_reach_distance_bonus'}, state = 1},
{name = 'xp_level', modifier = 'rpg', state = 16},
{name = 'xp_level', modifier = 'rpg', state = 256},
{name = 'manual_mining_speed_modifier', modifier = 'force', state = 0.05},
{name = 'defense', modifier = 'starting_items', items = {{name = 'gun-turret', count = 2}, {name = 'firearm-magazine', count = 100}}},
{name = 'xp_level', modifier = 'rpg', state = 16},
{name = 'xp_level', modifier = 'rpg', state = 256},
{name = 'production', modifier = 'starting_items', items = {{name = 'stone-furnace', count = 4}, {name = 'coal', count = 100}}},
{
name = 'production_1',

View File

@ -2,6 +2,7 @@ local Public = require 'modules.rpg.table'
local Token = require 'utils.token'
local Task = require 'utils.task'
local Ai = require 'modules.ai'
local Modifiers = require 'utils.player_modifiers'
local spells = {}
local random = math.random
@ -87,7 +88,6 @@ local restore_movement_speed_token =
Token.register(
function(event)
local player_index = event.player_index
local old_speed = event.old_speed
local rpg_t = event.rpg_t
if rpg_t then
@ -103,7 +103,8 @@ local restore_movement_speed_token =
return
end
player.character.character_running_speed_modifier = old_speed
Modifiers.update_single_modifier(player, 'character_running_speed_modifier', 'rpg_spell', 0)
Modifiers.update_player_modifiers(player)
end
)
@ -1045,8 +1046,9 @@ spells[#spells + 1] = {
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}
end
Task.set_timeout_in_ticks(300, restore_movement_speed_token, {player_index = player.index, old_speed = player.character.character_running_speed_modifier, rpg_t = rpg_t})
player.character.character_running_speed_modifier = player.character.character_running_speed_modifier + 1
Task.set_timeout_in_ticks(300, restore_movement_speed_token, {player_index = player.index, rpg_t = rpg_t})
Modifiers.update_single_modifier(player, 'character_running_speed_modifier', 'rpg_spell', 1)
Modifiers.update_player_modifiers(player)
Public.cast_spell(player)
return true
end

View File

@ -58,19 +58,6 @@ local function remove_camera_frame(player)
end
end
local function validate_player(player)
if not player then
return false
end
if not player.valid then
return false
end
if player.admin then
return false
end
return true
end
local function validate_frame(frame)
if not frame then
return false
@ -94,7 +81,7 @@ local function create_mini_camera_gui(player, target, zoom, render, tooltip)
end
local player_data
if validate_player(target) or (target and target.valid and player.admin) then
if target and target.valid and player.admin or target and target.valid then
player_data = create_player_data(player)
player_data.target = target
else
@ -158,7 +145,7 @@ commands.add_command(
function(cmd)
local player = game.player
if validate_player(player) then
if player and player.valid then
if not cmd.parameter then
return
end
@ -169,7 +156,7 @@ commands.add_command(
local target = game.get_player(cmd.parameter)
if validate_player(target) then
if target and target.valid then
local player_data = create_player_data(player)
player_data.target = target
create_mini_camera_gui(player, target)
@ -190,7 +177,7 @@ local function on_nth_tick()
local camera_frame = data.camera_frame
local player = game.get_player(p)
if not (validate_player(player) or validate_player(target)) then
if not (player and player.valid or target and target.valid) then
remove_player_data(player)
goto continue
end