mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-25 21:29:06 +02:00
In-progress: markets not tested, also somehow dies when captain is passed?
This commit is contained in:
parent
af41fa1aed
commit
9e9c063295
@ -70,9 +70,9 @@ parrot_kraken_warning=400 leagues coming up? What are those pink things I spy...
|
||||
parrot_radioactive_tip_1=We'll need uranium-235 to push away from this island...
|
||||
parrot_radioactive_tip_2=The biters don't care if we pollute here, but they evolve fast.
|
||||
parrot_maze_tip_1=Something seems wrong with our minimap.
|
||||
parrot_captain_first_time_in_cabin_hint=The captain can buy items in the cabin, such as rail signals to steer the ship.
|
||||
parrot_cliff_explosive_tip=Cliff explosives? I remember they're powerful enough to blow those annoying chests in our hold.
|
||||
parrot_burried_treasure_tip=If X marks the spot - use inserters to dig!
|
||||
parrot_captain_first_time_in_cabin_hint=Squawk! Captains and officers can buy rail signals to steer the ship!
|
||||
parrot_cliff_explosive_tip=Cliff explosives? These look so powerful, they could blow away those annoying chests in the hold. Squawk!
|
||||
parrot_burried_treasure_tip=Squawk! If X marks the spot - find an item to dig with!
|
||||
|
||||
|
||||
|
||||
@ -98,6 +98,8 @@ ship_undocked_2=[font=heading-1]Ship auto-undocked[/font]. Return to ship.
|
||||
ship_undocked_3=[font=heading-1]Ship auto-undocked[/font].
|
||||
|
||||
ship_set_off_to_next_island=[font=heading-1]Ship set sail[/font] for the next destination.
|
||||
crew_continue_on_freeplay=The run now continues on 'Freeplay'.
|
||||
victory_continue_reminder=If you wish to continue the game, click up top.
|
||||
|
||||
plank=__1__ planked __2__!
|
||||
plank_error_invalid_player=Command error: Player is not a crewmember.
|
||||
@ -354,7 +356,6 @@ proposal_abandoned=Proposal __1__ abandoned.
|
||||
loading_new_game=Loading new game...
|
||||
|
||||
crew_summon=Crew summoned.
|
||||
crew_continue_on_freeplay=The run now continues on 'Freeplay'.
|
||||
crew_disbanded=__1__ disbanded __2__ after __3__.
|
||||
|
||||
|
||||
@ -404,7 +405,7 @@ resources_needed_tooltip_0_rocketvariant=At the next destination, these resource
|
||||
resources_needed_tooltip_1_rocketvariant=At the next destination, these resources will be needed in order to undock early.\n\nFewer resources will be needed the longer you stay, eventually dropping to zero.\n\nThe silo represents a rocket launch rather than a resource.
|
||||
resources_needed_tooltip_2_rocketvariant=The captain can undock early by clicking this button, but only if enough resources have been stored in the captain's cabin.\n\nThe silo represents a rocket launch rather than a resource.\n\nnCost on arrival: __1__\nLeaving now will spend: __2__
|
||||
resources_needed_tooltip_3_rocketvariant=The captain can undock by clicking this button, but only if enough resources are stored in the captain's cabin.\n\nThe silo represents a rocket launch rather than a resource.
|
||||
fuel_tooltip=Stored fuel: __1__.\n\nTo store more, send it to the captain's cabin. If the ship runs out of fuel, the crew loses.
|
||||
fuel_tooltip=Stored fuel: __1__.\n\nTo store more, send coal to the captain's cabin. If the ship runs out of fuel, the crew loses.
|
||||
|
||||
|
||||
gui_crew_window_buttons_quit_crew=Quit Crew
|
||||
|
@ -58,7 +58,7 @@ function Public.silo_die()
|
||||
if CoreData.rocket_silo_death_causes_loss then
|
||||
-- Crew.lose_life()
|
||||
Crew.try_lose({'pirates.loss_silo_destroyed'})
|
||||
elseif (not destination.dynamic_data.rocketlaunched) and destination.static_params and destination.static_params.base_cost_to_undock and destination.static_params.base_cost_to_undock['launch_rocket'] and destination.static_params.base_cost_to_undock['launch_rocket'] == true then
|
||||
elseif (not destination.dynamic_data.rocketlaunched) and destination.static_params and destination.static_params.base_cost_to_undock and destination.static_params.base_cost_to_undock['launch_rocket'] and destination.static_params.base_cost_to_undock['launch_rocket'] == true and (not (destination.dynamic_data.time_remaining and destination.dynamic_data.time_remaining > 0)) then
|
||||
Crew.try_lose({'pirates.loss_silo_destroyed_before_necessary_launch'})
|
||||
elseif (not destination.dynamic_data.rocketlaunched) then
|
||||
Common.notify_force(force, {'pirates.silo_destroyed'})
|
||||
@ -285,7 +285,7 @@ local function damage_to_krakens(event)
|
||||
end
|
||||
-- and additionally:
|
||||
if event.cause.name == 'artillery-turret' then
|
||||
adjusted_damage = adjusted_damage / 1.4
|
||||
adjusted_damage = adjusted_damage / 1.5
|
||||
end
|
||||
|
||||
if event.damage_type.name and (event.damage_type.name == 'laser') then
|
||||
@ -1828,6 +1828,7 @@ local function event_on_rocket_launched(event)
|
||||
for i = 1, #destination.dynamic_data.rocketsilos do
|
||||
local s = destination.dynamic_data.rocketsilos[i]
|
||||
if s and s.valid then
|
||||
s.destructible = true
|
||||
s.die()
|
||||
end
|
||||
end
|
||||
|
@ -190,6 +190,17 @@ function Public.ship_deplete_fuel(tickinterval)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.victory_continue_reminder()
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
if memory.victory_continue_reminder and game.tick >= memory.victory_continue_reminder then
|
||||
memory.victory_continue_reminder = nil
|
||||
if memory.boat.state == Boats.enum_state.ATSEA_WAITING_TO_SAIL then
|
||||
Common.notify_force(memory.force, {'pirates.victory_continue_reminder'}, CoreData.colors.notify_victory)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.transfer_pollution(tickinterval)
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
|
@ -15,7 +15,7 @@ local Common = require 'maps.pirates.common'
|
||||
-- Kraken related parameters
|
||||
Public.biter_swim_speed = 1
|
||||
Public.kraken_biter_spawn_radius = 6 -- only used during non automatic forced spawning during kraken's "special ability"
|
||||
Public.kraken_spit_targeting_player_chance = 0.1
|
||||
Public.kraken_spit_targeting_player_chance = 0
|
||||
|
||||
Public.base_extra_character_speed = 1.44
|
||||
Public.respawn_speed_boost = 1.85
|
||||
@ -162,7 +162,7 @@ Public.rockets_needed_x = 40*21
|
||||
|
||||
function Public.max_time_on_island()
|
||||
local x = Common.overworldx()
|
||||
if x == 0 or (x >= Public.rockets_needed_x) then
|
||||
if x == 0 or (x >= Public.rockets_needed_x and x ~= 40*22) then
|
||||
-- if Common.overworldx() == 0 or ((Common.overworldx()/40) > 20 and (Common.overworldx()/40) < 25) then
|
||||
return -1
|
||||
else
|
||||
@ -399,7 +399,7 @@ function Public.quest_furnace_entry_price_scale()
|
||||
end
|
||||
|
||||
function Public.apply_crew_buffs_per_league(force, leagues_travelled)
|
||||
force.laboratory_productivity_bonus = force.laboratory_productivity_bonus + Math.max(0, 6/100 * leagues_travelled/40)
|
||||
force.laboratory_productivity_bonus = force.laboratory_productivity_bonus + Math.max(0, 7/100 * leagues_travelled/40)
|
||||
end
|
||||
|
||||
function Public.class_cost(at_dock)
|
||||
@ -423,7 +423,7 @@ Public.silo_resistance_factor = 7
|
||||
|
||||
function Public.pistol_damage_multiplier() return 2.25 end --2.0 slightly too low, 2.5 causes players to yell at each other for not using pistol
|
||||
|
||||
Public.kraken_spawns_base_extra_evo = 0.35
|
||||
Public.kraken_static_evo = 0.35
|
||||
|
||||
function Public.kraken_evo_increase_per_shot()
|
||||
-- return 1/100 * 0.08
|
||||
@ -443,10 +443,10 @@ function Public.sandworm_evo_increase_per_spawn()
|
||||
end
|
||||
|
||||
function Public.kraken_kill_reward_items()
|
||||
return {{name = 'sulfuric-acid-barrel', count = 5}, {name = 'coin', count = 800}}
|
||||
return {{name = 'coin', count = 800}, {name = 'utility-science-pack', count = 10}}
|
||||
end
|
||||
function Public.kraken_kill_reward_fuel()
|
||||
return 200
|
||||
return 150
|
||||
end
|
||||
|
||||
function Public.kraken_health()
|
||||
|
@ -43,7 +43,6 @@ function Public.difficulty_vote(player_index, difficulty_id)
|
||||
if memory.difficulty_votes[player_index] and memory.difficulty_votes[player_index] == difficulty_id then
|
||||
return nil
|
||||
else
|
||||
log(_inspect(CoreData.difficulty_options))
|
||||
local option = CoreData.difficulty_options[difficulty_id]
|
||||
if not option then return end
|
||||
|
||||
@ -163,7 +162,8 @@ function Public.try_win()
|
||||
|
||||
game.play_sound{path='utility/game_won', volume_modifier=0.9}
|
||||
|
||||
memory.victory_pause_until_tick = game.tick + 60*18
|
||||
memory.boat.state = Boats.enum_state.ATSEA_WAITING_TO_SAIL
|
||||
memory.victory_continue_reminder = game.tick + 60*14
|
||||
memory.victory_continue_message = true
|
||||
end
|
||||
end
|
||||
@ -847,6 +847,7 @@ function Public.reset_crew_and_enemy_force(id)
|
||||
-- crew_force.character_running_speed_modifier = Balance.base_extra_character_speed
|
||||
crew_force.laboratory_productivity_bonus = 0
|
||||
crew_force.ghost_time_to_live = 12 * 60 * 60
|
||||
crew_force.worker_robots_speed_modifier = 0.5
|
||||
|
||||
for k, v in pairs(Balance.player_ammo_damage_modifiers()) do
|
||||
crew_force.set_ammo_damage_modifier(k, v)
|
||||
|
@ -82,7 +82,6 @@ function Public.full_update(player)
|
||||
local types = {'leagues', 'kraken', 'time', 'silo', 'nests', 'sandwurms'}
|
||||
|
||||
if Boats.is_boat_at_sea() then
|
||||
evolution_leagues = evo - (memory.kraken_evo or 0)
|
||||
local krakens = false
|
||||
if memory.active_sea_enemies and memory.active_sea_enemies.krakens then
|
||||
for i = 1, Kraken.kraken_slots do
|
||||
@ -90,10 +89,12 @@ function Public.full_update(player)
|
||||
end
|
||||
end
|
||||
if krakens then
|
||||
evolution_kraken = Balance.kraken_spawns_base_extra_evo + (memory.kraken_evo or 0)
|
||||
evolution_total = evolution_leagues + Balance.kraken_spawns_base_extra_evo
|
||||
evolution_leagues = evo - (memory.dynamic_kraken_evo or 0)
|
||||
evolution_kraken = Balance.kraken_static_evo + (memory.dynamic_kraken_evo or 0)
|
||||
evolution_total = evo + Balance.kraken_static_evo
|
||||
else
|
||||
evolution_total = evolution_leagues
|
||||
evolution_leagues = evo
|
||||
evolution_total = evo
|
||||
end
|
||||
else
|
||||
if destination and destination.dynamic_data then
|
||||
@ -103,7 +104,7 @@ function Public.full_update(player)
|
||||
evolution_silo = destination.dynamic_data.evolution_accrued_silo
|
||||
evolution_sandwurms = destination.dynamic_data.evolution_accrued_sandwurms
|
||||
end
|
||||
evolution_total = (evolution_leagues or 0) + (evolution_time or 0) + (evolution_nests or 0) + (evolution_silo or 0) + (evolution_sandwurms or 0)
|
||||
evolution_total = (evolution_leagues or 0) + (evolution_time or 0) + (evolution_nests or 0) + (evolution_silo or 0) + (evolution_sandwurms or 0) + (evolution_kraken or 0)
|
||||
end
|
||||
|
||||
local str = {'',{'pirates.gui_evo_tooltip_1', string.format('%.2f', evolution_total)}}
|
||||
@ -142,6 +143,20 @@ function Public.full_update(player)
|
||||
|
||||
button.number = evolution_total
|
||||
button.tooltip = str
|
||||
|
||||
if evolution_total > 1.0 then
|
||||
button.sprite = 'entity/behemoth-worm-turret'
|
||||
elseif evolution_total >= 0.9 then
|
||||
button.sprite = 'entity/behemoth-biter'
|
||||
elseif evolution_total >= 0.5 then
|
||||
button.sprite = 'entity/big-biter'
|
||||
elseif evolution_total >= 0.4 then
|
||||
button.sprite = 'entity/medium-spitter'
|
||||
elseif evolution_total >= 0.2 then
|
||||
button.sprite = 'entity/medium-biter'
|
||||
else
|
||||
button.sprite = 'entity/small-biter'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -184,6 +184,7 @@ local function crew_tick()
|
||||
PiratesApiOnTick.check_for_cliff_explosives_in_hold_wooden_chests()
|
||||
PiratesApiOnTick.equalise_fluid_storages() -- Made the update less often for small performance gain, but frequency can be increased if players complain
|
||||
PiratesApiOnTick.revealed_buried_treasure_distance_check()
|
||||
PiratesApiOnTick.victory_continue_reminder()
|
||||
Kraken.overall_kraken_tick()
|
||||
|
||||
if destination.dynamic_data.timer then
|
||||
|
@ -32,6 +32,223 @@ local Highscore = require 'maps.pirates.highscore'
|
||||
local CustomEvents = require 'maps.pirates.custom_events'
|
||||
|
||||
|
||||
local NIL = 'none'
|
||||
local DOCK = 'dock'
|
||||
local FIRST = Surfaces.Island.enum.FIRST
|
||||
local RED_DESERT = Surfaces.Island.enum.RED_DESERT
|
||||
local SWAMP = Surfaces.Island.enum.SWAMP
|
||||
local STANDARD = Surfaces.Island.enum.STANDARD
|
||||
local WALKWAYS = Surfaces.Island.enum.WALKWAYS
|
||||
local MAZE = Surfaces.Island.enum.MAZE
|
||||
local RADIOACTIVE = Surfaces.Island.enum.RADIOACTIVE
|
||||
local HORSESHOE = Surfaces.Island.enum.HORSESHOE
|
||||
local STANDARD_VARIANT = Surfaces.Island.enum.STANDARD_VARIANT
|
||||
|
||||
local A = {NIL, NIL, STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS}
|
||||
local B = {NIL, NIL, NIL, STANDARD, STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS}
|
||||
local C = {STANDARD, STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS}
|
||||
local D = {NIL, NIL, NIL, STANDARD, STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS, SWAMP}
|
||||
|
||||
local destinationScheme = {
|
||||
[0] = {DOCK, FIRST, NIL},
|
||||
[1] = {HORSESHOE, HORSESHOE, HORSESHOE}, --map where you break rocks
|
||||
[2] = {STANDARD_VARIANT, STANDARD_VARIANT, STANDARD_VARIANT}, --aesthetically different to previous map
|
||||
[3] = {DOCK, NIL, NIL},
|
||||
[4] = {A, A, A},
|
||||
[5] = {STANDARD, STANDARD, STANDARD}, --biter boats appear. large island works well so players run off
|
||||
[6] = {MAZE, MAZE, MAZE},
|
||||
[7] = {DOCK, B, B},
|
||||
[8] = {NIL, NIL, NIL},
|
||||
[9] = {B, B, B},
|
||||
[10] = {NIL, NIL, NIL},
|
||||
[11] = {DOCK, B, B},
|
||||
[12] = {SWAMP, SWAMP, C}, --gotta steer if you don't want to do swamp
|
||||
[13] = {B, B, B},
|
||||
[14] = {B, B, B},
|
||||
[15] = {DOCK, B, B},
|
||||
[16] = {RADIOACTIVE, RADIOACTIVE, RADIOACTIVE},
|
||||
[17] = {B, B, B},
|
||||
[18] = {C, C, C}, --first showing of robot frame cost
|
||||
[19] = {DOCK, B, B},
|
||||
[20] = {NIL, NIL, NIL},
|
||||
[21] = {WALKWAYS, WALKWAYS, WALKWAYS}, --rocket launch cost
|
||||
[22] = {SWAMP, RED_DESERT, STANDARD_VARIANT}, -- uniquely, this has a rocket launch cost, but still has an auto-undock timer
|
||||
[23] = {C, C, C},
|
||||
[24] = {MAZE, MAZE, MAZE}, -- current 'boss map'
|
||||
[25] = {NIL, NIL, NIL},
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Public.generate_destination_type_and_subtype(overworld_position)
|
||||
local macro_p = {x = overworld_position.x/40, y = overworld_position.y/24}
|
||||
local macro_x = macro_p.x
|
||||
local macro_y = macro_p.y
|
||||
|
||||
local type2, subtype
|
||||
|
||||
if destinationScheme[macro_x] then
|
||||
subtype = destinationScheme[macro_x][macro_y + 2]
|
||||
else
|
||||
if (macro_x - 22) % 20 == 0 then
|
||||
subtype = RADIOACTIVE
|
||||
elseif (macro_x - 22) % 20 == 18 then
|
||||
subtype = MAZE
|
||||
elseif macro_y == -1 and (macro_x % 4) == 3 then
|
||||
subtype = DOCK
|
||||
else
|
||||
subtype = D
|
||||
end
|
||||
end
|
||||
|
||||
if type(subtype) == 'table' then
|
||||
if destinationScheme[macro_x - 1] then
|
||||
local previous = destinationScheme[macro_x - 1][macro_y + 2]
|
||||
if previous and type(previous) ~= 'table' and previous ~= NIL and previous ~= DOCK then
|
||||
subtype = Utils.deepcopy(subtype)
|
||||
subtype = Utils.ordered_table_with_values_removed(subtype, previous) --avoid duplicate subtype twice in a row in the same lane
|
||||
end
|
||||
end
|
||||
|
||||
subtype = subtype[Math.random(#subtype)]
|
||||
end
|
||||
|
||||
if subtype == NIL then
|
||||
type2 = nil
|
||||
subtype = nil
|
||||
elseif subtype == DOCK then
|
||||
type2 = Surfaces.enum.DOCK
|
||||
subtype = nil
|
||||
else
|
||||
type2 = Surfaces.enum.ISLAND
|
||||
end
|
||||
|
||||
return {type = type2, subtype = subtype}
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function Public.generate_destination_base_cost_to_undock(p, subtype)
|
||||
|
||||
local macro_p = {x = p.x/40, y = p.y/24}
|
||||
|
||||
local base_cost_to_undock
|
||||
|
||||
local normal_costitems = {'electronic-circuit', 'advanced-circuit'}
|
||||
-- local special_costitems = {'rocket-fuel', 'flying-robot-frame'}
|
||||
|
||||
-- These need to scale up slightly slower than the static fuel depletion rate, so you're increasingly incentivised to leave:
|
||||
local base_cost_1 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*120),
|
||||
}
|
||||
local base_cost_2 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*200),
|
||||
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
-- the below got this response from a new player: "This feels... underwhelming."
|
||||
-- ['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*120),
|
||||
-- ['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*18),
|
||||
}
|
||||
local base_cost_2b = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*200),
|
||||
['flying-robot-frame'] = 3,
|
||||
}
|
||||
local base_cost_3 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*160),
|
||||
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
['launch_rocket'] = true,
|
||||
}
|
||||
local base_cost_4 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*140),
|
||||
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*25),
|
||||
['launch_rocket'] = true,
|
||||
}
|
||||
local base_cost_5 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*140),
|
||||
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*10),
|
||||
-- ['rocket-fuel'] = Math.ceil(((macro_p.x-18)^(2/3))*10),
|
||||
-- ['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*100),
|
||||
-- ['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
-- ['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*10),
|
||||
}
|
||||
-- if macro_p.x == 0 then
|
||||
-- if _DEBUG then
|
||||
-- base_cost_to_undock = {
|
||||
-- ['electronic-circuit'] = 5,
|
||||
-- ['engine-unit'] = 5,
|
||||
-- ['advanced-circuit'] = 5,
|
||||
-- ['flying-robot-frame'] = 5,
|
||||
-- }
|
||||
-- end
|
||||
-- base_cost_to_undock = nil
|
||||
-- elseif macro_p.x <= 6 then
|
||||
if macro_p.x <= Common.first_cost_to_leave_macrox - 1 then
|
||||
-- base_cost_to_undock = {['electronic-circuit'] = 5}
|
||||
base_cost_to_undock = nil
|
||||
elseif macro_p.x <= 9 then
|
||||
base_cost_to_undock = base_cost_1
|
||||
elseif macro_p.x <= 15 then
|
||||
if macro_p.x % 3 > 0 then
|
||||
base_cost_to_undock = base_cost_1
|
||||
else
|
||||
base_cost_to_undock = nil
|
||||
end
|
||||
elseif macro_p.x == 18 then --a super small amount of flying-robot-frame on a relatively early level so that they see they need lubricant
|
||||
base_cost_to_undock = base_cost_2b
|
||||
elseif macro_p.x <= 20 then
|
||||
if macro_p.x % 3 == 0 then
|
||||
base_cost_to_undock = nil
|
||||
else
|
||||
base_cost_to_undock = base_cost_2
|
||||
end
|
||||
-- after this point, mandatory. except for 22
|
||||
elseif macro_p.x == 22 then
|
||||
base_cost_to_undock = base_cost_2
|
||||
elseif macro_p.x <= 23 then
|
||||
base_cost_to_undock = base_cost_3
|
||||
elseif macro_p.x <= 24 then
|
||||
base_cost_to_undock = base_cost_4
|
||||
else
|
||||
base_cost_to_undock = Utils.deepcopy(base_cost_5)
|
||||
local delete = normal_costitems[Math.random(#normal_costitems)]
|
||||
base_cost_to_undock[delete] = nil
|
||||
-- local delete2 = special_costitems[Math.random(#special_costitems)]
|
||||
-- base_cost_to_undock[delete2] = nil
|
||||
if macro_p.x < 50 then
|
||||
if macro_p.x % 2 == 0 then
|
||||
base_cost_to_undock['launch_rocket'] = true
|
||||
end
|
||||
else --now we're just trying to kill you
|
||||
base_cost_to_undock['launch_rocket'] = true
|
||||
end
|
||||
end
|
||||
-- override:
|
||||
if subtype == Surfaces.Island.enum.RADIOACTIVE then
|
||||
base_cost_to_undock = {
|
||||
['uranium-235'] = Math.ceil(Math.ceil(80 + (macro_p.x - 1))),
|
||||
-- ['uranium-235'] = Math.ceil(Math.ceil(80 + (macro_p.x)/2)), --tried adding beacons instead of this
|
||||
}
|
||||
end
|
||||
|
||||
-- -- debug override:
|
||||
-- if _DEBUG then
|
||||
-- base_cost_to_undock = {
|
||||
-- ['electronic-circuit'] = 200,
|
||||
-- ['launch_rocket'] = true,
|
||||
-- }
|
||||
-- end
|
||||
|
||||
return base_cost_to_undock -- Multiplication by Balance.cost_to_leave_multiplier() happens later, in destination_on_collide.
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local infront_positions = {}
|
||||
for x = -6, -3 do
|
||||
for y = - 3, 3 do
|
||||
@ -46,165 +263,6 @@ for x = 1, 14 do
|
||||
end
|
||||
|
||||
|
||||
function Public.generate_destination_type_and_subtype(overworld_position)
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
local macro_p = {x = overworld_position.x/40, y = overworld_position.y/24}
|
||||
local macro_x = macro_p.x
|
||||
local macro_y = macro_p.y
|
||||
|
||||
local type, subtype
|
||||
|
||||
local island_subtype_raffle = {'none', 'none', Surfaces.Island.enum.STANDARD, Surfaces.Island.enum.STANDARD_VARIANT, Surfaces.Island.enum.RED_DESERT, Surfaces.Island.enum.HORSESHOE}
|
||||
|
||||
if macro_x >= 6 then island_subtype_raffle[#island_subtype_raffle + 1] = Surfaces.Island.enum.WALKWAYS end
|
||||
if macro_x >= 6 then island_subtype_raffle[#island_subtype_raffle + 1] = 'none' end
|
||||
-- if macro_x >= 13 and macro_y == 1 then
|
||||
-- island_subtype_raffle[#island_subtype_raffle + 1] = Surfaces.Island.enum.MAZE
|
||||
-- island_subtype_raffle[#island_subtype_raffle + 1] = Surfaces.Island.enum.MAZE
|
||||
-- end
|
||||
if macro_x >= 21 then island_subtype_raffle[#island_subtype_raffle + 1] = Surfaces.Island.enum.SWAMP end
|
||||
if macro_x >= 21 then island_subtype_raffle[#island_subtype_raffle + 1] = 'none' end
|
||||
|
||||
--avoid duplicate subtype twice in a row in the same lane
|
||||
for _, d in pairs(memory.destinations) do
|
||||
if d.subtype and d.overworld_position.x == macro_p.x - 40 and d.overworld_position.y == macro_p.y then
|
||||
local new_island_subtype_raffle = Utils.ordered_table_with_values_removed(island_subtype_raffle, d.subtype)
|
||||
-- if _DEBUG and #new_island_subtype_raffle ~= #island_subtype_raffle then
|
||||
-- game.print('Removed ' .. d.subtype .. ' from raffle at ' .. p.x .. ',' .. p.y)
|
||||
-- end
|
||||
island_subtype_raffle = new_island_subtype_raffle
|
||||
end
|
||||
end
|
||||
|
||||
-- some other raffle removals for smoothness:
|
||||
if macro_x == 4 then
|
||||
island_subtype_raffle = Utils.ordered_table_with_values_removed(island_subtype_raffle, Surfaces.Island.enum.STANDARD)
|
||||
end
|
||||
if macro_x == 11 then
|
||||
island_subtype_raffle = Utils.ordered_table_with_values_removed(island_subtype_raffle, 'none') --make sure there's an island after kraken
|
||||
end
|
||||
if macro_x == 12 then
|
||||
island_subtype_raffle = Utils.ordered_table_with_values_removed(island_subtype_raffle, 'none') --make sure there's another island after kraken
|
||||
end
|
||||
if macro_x == 18 then
|
||||
island_subtype_raffle = Utils.ordered_table_with_values_removed(island_subtype_raffle, 'none') --flying-robot-frame cost is here, and we just make sure there's an island to see it
|
||||
end
|
||||
if macro_x == 19 then
|
||||
island_subtype_raffle = Utils.ordered_table_with_values_removed(island_subtype_raffle, Surfaces.Island.enum.SWAMP)
|
||||
end
|
||||
|
||||
if macro_x == 0 then
|
||||
if macro_y == 0 then
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.FIRST
|
||||
elseif macro_y == -1 then
|
||||
type = Surfaces.enum.DOCK
|
||||
else
|
||||
type = nil
|
||||
end
|
||||
elseif macro_x == 1 then
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.HORSESHOE --map where you break rocks
|
||||
elseif macro_x == 2 then
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.STANDARD_VARIANT --aesthetically different to first map
|
||||
elseif (macro_x > 25 and (macro_x - 22) % 20 == 0) then --we want this to overwrite dock, so putting it here.
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.RADIOACTIVE
|
||||
elseif (macro_x > 25 and (macro_x - 22) % 20 == 18) then --we want this to overwrite dock, so putting it here. should be even so rocket launch is forced
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.MAZE
|
||||
elseif macro_x == 23 then --overwrite dock. rocket launch cost
|
||||
type = Surfaces.enum.ISLAND
|
||||
if macro_y == 0 then
|
||||
subtype = Surfaces.Island.enum.RED_DESERT
|
||||
elseif macro_y == -1 then
|
||||
subtype = Surfaces.Island.enum.SWAMP
|
||||
else
|
||||
subtype = Surfaces.Island.enum.STANDARD_VARIANT
|
||||
end
|
||||
elseif macro_y == -1 and (((macro_x % 4) == 3 and macro_x ~= 15) or macro_x == 14) then --avoid x=15 because radioactive is there
|
||||
type = Surfaces.enum.DOCK
|
||||
elseif macro_x == 3 then
|
||||
type = nil
|
||||
elseif macro_x == 5 then --biter boats appear. large island works well so players run off
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.STANDARD
|
||||
elseif macro_x == 6 then
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.MAZE
|
||||
elseif macro_x == 8 then --game length decrease, pending more content
|
||||
type = nil
|
||||
-- elseif macro_x == 9 then --just before krakens
|
||||
-- type = Surfaces.enum.ISLAND
|
||||
-- subtype = Surfaces.Island.enum.RED_DESERT
|
||||
elseif macro_x == 10 then --krakens appear
|
||||
type = nil
|
||||
-- elseif macro_x == 11 then
|
||||
-- if macro_y == -1 then
|
||||
-- type = Surfaces.enum.ISLAND
|
||||
-- subtype = Surfaces.Island.enum.MAZE
|
||||
-- else
|
||||
-- type = nil
|
||||
-- end
|
||||
elseif macro_x == 12 and macro_y < 1 then
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.SWAMP
|
||||
elseif macro_x == 16 then
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.RADIOACTIVE
|
||||
--electric engines needed at 20
|
||||
-- elseif macro_x == 17 then --game length decrease, pending more content
|
||||
-- type = nil
|
||||
elseif macro_x == 20 then --game length decrease, pending more content
|
||||
type = nil
|
||||
elseif macro_x == 21 then --rocket launch cost
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.WALKWAYS
|
||||
elseif macro_x == 22 then --game length decrease, pending more content. also kinda fun to have to steer in realtime due to double space
|
||||
type = nil
|
||||
elseif macro_x == 24 then --rocket launch cost
|
||||
type = Surfaces.enum.ISLAND
|
||||
subtype = Surfaces.Island.enum.MAZE
|
||||
elseif macro_x == 25 then
|
||||
type = nil --finish line
|
||||
else
|
||||
type = Surfaces.enum.ISLAND
|
||||
|
||||
if #island_subtype_raffle > 0 then
|
||||
subtype = island_subtype_raffle[Math.random(#island_subtype_raffle)]
|
||||
else
|
||||
subtype = 'none'
|
||||
end
|
||||
|
||||
if subtype == 'none' then
|
||||
type = nil
|
||||
subtype = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- an incomplete list of things that could break if the islands are rearranged: parrot tips are given on certain islands;
|
||||
|
||||
|
||||
--== DEBUG override to test islands:
|
||||
|
||||
-- if _DEBUG and type == Surfaces.enum.ISLAND then
|
||||
-- subtype = Surfaces.Island.enum.SWAMP
|
||||
-- -- subtype = nil
|
||||
-- -- type = Surfaces.enum.DOCK
|
||||
-- end
|
||||
|
||||
-- warning: the first map is unique in that it isn't all loaded by the time you arrive, which can cause issues. For example, structures might get placed after ore, thereby deleting the ore underneath them.
|
||||
|
||||
-- if _DEBUG and ((macro_p.x > 0 and macro_p.x < 25)) and type ~= Surfaces.enum.DOCK then
|
||||
-- type = nil
|
||||
-- subtype = nil
|
||||
-- end
|
||||
|
||||
return {type = type, subtype = subtype}
|
||||
end
|
||||
|
||||
|
||||
function Public.generate_overworld_destination(p)
|
||||
-- be careful when calling any Balance functions that depend on overworldx — they will be evaluated when the island is chosen, not on arrival
|
||||
@ -221,112 +279,8 @@ function Public.generate_overworld_destination(p)
|
||||
local scope = Surfaces[Surfaces.enum.ISLAND][subtype]
|
||||
|
||||
local static_params = Utils.deepcopy(scope.Data.static_params_default)
|
||||
local base_cost_to_undock
|
||||
|
||||
local normal_costitems = {'electronic-circuit', 'advanced-circuit'}
|
||||
-- local special_costitems = {'rocket-fuel', 'flying-robot-frame'}
|
||||
|
||||
-- These need to scale up slightly slower than the static fuel depletion rate, so you're increasingly incentivised to leave:
|
||||
local base_cost_1 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*120),
|
||||
}
|
||||
local base_cost_2 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*200),
|
||||
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
-- the below got this response from a new player: "This feels... underwhelming."
|
||||
-- ['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*120),
|
||||
-- ['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*18),
|
||||
}
|
||||
local base_cost_2b = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*200),
|
||||
['flying-robot-frame'] = 3,
|
||||
}
|
||||
local base_cost_3 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*160),
|
||||
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
['launch_rocket'] = true,
|
||||
}
|
||||
local base_cost_4 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*140),
|
||||
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*25),
|
||||
['launch_rocket'] = true,
|
||||
}
|
||||
local base_cost_5 = {
|
||||
['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*140),
|
||||
['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*10),
|
||||
-- ['rocket-fuel'] = Math.ceil(((macro_p.x-18)^(2/3))*10),
|
||||
-- ['electronic-circuit'] = Math.ceil(((macro_p.x-2)^(2/3))*100),
|
||||
-- ['advanced-circuit'] = Math.ceil(((macro_p.x-14)^(2/3))*20),
|
||||
-- ['flying-robot-frame'] = Math.ceil(((macro_p.x-18)^(2/3))*10),
|
||||
}
|
||||
-- if macro_p.x == 0 then
|
||||
-- if _DEBUG then
|
||||
-- base_cost_to_undock = {
|
||||
-- ['electronic-circuit'] = 5,
|
||||
-- ['engine-unit'] = 5,
|
||||
-- ['advanced-circuit'] = 5,
|
||||
-- ['flying-robot-frame'] = 5,
|
||||
-- }
|
||||
-- end
|
||||
-- base_cost_to_undock = nil
|
||||
-- elseif macro_p.x <= 6 then
|
||||
if macro_p.x <= Common.first_cost_to_leave_macrox - 1 then
|
||||
-- base_cost_to_undock = {['electronic-circuit'] = 5}
|
||||
base_cost_to_undock = nil
|
||||
elseif macro_p.x <= 9 then
|
||||
base_cost_to_undock = base_cost_1
|
||||
elseif macro_p.x <= 15 then
|
||||
if macro_p.x % 3 > 0 then
|
||||
base_cost_to_undock = base_cost_1
|
||||
else
|
||||
base_cost_to_undock = nil
|
||||
end
|
||||
elseif macro_p.x == 18 then --a super small amount of flying-robot-frame on a relatively early level so that they see they need lubricant
|
||||
base_cost_to_undock = base_cost_2b
|
||||
elseif macro_p.x <= 20 then
|
||||
if macro_p.x % 3 > 0 then
|
||||
base_cost_to_undock = base_cost_2
|
||||
else
|
||||
base_cost_to_undock = nil
|
||||
end
|
||||
-- after this point, mandatory
|
||||
elseif macro_p.x <= 23 then
|
||||
base_cost_to_undock = base_cost_3
|
||||
elseif macro_p.x <= 24 then
|
||||
base_cost_to_undock = base_cost_4
|
||||
else
|
||||
base_cost_to_undock = Utils.deepcopy(base_cost_5)
|
||||
local delete = normal_costitems[Math.random(#normal_costitems)]
|
||||
base_cost_to_undock[delete] = nil
|
||||
-- local delete2 = special_costitems[Math.random(#special_costitems)]
|
||||
-- base_cost_to_undock[delete2] = nil
|
||||
if macro_p.x < 50 then
|
||||
if macro_p.x % 2 == 0 then
|
||||
base_cost_to_undock['launch_rocket'] = true
|
||||
end
|
||||
else --now we're just trying to kill you
|
||||
base_cost_to_undock['launch_rocket'] = true
|
||||
end
|
||||
end
|
||||
-- override:
|
||||
if subtype == Surfaces.Island.enum.RADIOACTIVE then
|
||||
base_cost_to_undock = {
|
||||
['uranium-235'] = Math.ceil(Math.ceil(80 + (macro_p.x - 1))),
|
||||
-- ['uranium-235'] = Math.ceil(Math.ceil(80 + (macro_p.x)/2)), --tried adding beacons instead of this
|
||||
}
|
||||
end
|
||||
|
||||
-- -- debug override:
|
||||
-- if _DEBUG then
|
||||
-- base_cost_to_undock = {
|
||||
-- ['electronic-circuit'] = 200,
|
||||
-- ['launch_rocket'] = true,
|
||||
-- }
|
||||
-- end
|
||||
|
||||
static_params.base_cost_to_undock = base_cost_to_undock -- Multiplication by Balance.cost_to_leave_multiplier() happens later, in destination_on_collide.
|
||||
static_params.base_cost_to_undock = Public.generate_destination_base_cost_to_undock(p, subtype) -- Multiplication by Balance.cost_to_leave_multiplier() happens later, in destination_on_collide.
|
||||
|
||||
--scheduled raft raids moved to destination_on_arrival
|
||||
|
||||
@ -653,12 +607,12 @@ end
|
||||
function Public.try_overworld_move_v2(vector) --islands stay, crowsnest moves
|
||||
local memory = Memory.get_crew_memory()
|
||||
|
||||
if memory.game_lost or (memory.victory_pause_until_tick and game.tick < memory.victory_pause_until_tick) then return end
|
||||
-- if memory.game_lost or (memory.victory_pause_until_tick and game.tick < memory.victory_pause_until_tick) then return end
|
||||
|
||||
if memory.victory_continue_message then
|
||||
memory.victory_continue_message = false
|
||||
Common.notify_force(memory.force, {'pirates.crew_continue_on_freeplay'}, CoreData.colors.notify_victory)
|
||||
end
|
||||
-- if memory.victory_continue_message then
|
||||
-- memory.victory_continue_message = false
|
||||
-- Common.notify_force(memory.force, {'pirates.crew_continue_on_freeplay'}, CoreData.colors.notify_victory)
|
||||
-- end
|
||||
|
||||
if vector.x > 0 then
|
||||
Public.ensure_lane_generated_up_to(0, memory.overworldx + Crowsnest.Data.visibilitywidth)
|
||||
|
@ -541,7 +541,13 @@ function Public.at_sea_begin_to_set_sail()
|
||||
|
||||
local force = memory.force
|
||||
if not (force and force.valid) then return end
|
||||
Common.notify_force(force, {'pirates.ship_set_off_to_next_island'})
|
||||
|
||||
if memory.victory_continue_message then
|
||||
memory.victory_continue_message = false
|
||||
Common.notify_force(force, {'pirates.crew_continue_on_freeplay'}, CoreData.colors.notify_victory)
|
||||
else
|
||||
Common.notify_force(force, {'pirates.ship_set_off_to_next_island'})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -613,7 +619,7 @@ function Public.go_from_currentdestination_to_sea()
|
||||
--@FIX: This doesn't change the evo during sea travel, which is relevant now that krakens are in the game:
|
||||
local base_evo = Balance.base_evolution_leagues(memory.overworldx)
|
||||
Common.set_evo(base_evo)
|
||||
memory.kraken_evo = 0
|
||||
memory.dynamic_kraken_evo = 0
|
||||
|
||||
memory.loadingticks = nil
|
||||
memory.mapbeingloadeddestination_index = nil
|
||||
|
@ -569,10 +569,47 @@ function Public.add_player_to_permission_group(player, group_override)
|
||||
group.set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint, false)
|
||||
end
|
||||
|
||||
group.set_allows_action(defines.input_action.open_gui, false)
|
||||
group.set_allows_action(defines.input_action.fast_entity_transfer, false)
|
||||
group.set_allows_action(defines.input_action.fast_entity_split, false)
|
||||
|
||||
group.set_allows_action(defines.input_action.open_gui, true)
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('super_restricted_area') then
|
||||
local group = game.permissions.create_group('super_restricted_area')
|
||||
group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
group.set_allows_action(defines.input_action.admin_action, false)
|
||||
|
||||
group.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
group.set_allows_action(defines.input_action.drop_item, false)
|
||||
group.set_allows_action(defines.input_action.drop_blueprint_record, false)
|
||||
group.set_allows_action(defines.input_action.build, false)
|
||||
group.set_allows_action(defines.input_action.build_rail, false)
|
||||
group.set_allows_action(defines.input_action.build_terrain, false)
|
||||
group.set_allows_action(defines.input_action.begin_mining, false)
|
||||
group.set_allows_action(defines.input_action.begin_mining_terrain, false)
|
||||
-- group.set_allows_action(defines.input_action.deconstruct, false) --pick up dead players
|
||||
group.set_allows_action(defines.input_action.activate_copy, false)
|
||||
group.set_allows_action(defines.input_action.activate_cut, false)
|
||||
group.set_allows_action(defines.input_action.activate_paste, false)
|
||||
group.set_allows_action(defines.input_action.upgrade, false)
|
||||
|
||||
group.set_allows_action(defines.input_action.grab_blueprint_record, false)
|
||||
if not CoreData.blueprint_library_allowed then
|
||||
group.set_allows_action(defines.input_action.open_blueprint_library_gui, false)
|
||||
end
|
||||
if not CoreData.blueprint_importing_allowed then
|
||||
group.set_allows_action(defines.input_action.import_blueprint_string, false)
|
||||
group.set_allows_action(defines.input_action.import_blueprint, false)
|
||||
end
|
||||
|
||||
group.set_allows_action(defines.input_action.fast_entity_transfer, false)
|
||||
group.set_allows_action(defines.input_action.fast_entity_split, false)
|
||||
|
||||
group.set_allows_action(defines.input_action.open_gui, false)
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('restricted_area_privileged') then
|
||||
@ -679,7 +716,13 @@ function Public.update_privileges(player)
|
||||
return
|
||||
end
|
||||
|
||||
if string.sub(player.surface.name, 9, 17) == 'Crowsnest' or string.sub(player.surface.name, 9, 13) == 'Cabin' then
|
||||
if string.sub(player.surface.name, 9, 17) == 'Crowsnest' then
|
||||
if Public.player_privilege_level(player) >= Public.privilege_levels.OFFICER then
|
||||
return Public.add_player_to_permission_group(player, 'restricted_area_privileged')
|
||||
else
|
||||
return Public.add_player_to_permission_group(player, 'super_restricted_area')
|
||||
end
|
||||
elseif string.sub(player.surface.name, 9, 13) == 'Cabin' then
|
||||
if Public.player_privilege_level(player) >= Public.privilege_levels.OFFICER then
|
||||
return Public.add_player_to_permission_group(player, 'restricted_area_privileged')
|
||||
else
|
||||
@ -687,7 +730,7 @@ function Public.update_privileges(player)
|
||||
end
|
||||
else
|
||||
return Public.add_player_to_permission_group(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -25,10 +25,10 @@ Public.Minimarket = require 'maps.pirates.shop.dock'
|
||||
|
||||
|
||||
|
||||
function Public.print_transaction(player, offer_itemname, offer_itemcount, price)
|
||||
function Public.print_transaction(player, multipler, offer_itemname, offer_itemcount, price)
|
||||
local type = 'traded away'
|
||||
local s2 = {''}
|
||||
local s3 = offer_itemcount .. ' ' .. offer_itemname
|
||||
local s3 = offer_itemcount * multipler .. ' ' .. offer_itemname
|
||||
if offer_itemname == 'coin' then type = 'sold' end
|
||||
for i, p in pairs(price) do
|
||||
local p2 = {name = p.name, amount = p.amount}
|
||||
@ -44,7 +44,7 @@ function Public.print_transaction(player, offer_itemname, offer_itemcount, price
|
||||
s2[#s2+1] = {'pirates.separator_1'}
|
||||
end
|
||||
end
|
||||
s2[#s2+1] = p2.amount
|
||||
s2[#s2+1] = p2.amount * multipler
|
||||
s2[#s2+1] = ' '
|
||||
s2[#s2+1] = p2.name
|
||||
end
|
||||
@ -128,6 +128,42 @@ local function purchaseData(market, player, offer_index)
|
||||
end
|
||||
|
||||
|
||||
function Public.refund_items(player, price, price_multiplier, item_purchased_name, item_purchased_count)
|
||||
|
||||
local inv = player.get_inventory(defines.inventory.character_main)
|
||||
if not inv then return end
|
||||
|
||||
for _, p in pairs(price) do
|
||||
inv.insert{name = p.name, count = p.amount * price_multiplier}
|
||||
end
|
||||
|
||||
if item_purchased_name and item_purchased_count then
|
||||
local removed = inv.remove{name = item_purchased_name, count = item_purchased_count}.count
|
||||
if removed < item_purchased_count then
|
||||
local nearby_floor_items = player.surface.find_entities_filtered{area = {{player.position.x - 5, player.position.y - 5}, {player.position.x + 5, player.position.y + 5}}, name = 'item-on-ground'}
|
||||
local whilesafety = 2000
|
||||
local i = 1
|
||||
while removed < item_purchased_count and i < #nearby_floor_items and i < whilesafety do
|
||||
i = i + 1
|
||||
if nearby_floor_items[i].stack and nearby_floor_items[i].stack.name and nearby_floor_items[i].stack.count and nearby_floor_items[i].stack.name == item_purchased_name then
|
||||
local removed_count = nearby_floor_items[i].stack.count
|
||||
if removed_count > item_purchased_count - removed then
|
||||
removed_count = item_purchased_count - removed
|
||||
end
|
||||
if removed_count == nearby_floor_items[i].stack.count then
|
||||
nearby_floor_items[i].destroy()
|
||||
else
|
||||
nearby_floor_items[i].stack.count = nearby_floor_items[i].stack.count - removed_count
|
||||
end
|
||||
removed = removed + removed_count
|
||||
end
|
||||
end
|
||||
if i == whilesafety then log('ERROR: whilesafety reached') end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function Public.event_on_market_item_purchased(event)
|
||||
local player_index, market, offer_index, trade_count = event.player_index, event.market, event.offer_index, event.count
|
||||
@ -147,13 +183,10 @@ function Public.event_on_market_item_purchased(event)
|
||||
|
||||
-- Normally we want to disallow multi-purchases in this game (with the exception of static trades for items), so refund any additional purchases:
|
||||
if (thisPurchaseData.decay_type ~= 'static' or thisPurchaseData.offer_type == 'nothing') and player and trade_count and trade_count > 1 then
|
||||
inv = player.get_inventory(defines.inventory.character_main)
|
||||
if not inv then return end
|
||||
for _, p in pairs(thisPurchaseData.price) do
|
||||
inv.insert{name = p.name, count = p.amount * (trade_count - 1)}
|
||||
end
|
||||
if thisPurchaseData.offer_type == 'give-item' then
|
||||
inv.remove{name = thisPurchaseData.offer_giveitem_name, count = thisPurchaseData.offer_giveitem_count * (trade_count - 1)}
|
||||
Public.refund_items(player, thisPurchaseData.price, (trade_count - 1), thisPurchaseData.offer_giveitem_name, thisPurchaseData.offer_giveitem_count * (trade_count - 1))
|
||||
else
|
||||
Public.refund_items(player, thisPurchaseData.price, (trade_count - 1))
|
||||
end
|
||||
refunds = refunds + (trade_count - 1)
|
||||
end
|
||||
@ -168,13 +201,10 @@ function Public.event_on_market_item_purchased(event)
|
||||
end
|
||||
|
||||
if thisPurchaseData.permission_level_fail then
|
||||
refunds = trade_count
|
||||
Common.notify_player_error(player, {'pirates.market_error_not_captain'})
|
||||
-- refund:
|
||||
inv = player.get_inventory(defines.inventory.character_main)
|
||||
if not inv then return end
|
||||
for _, p in pairs(thisPurchaseData.price) do
|
||||
inv.insert{name = p.name, count = p.amount}
|
||||
end
|
||||
Public.refund_items(player, thisPurchaseData.price, 1)
|
||||
refunds = refunds + 1
|
||||
else
|
||||
if thisPurchaseData.offer_type == 'give-item' then
|
||||
@ -238,13 +268,8 @@ function Public.event_on_market_item_purchased(event)
|
||||
end
|
||||
|
||||
--refund
|
||||
inv = player.get_inventory(defines.inventory.character_main)
|
||||
if not inv then return end
|
||||
for _, p in pairs(thisPurchaseData.price) do
|
||||
inv.insert{name = p.name, count = p.amount}
|
||||
end
|
||||
refunds = refunds + 1
|
||||
|
||||
Public.refund_items(player, thisPurchaseData.price, 1)
|
||||
log('Error purchasing class: ' .. class_for_sale)
|
||||
end
|
||||
else
|
||||
@ -258,15 +283,21 @@ function Public.event_on_market_item_purchased(event)
|
||||
if thisPurchaseData.in_captains_cabin and thisPurchaseData.permission_level_fail then
|
||||
Common.notify_player_error(player, {'pirates.market_error_not_captain_or_officer'})
|
||||
-- refund:
|
||||
inv = player.get_inventory(defines.inventory.character_main)
|
||||
if not inv then return end
|
||||
for _, p in pairs(thisPurchaseData.price) do
|
||||
inv.insert{name = p.name, count = p.amount}
|
||||
if thisPurchaseData.decay_type == 'static' then
|
||||
if thisPurchaseData.offer_type == 'give-item' then
|
||||
Public.refund_items(player, thisPurchaseData.price, trade_count, thisPurchaseData.offer_giveitem_name, thisPurchaseData.offer_giveitem_count * trade_count)
|
||||
else
|
||||
Public.refund_items(player, thisPurchaseData.price, trade_count)
|
||||
end
|
||||
refunds = refunds + trade_count
|
||||
else
|
||||
if thisPurchaseData.offer_type == 'give-item' then
|
||||
Public.refund_items(player, thisPurchaseData.price, 1, thisPurchaseData.offer_giveitem_name, thisPurchaseData.offer_giveitem_count)
|
||||
else
|
||||
Public.refund_items(player, thisPurchaseData.price, 1)
|
||||
end
|
||||
refunds = refunds + 1
|
||||
end
|
||||
if thisPurchaseData.offer_type == 'give-item' then
|
||||
inv.remove{name = thisPurchaseData.offer_giveitem_name, count = thisPurchaseData.offer_giveitem_count}
|
||||
end
|
||||
refunds = refunds + 1
|
||||
else
|
||||
-- print:
|
||||
if (thisPurchaseData.price and thisPurchaseData.price[1]) then
|
||||
@ -274,7 +305,7 @@ function Public.event_on_market_item_purchased(event)
|
||||
if thisPurchaseData.in_captains_cabin and thisPurchaseData.offer_type == 'nothing' then
|
||||
Common.notify_force_light(player.force, {'pirates.market_event_buy', player.name, {'pirates.extra_time_at_sea'}, thisPurchaseData.price[1].amount .. ' ' .. thisPurchaseData.price[1].name})
|
||||
else
|
||||
Public.print_transaction(player, thisPurchaseData.offer_giveitem_name, thisPurchaseData.offer_giveitem_count, thisPurchaseData.price)
|
||||
Public.print_transaction(player, trade_count - refunds, thisPurchaseData.offer_giveitem_name, thisPurchaseData.offer_giveitem_count, thisPurchaseData.price)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -284,11 +315,7 @@ function Public.event_on_market_item_purchased(event)
|
||||
if not success then
|
||||
Common.notify_player_error(player, {'pirates.market_error_maximum_loading_time'})
|
||||
-- refund:
|
||||
inv = player.get_inventory(defines.inventory.character_main)
|
||||
if not inv then return end
|
||||
for _, p in pairs(thisPurchaseData.price) do
|
||||
inv.insert{name = p.name, count = p.amount}
|
||||
end
|
||||
Public.refund_items(player, thisPurchaseData.price, 1)
|
||||
refunds = refunds + 1
|
||||
end
|
||||
else
|
||||
@ -327,11 +354,9 @@ function Public.event_on_market_item_purchased(event)
|
||||
memory.playtesting_stats.coins_gained_by_markets = memory.playtesting_stats.coins_gained_by_markets + thisPurchaseData.offer_giveitem_count
|
||||
end
|
||||
|
||||
if thisPurchaseData.offer_type == 'give-item' and thisPurchaseData.offer_giveitem_name == 'cliff-explosives' then
|
||||
if not memory.cliff_explosives_acquired_once then
|
||||
memory.cliff_explosives_acquired_once = true
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_cliff_explosive_tip'})
|
||||
end
|
||||
if (not memory.cliff_explosives_acquired_once) and thisPurchaseData.offer_type == 'give-item' and thisPurchaseData.offer_giveitem_name == 'cliff-explosives' and refunds < trade_count then
|
||||
memory.cliff_explosives_acquired_once = true
|
||||
Common.parrot_speak(memory.force, {'pirates.parrot_cliff_explosive_tip'})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -99,7 +99,7 @@ Public.Data.surfacename_rendering_pos = {x = -0.5, y = -15}
|
||||
|
||||
Public.cabin_shop_data = {
|
||||
{
|
||||
price = {{'coin', 400}, {'coal', 20}, {'iron-plate', 10}},--should be inefficient on resources to merely buy arty to shoot nests
|
||||
price = {{'coin', 400}, {'coal', 20}, {'iron-plate', 30}},--should be inefficient on resources to merely buy arty to shoot nests
|
||||
offer = {type='give-item', item = 'artillery-shell', count = 5},
|
||||
},
|
||||
{
|
||||
@ -107,12 +107,12 @@ Public.cabin_shop_data = {
|
||||
offer = {type='give-item', item = 'rail-signal', count = 100},
|
||||
},
|
||||
{
|
||||
price = {{'coin', 2000}, {'stone-brick', 30}},
|
||||
price = {{'coin', 1000}, {'stone-brick', 50}},
|
||||
offer = {type='give-item', item = 'uranium-238', count = 10},
|
||||
},
|
||||
{ -- could raise the price later if this may seem too cheap
|
||||
price = {{'coin', 2000}, {'explosives', 5}},
|
||||
offer = {type='give-item', item = 'cliff-explosives', count = 5},
|
||||
price = {{'coin', 1000}, {'explosives', 5}},
|
||||
offer = {type='give-item', item = 'cliff-explosives', count = 1},
|
||||
},
|
||||
--disabled now that we can wait after any destination:
|
||||
-- {
|
||||
|
@ -146,10 +146,10 @@ function Public.kraken_tick(crew_id, kraken_id, step, substep)
|
||||
local summoned_biter_amount
|
||||
if crewCount <= 12 then
|
||||
firing_period = 4
|
||||
summoned_biter_amount = 2
|
||||
summoned_biter_amount = 3
|
||||
else
|
||||
firing_period = 3
|
||||
summoned_biter_amount = 3
|
||||
summoned_biter_amount = 4
|
||||
-- elseif crewCount <= 24 then
|
||||
-- firing_period = 3
|
||||
-- else
|
||||
@ -161,7 +161,7 @@ function Public.kraken_tick(crew_id, kraken_id, step, substep)
|
||||
if substep % 5 == 0 then
|
||||
if kraken_spawner_entity then
|
||||
for i = 1, summoned_biter_amount do
|
||||
local name = Common.get_random_unit_type(memory.evolution_factor + Balance.kraken_spawns_base_extra_evo)
|
||||
local name = Common.get_random_unit_type(memory.evolution_factor + Balance.kraken_static_evo)
|
||||
local random_dir_vec = {x = Math.random_float_in_range(-1, 1), y = Math.random_float_in_range(-1, 1)}
|
||||
random_dir_vec = Math.vector_norm(random_dir_vec)
|
||||
random_dir_vec = Math.vector_scale(random_dir_vec, Balance.kraken_biter_spawn_radius)
|
||||
@ -250,14 +250,14 @@ local function on_entity_destroyed(event)
|
||||
|
||||
local p2 = surface.find_non_colliding_position('medium-biter', p, 10, 0.2)
|
||||
if not p2 then return end
|
||||
local name = Common.get_random_unit_type(memory.evolution_factor + Balance.kraken_spawns_base_extra_evo)
|
||||
local name = Common.get_random_unit_type(memory.evolution_factor + Balance.kraken_static_evo)
|
||||
surface.create_entity{name = name, position = p2, force = memory.enemy_force_name}
|
||||
Effects.kraken_effect_2(surface, p2)
|
||||
|
||||
local evo_increase = Balance.kraken_evo_increase_per_shot()
|
||||
if evo_increase > 0 then
|
||||
if not memory.kraken_evo then memory.kraken_evo = 0 end
|
||||
memory.kraken_evo = memory.kraken_evo + evo_increase
|
||||
if not memory.dynamic_kraken_evo then memory.dynamic_kraken_evo = 0 end
|
||||
memory.dynamic_kraken_evo = memory.dynamic_kraken_evo + evo_increase
|
||||
Common.increment_evo(evo_increase)
|
||||
end
|
||||
end
|
||||
@ -269,8 +269,8 @@ function Public.overall_kraken_tick()
|
||||
if memory.active_sea_enemies and memory.active_sea_enemies.krakens and #memory.active_sea_enemies.krakens > 0 then
|
||||
local evo_increase = Balance.kraken_evo_increase_per_second()
|
||||
if evo_increase > 0 then
|
||||
if not memory.kraken_evo then memory.kraken_evo = 0 end
|
||||
memory.kraken_evo = memory.kraken_evo + evo_increase
|
||||
if not memory.dynamic_kraken_evo then memory.dynamic_kraken_evo = 0 end
|
||||
memory.dynamic_kraken_evo = memory.dynamic_kraken_evo + evo_increase
|
||||
Common.increment_evo(evo_increase)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user