1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-26 22:56:43 +02:00

New commands, class buffs and some fixes

Changes:
- Added damage reduction to Roc Eater that forgot to add before
- Fixed an issue where "placeability_function_optional" in "try_place" could be nil (it was causing crash in debug mode)
- Fixed an issue where arrival timer would continue ticking during kraken encounter past 20 seconds (this should result in kraken encounter  not being unintentionally skippable anymore when arrival timer ends)
- Fixed an issue where kraken spit sometimes would cause a crash in debug mode
- Added 4 new dev related commands
- Significantly buffed Dredger class loot
- Buffed Master Angler class
- Changed tick tack trap to troll emoji when nothing happens
This commit is contained in:
Piratux 2022-07-16 21:46:23 +03:00
parent fa5b4a0fbc
commit c052e2ddc4
15 changed files with 255 additions and 107 deletions

View File

@ -261,7 +261,7 @@ class_iron_leg=Iron Leg
class_iron_leg_explanation_advanced=They receive __1__% less damage when carrying at least __2__ iron ore.
class_quartermaster=Quartermaster
# class_quartermaster_explanation=Nearby crewmates get +10% physical attack and generate ore for the cabin.
class_quartermaster_explanation_advanced=Nearby crewmates (at __1__ tile radius) get +__2__% physical attack and generate ore for the cabin (ore amount depends on nearby crewmate count).
class_quartermaster_explanation_advanced=Nearby crewmates (at __1__ tile radius) get +__2__% physical attack bonus and generate ore for the cabin (ore amount depends on nearby crewmate count).
class_dredger=Dredger
# class_dredger_explanation=They find surprising items when they fish.
class_dredger_explanation_advanced=They inherit the previous class bonuses and find surprising items when they fish.

View File

@ -321,6 +321,8 @@ local function damage_to_players_changes(event)
damage_multiplier = damage_multiplier * Balance.samurai_damage_taken_multiplier
elseif class and class == Classes.enum.HATAMOTO then
damage_multiplier = damage_multiplier * Balance.hatamoto_damage_taken_multiplier
elseif class and class == Classes.enum.ROC_EATER then
damage_multiplier = damage_multiplier * Balance.roc_eater_damage_taken_multiplier
elseif class and class == Classes.enum.IRON_LEG then
if memory.class_auxiliary_data[player_index] and memory.class_auxiliary_data[player_index].iron_leg_active then
damage_multiplier = damage_multiplier * Balance.iron_leg_damage_taken_multiplier
@ -334,6 +336,8 @@ local function damage_to_players_changes(event)
damage_multiplier = damage_multiplier * (1 + Balance.biter_timeofday_bonus_damage(event.cause.surface.darkness))
end --Enemy Forces
-- game.print('name: ' .. event.cause.name .. ' damage: ' .. event.final_damage_amount)
-- game.print('multiplier: ' .. damage_multiplier)
if damage_multiplier > 1 then
event.entity.health = event.entity.health - event.final_damage_amount * (damage_multiplier - 1)

View File

@ -890,7 +890,17 @@ function Public.loading_update(tickinterval)
local destination_index = memory.mapbeingloadeddestination_index
if not destination_index then memory.loadingticks = nil return end
if (not memory.boat.state) or (not (memory.boat.state == Boats.enum_state.LANDED or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP or memory.boat.state == Boats.enum_state.LEAVING_DOCK or (memory.boat.state == Boats.enum_state.APPROACHING and destination_index == 1))) then return end
-- if (not memory.boat.state) or (not (memory.boat.state == Boats.enum_state.LANDED or memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP or memory.boat.state == Boats.enum_state.LEAVING_DOCK or (memory.boat.state == Boats.enum_state.APPROACHING and destination_index == 1))) then return end
if not memory.boat.state then return end
local needs_loading_update = false
if memory.boat.state == Boats.enum_state.LANDED then needs_loading_update = true end
if memory.boat.state == Boats.enum_state.ATSEA_LOADING_MAP then needs_loading_update = true end
if memory.boat.state == Boats.enum_state.LEAVING_DOCK then needs_loading_update = true end
if memory.boat.state == Boats.enum_state.APPROACHING and destination_index == 1 then needs_loading_update = true end
if not needs_loading_update then return end
memory.loadingticks = memory.loadingticks + tickinterval
@ -985,7 +995,11 @@ function Public.loading_update(tickinterval)
-- log(_inspect{eta_ticks, (memory.active_sea_enemies.krakens and #memory.active_sea_enemies.krakens or 'nil'), memory.loadingticks})
if eta_ticks < 60*20 and memory.active_sea_enemies and (memory.active_sea_enemies.krakens and #memory.active_sea_enemies.krakens > 0) then
if eta_ticks < 60*20 and
memory.active_sea_enemies and
memory.active_sea_enemies.kraken_count and
memory.active_sea_enemies.kraken_count > 0
then
memory.loadingticks = memory.loadingticks - tickinterval --reverse the change
else
local fraction = memory.loadingticks / (total + (memory.extra_time_at_sea or 0))
@ -1206,7 +1220,7 @@ function Public.Kraken_Destroyed_Backup_check(tickinterval) -- a server became s
local boat = memory.boat
if boat and boat.surface_name and boat.state and boat.state == Boats.enum_state.ATSEA_LOADING_MAP then
if (memory.active_sea_enemies and memory.active_sea_enemies.krakens and #memory.active_sea_enemies.krakens > 0) then
if (memory.active_sea_enemies and memory.active_sea_enemies.krakens and memory.active_sea_enemies.kraken_count and memory.active_sea_enemies.kraken_count > 0) then
local surface = game.surfaces[boat.surface_name]

View File

@ -61,10 +61,10 @@ Public.rocket_launch_coin_reward = 5000
Public.scout_damage_dealt_multiplier = 0.6
Public.fisherman_reach_bonus = 10
Public.master_angler_reach_bonus = 16
Public.master_angler_fish_bonus = 1
Public.master_angler_coin_bonus = 10
Public.master_angler_fish_bonus = 2
Public.master_angler_coin_bonus = 20
Public.dredger_reach_bonus = 16
Public.dredger_fish_bonus = 1
Public.dredger_fish_bonus = 2
Public.gourmet_ore_scaling_enabled = false
Public.chief_fish_received_for_biter_kill = 1
Public.chief_fish_received_for_worm_kill = 3

View File

@ -216,7 +216,7 @@ function(cmd)
local player = game.players[cmd.player_index]
if not Common.validate_player(player) then return end
--local memory = Memory.get_crew_memory()
Roles.player_confirm_captainhood(player)
end)
@ -285,7 +285,7 @@ function(cmd)
local param = tostring(cmd.parameter)
local player = game.players[cmd.player_index]
if not Common.validate_player(player) then return end
if param and param ~= 'nil' then
for _, class in pairs(Classes.enum) do
if Classes.eng_form[class]:lower() == param:lower() then
@ -358,7 +358,7 @@ end)
local go_2 = Token.register(
function(data)
Memory.set_working_id(1)
Memory.set_working_id(data.id)
local memory = Memory.get_crew_memory()
memory.mapbeingloadeddestination_index = 1
@ -372,7 +372,7 @@ local go_2 = Token.register(
)
local go_1 = Token.register(
function(data)
Memory.set_working_id(1)
Memory.set_working_id(data.id)
local memory = Memory.get_crew_memory()
Overworld.ensure_lane_generated_up_to(0, Crowsnest.Data.visibilitywidth/2)
Overworld.ensure_lane_generated_up_to(24, Crowsnest.Data.visibilitywidth/2)
@ -380,7 +380,7 @@ local go_1 = Token.register(
memory.currentdestination_index = 1
script.raise_event(CustomEvents.enum['update_crew_progress_gui'], {})
Surfaces.create_surface(Common.current_destination())
Task.set_timeout_in_ticks(60, go_2, {})
Task.set_timeout_in_ticks(60, go_2, {id = data.id})
end
)
@ -414,7 +414,7 @@ function(cmd)
local memory = Memory.get_crew_memory()
if not Common.is_id_valid(memory.id) then return end
local player = game.players[cmd.player_index]
local param = tostring(cmd.parameter)
if check_captain_or_admin(cmd) then
@ -439,7 +439,7 @@ function(cmd)
local memory = Memory.get_crew_memory()
if not Common.is_id_valid(memory.id) then return end
--local param = tostring(cmd.parameter)
if check_captain_or_admin(cmd) then
local player = game.players[cmd.player_index]
@ -460,7 +460,7 @@ function(cmd)
local memory = Memory.get_crew_memory()
if not Common.is_id_valid(memory.id) then return end
--local param = tostring(cmd.parameter)
if check_captain(cmd) then
--local player = game.players[cmd.player_index]
@ -474,7 +474,7 @@ commands.add_command(
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
if not Common.validate_player(player) then return end
@ -483,12 +483,13 @@ function(cmd)
end
end)
-- Equip a class passed in parameter (although I think this command is redundant since there is /take command?)
commands.add_command(
'setclass',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -505,7 +506,7 @@ commands.add_command(
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -518,7 +519,7 @@ commands.add_command(
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -537,12 +538,13 @@ function(cmd)
end
end)
-- Undock from an island or dock
commands.add_command(
'ret',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -550,12 +552,13 @@ function(cmd)
end
end)
-- Move overworld boat right by a lot (you can jump over islands that way to skip them)
commands.add_command(
'jump',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -563,12 +566,13 @@ function(cmd)
end
end)
-- Move overworld boat up
commands.add_command(
'advu',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -576,12 +580,13 @@ function(cmd)
end
end)
-- Move overworld boat down
commands.add_command(
'advd',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -595,7 +600,7 @@ commands.add_command(
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
if not Common.validate_player(player) then return end
@ -607,10 +612,12 @@ end)
if _DEBUG then
-- Teleport player to available boat in lobby, automatically start journey and arrive at sea faster
commands.add_command(
'go',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -623,29 +630,27 @@ if _DEBUG then
endorserindices = { 1 },
name = "AdminRun"
}
Memory.set_working_id(1)
Crew.initialise_crew(proposal)
Crew.initialise_crowsnest() --contains a Task
local memory = Memory.get_crew_memory()
local boat = Utils.deepcopy(Surfaces.Lobby.StartingBoats[memory.id])
for _, p in pairs(game.connected_players) do
p.teleport({x = -30, y = boat.position.y}, game.surfaces[boat.surface_name])
end
Progression.set_off_from_starting_dock()
-- local memory = Memory.get_crew_memory()
-- local boat = Utils.deepcopy(Surfaces.Lobby.StartingBoats[memory.id])
-- memory.boat = boat
-- boat.dockedposition = boat.position
-- boat.decksteeringchests = {}
-- boat.crowsneststeeringchests = {}
Task.set_timeout_in_ticks(120, go_1, {})
Task.set_timeout_in_ticks(120, go_1, {id = memory.id})
else
game.print('Can\'t use this command when run has already launched')
end
@ -657,7 +662,7 @@ if _DEBUG then
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -677,7 +682,7 @@ if _DEBUG then
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -691,7 +696,7 @@ if _DEBUG then
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
@ -741,40 +746,43 @@ if _DEBUG then
end
end)
-- Leave island, or dock immediately
commands.add_command(
'lev',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local memory = Memory.get_crew_memory()
Progression.go_from_currentdestination_to_sea()
end
end)
-- Add another hold
commands.add_command(
'hld',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local memory = Memory.get_crew_memory()
Upgrades.execute_upgade(Upgrades.enum.EXTRA_HOLD)
end
end)
-- Upgrade power generators
commands.add_command(
'pwr',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local memory = Memory.get_crew_memory()
Upgrades.execute_upgade(Upgrades.enum.MORE_POWER)
end
@ -813,24 +821,25 @@ if _DEBUG then
'tim',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
Common.current_destination().dynamic_data.timer = 88
game.print('time set to 88 seconds')
end
end)
-- Add 20000 coal fuel to ship
commands.add_command(
'gld',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
memory.stored_fuel = memory.stored_fuel + 20000
end
@ -840,10 +849,10 @@ if _DEBUG then
'bld',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
memory.classes_table = {[1] = 1}
end
@ -853,10 +862,10 @@ if _DEBUG then
'rad',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
Islands.spawn_enemy_boat(Boats.enum.RAFT)
local boat = memory.enemyboats[1]
@ -869,10 +878,10 @@ if _DEBUG then
'rad2',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
Islands.spawn_enemy_boat(Boats.enum.RAFTLARGE)
local boat = memory.enemyboats[1]
@ -881,114 +890,124 @@ if _DEBUG then
end
end)
-- Spawns kraken if at sea
commands.add_command(
'krk',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
Memory.set_working_id(1)
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
Kraken.try_spawn_kraken()
end
end)
-- Sets game speed to 0.25
commands.add_command(
'1/4',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
game.speed = 0.5
local player = game.players[cmd.player_index]
game.speed = 0.25
end
end)
-- Sets game speed to 0.5
commands.add_command(
'1/2',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
game.speed = 0.5
end
end)
-- Sets game speed to 1
commands.add_command(
'1',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
game.speed = 1
end
end)
-- Sets game speed to 2
commands.add_command(
'2',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
game.speed = 2
end
end)
-- Sets game speed to 4
commands.add_command(
'4',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
game.speed = 4
end
end)
-- Sets game speed to 8
commands.add_command(
'8',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
game.speed = 8
end
end)
-- Sets game speed to 16
commands.add_command(
'16',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
game.speed = 16
end
end)
-- Sets game speed to 32
commands.add_command(
'32',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
game.speed = 32
end
end)
-- Sets game speed to 64
commands.add_command(
'64',
{'pirates.cmd_explain_dev'},
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
game.speed = 64
end
end)
@ -998,10 +1017,10 @@ if _DEBUG then
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
local surface = game.surfaces[Common.current_destination().surface_name]
Effects.worm_movement_effect(surface, {x = -45, y = 0}, false, true)
@ -1013,10 +1032,10 @@ if _DEBUG then
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
local surface = game.surfaces[Common.current_destination().surface_name]
Effects.worm_movement_effect(surface, {x = -45, y = 0}, false, false)
@ -1028,10 +1047,10 @@ if _DEBUG then
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
local surface = game.surfaces[Common.current_destination().surface_name]
Effects.worm_movement_effect(surface, {x = -45, y = 0}, true, false)
@ -1043,10 +1062,10 @@ if _DEBUG then
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
local surface = game.surfaces[Common.current_destination().surface_name]
Effects.worm_emerge_effect(surface, {x = -45, y = 0})
@ -1058,10 +1077,10 @@ if _DEBUG then
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
local surface = game.surfaces[Common.current_destination().surface_name]
Effects.biters_emerge(surface, {x = -30, y = 0})
@ -1074,11 +1093,109 @@ if _DEBUG then
function(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local player = game.players[cmd.player_index]
Server.to_discord_embed_raw(CoreData.comfy_emojis.monkas)
end
end)
-- Spawn friendly gun turrets with ammo to defend your ship
commands.add_command(
'def',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
if not Common.is_id_valid(memory.id) then return end
local boat = memory.boat
local scope = Boats.get_scope(boat)
if scope.Data.cannons then
for i = -2, 2 do
local p1 = scope.Data.cannons[1]
local p2 = {x = boat.position.x + p1.x + i * 2, y = boat.position.y + p1.y - 4}
local e = player.surface.create_entity({name = 'gun-turret', position = p2, force = boat.force_name, create_build_effect_smoke = false})
if e and e.valid then
e.insert({name = "uranium-rounds-magazine", count = 200})
end
end
for i = -2, 2 do
local p1 = scope.Data.cannons[2]
local p2 = {x = boat.position.x + p1.x + i * 2, y = boat.position.y + p1.y + 4}
local e = player.surface.create_entity({name = 'gun-turret', position = p2, force = boat.force_name, create_build_effect_smoke = false})
if e and e.valid then
e.insert({name = "uranium-rounds-magazine", count = 200})
end
end
end
end
end)
-- Spawn friendly gun turrets with ammo around you
commands.add_command(
'atk',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
local memory = Memory.get_crew_memory()
if not Common.is_id_valid(memory.id) then return end
local boat = memory.boat
local p = player.character.position
local turret_positions = {
{x = p.x - 2, y = p.y - 2},
{x = p.x - 2, y = p.y + 2},
{x = p.x + 2, y = p.y - 2},
{x = p.x + 2, y = p.y + 2},
}
for _, pos in pairs(turret_positions) do
local e = player.surface.create_entity({name = 'gun-turret', position = pos, force = boat.force_name, create_build_effect_smoke = false})
if e and e.valid then
e.insert({name = "uranium-rounds-magazine", count = 200})
end
end
end
end)
-- Give advanced starter kit to make exploration easier
commands.add_command(
'kit',
{'pirates.cmd_explain_dev'},
function(cmd)
if check_admin(cmd) then
local player = game.players[cmd.player_index]
player.insert{name='substation', count = 50}
player.insert{name='solar-panel', count = 50}
player.insert{name='submachine-gun', count = 1}
player.insert{name='uranium-rounds-magazine', count = 200}
player.insert{name='raw-fish', count = 100}
player.insert{name='coin', count = 50000}
player.insert{name='rail-signal', count = 300}
end
end)
-- Unlock a class
commands.add_command(
'unlock',
{'pirates.cmd_explain_dev'},
function(cmd)
cmd_set_memory(cmd)
local param = tostring(cmd.parameter)
if check_admin(cmd) then
local memory = Memory.get_crew_memory()
if not Common.is_id_valid(memory.id) then return end
local player = game.players[cmd.player_index]
Classes.try_unlock_class(param, player, true)
end
end)
commands.add_command(
'piratux_test',
'is a dev command of piratux.',

View File

@ -118,7 +118,7 @@ local function tick_tack_trap(force_name, surface, position)
if math.random(1, 10) == 1 then
traps[tick][#traps[tick] + 1] = {
callback = 'create_flying_text',
params = {surface, {x = position.x, y = position.y}, '...'}
params = {surface, {x = position.x, y = position.y}, '(☞ ͡° ͜ʖ ͡°)☞'}
}
else
traps[tick][#traps[tick] + 1] = {

View File

@ -441,35 +441,35 @@ function Public.maze_treasure_loot()
end
Public.dredger_loot_raw = {
{8, 0, 1, false, 'iron-plate', 1, 1},
{8, 0, 1, false, 'copper-plate', 1, 1},
{8, 0, 1, false, 'coal', 1, 1},
{10, 0, 1, false, 'coin', 1, 1},
{8, 0, 1, false, 'iron-plate', 5, 80},
{8, 0, 1, false, 'copper-plate', 5, 80},
{8, 0, 1, false, 'coal', 5, 50},
{10, 0, 1, false, 'coin', 10, 100},
{2, 0, 1, false, 'small-electric-pole', 1, 1},
{1, 0, 1, false, 'medium-electric-pole', 1, 1},
{0.1, 0, 1, false, 'big-electric-pole', 1, 1},
{2, 0, 1, false, 'small-electric-pole', 2, 10},
{1, 0, 1, false, 'medium-electric-pole', 1, 5},
{0.1, 0, 1, false, 'big-electric-pole', 1, 3},
{0.2, 0, 1, false, 'poison-capsule', 1, 1},
{0.2, 0, 1, false, 'slowdown-capsule', 1, 1},
{0.1, 0, 1, false, 'destroyer-capsule', 1, 1},
{0.2, 0, 1, false, 'defender-capsule', 1, 1},
{0.2, 0, 1, false, 'distractor-capsule', 1, 1},
{0.2, 0, 1, false, 'poison-capsule', 1, 4},
{0.2, 0, 1, false, 'slowdown-capsule', 1, 4},
{0.1, 0, 1, false, 'destroyer-capsule', 1, 3},
{0.2, 0, 1, false, 'defender-capsule', 1, 4},
{0.2, 0, 1, false, 'distractor-capsule', 1, 3},
{0.05, 0, 1, false, 'speed-module-3', 1, 1},
{0.05, 0, 1, false, 'effectivity-module-3', 1, 1},
{0.05, 0, 1, false, 'productivity-module-2', 1, 1}, --3s are banned because of game mech
{0.05, 0, 1, false, 'speed-module-3', 1, 2},
{0.05, 0, 1, false, 'effectivity-module-3', 1, 2},
{0.05, 0, 1, false, 'productivity-module-2', 1, 2}, --3s are banned because of game mech
{0.1, 0, 1, false, 'rocket', 1, 1},
{0.01, 0, 1, false, 'explosive-rocket', 1, 1},
{0.1, 0, 1, false, 'rocket', 1, 3},
{0.01, 0, 1, false, 'explosive-rocket', 1, 2},
{4, 0, 1, false, 'automation-science-pack', 1, 1},
{4, 0, 1, false, 'logistic-science-pack', 1, 1},
{2, 0, 1, false, 'military-science-pack', 1, 1},
{1, 0, 1, false, 'chemical-science-pack', 1, 1},
{1, 0, 1, false, 'production-science-pack', 1, 1},
{0.5, 0, 1, false, 'utility-science-pack', 1, 1},
{4, 0, 1, false, 'automation-science-pack', 4, 15},
{4, 0, 1, false, 'logistic-science-pack', 4, 15},
{2, 0, 1, false, 'military-science-pack', 2, 10},
{1, 0, 1, false, 'chemical-science-pack', 2, 8},
{1, 0, 1, false, 'production-science-pack', 1, 5},
{0.5, 0, 1, false, 'utility-science-pack', 1, 4},
{0.012, 0, 0.8, false, 'night-vision-equipment', 1, 1},
{0.01, 0, 1, false, 'exoskeleton-equipment', 1, 1},

View File

@ -565,7 +565,11 @@ function Public.is_position_free_to_move_to(p)
local ret = true
for _, destination_data in pairs(memory.destinations) do
if p.x >= destination_data.overworld_position.x + 1 and p.x <= destination_data.overworld_position.x + destination_data.iconized_map_width + Crowsnest.platformwidth - 1 and p.y >= destination_data.overworld_position.y - destination_data.iconized_map_width/2 - Crowsnest.platformheight/2 + 1 and p.y <= destination_data.overworld_position.y + destination_data.iconized_map_width/2 + Crowsnest.platformheight/2 - 1 then
if p.x >= destination_data.overworld_position.x + 1 and
p.x <= destination_data.overworld_position.x + destination_data.iconized_map_width + Crowsnest.platformwidth - 1 and
p.y >= destination_data.overworld_position.y - destination_data.iconized_map_width/2 - Crowsnest.platformheight/2 + 1 and
p.y <= destination_data.overworld_position.y + destination_data.iconized_map_width/2 + Crowsnest.platformheight/2 - 1
then
ret = false
break
end

View File

@ -131,7 +131,7 @@ function Public.chunk_structures(args)
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
return {
placeable = noises.height(p) >= 0 and noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
-- placeable = noises.height(p) >= 0 and noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
placeable_strict = noises.height(p) >= 0.05,
placeable_optional = noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
chanceper4chunks = 0.4 * Math.slopefromto(noises.farness(p), 0.1, 0.4) * Math.slopefromto(noises.mood(p), 0, 0.25),

View File

@ -152,7 +152,8 @@ function Public.chunk_structures(args)
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
return {
placeable = noises.height(p) > 0.05 and noises.mood(p) > -0.6 and noises.farness(p) > 0.1,
placeable_strict = noises.height(p) > 0.05 and noises.mood(p) > -0.6 and noises.farness(p) > 0.1,
placeable_optional = true,
chanceper4chunks = 0.05,
}
end
@ -202,7 +203,7 @@ function Public.chunk_structures(args)
struct = Structures.IslandStructures.ROC.shelter1
end
if struct then
Structures.try_place(struct, args.specials, leftmost_topmost, 64, 64, function(p) return spec(p).placeable end)
Structures.try_place(struct, args.specials, leftmost_topmost, 64, 64, function(p) return spec(p).placeable_strict end, function(p) return spec(p).placeable_optional end)
end
end
end

View File

@ -128,7 +128,7 @@ function Public.chunk_structures(args)
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
return {
placeable = noises.height(p) >= 0 and noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
-- placeable = noises.height(p) >= 0 and noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
placeable_strict = noises.height(p) >= 0.05,
placeable_optional = noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
chanceper4chunks = 0.1 * Math.slopefromto(noises.farness(p), 0.1, 0.4) * Math.slopefromto(noises.mood(p), 0, 0.25),

View File

@ -132,7 +132,7 @@ function Public.chunk_structures(args)
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
return {
placeable = noises.height(p) >= 0 and noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
-- placeable = noises.height(p) >= 0 and noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
placeable_strict = noises.height(p) >= 0.05,
placeable_optional = noises.forest_abs_suppressed(p) < 0.3 + Math.max(0, 0.2 - noises.height(p)),
chanceper4chunks = 0.1 * Math.slopefromto(noises.farness(p), 0.1, 0.4) * Math.slopefromto(noises.mood(p), 0, 0.25),

View File

@ -140,7 +140,8 @@ function Public.chunk_structures(args)
local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
return {
placeable = noises.height(p) > 0.05,
placeable_strict = noises.height(p) > 0.05,
placeable_optional = true,
chanceperchunk = 0.25 * Math.slopefromto(noises.farness(p), 0.05, 0.15),
}
end
@ -163,7 +164,7 @@ function Public.swamp_structures(args, spec)
struct = Structures.IslandStructures.ROC.swamp_lonely_storage_tank
if struct then
Structures.try_place(struct, args.specials, left_top, 64, 64, function(p) return spec(p).placeable end)
Structures.try_place(struct, args.specials, left_top, 64, 64, function(p) return spec(p).placeable_strict end, function(p) return spec(p).placeable_optional end)
end
end
end

View File

@ -101,7 +101,9 @@ function Public.chunk_structures(args)
-- local noises = Public.noises{p = p, noise_generator = args.noise_generator, static_params = args.static_params, seed = args.seed}
-- return {
-- placeable = noises.height(p) > 0.1 and noises.walkways(p) < 0.3,
-- -- placeable = noises.height(p) > 0.1 and noises.walkways(p) < 0.3,
-- placeable_strict = noises.height(p) > 0.1 and noises.walkways(p) < 0.3,
-- placeable_optional = true,
-- chanceper4chunks = 1/2,
-- }
-- end

View File

@ -239,7 +239,7 @@ local function on_entity_destroyed(event)
end
if p then
local surface = game.surfaces[memory.sea_name]
if not surface and surface.valid then return end
if not (surface and surface.valid) then return end
local spits_here = surface.find_entities_filtered{position = p, radius = 0.5, name = 'acid-splash-fire-spitter-big'}
if spits_here and #spits_here > 0 then
@ -269,6 +269,7 @@ function Public.try_spawn_kraken()
if not memory.active_sea_enemies then memory.active_sea_enemies = {} end
if not memory.active_sea_enemies.krakens then memory.active_sea_enemies.krakens = {} end
if not memory.active_sea_enemies.kraken_count then memory.active_sea_enemies.kraken_count = 0 end
local possible_slots = {}
for i = 1, Public.kraken_slots do
@ -288,6 +289,7 @@ function Public.try_spawn_kraken()
spawner_entity = nil,
frame = nil,
}
memory.active_sea_enemies.kraken_count = memory.active_sea_enemies.kraken_count + 1
Task.set_timeout_in_ticks(10, kraken_tick_token, {crew_id = memory.id, kraken_id = kraken_id, step = 1, substep = 1})
Task.set_timeout_in_ticks(10, swimming_biters_tick_token, {crew_id = memory.id, kraken_id = kraken_id})
@ -365,7 +367,10 @@ function Public.kraken_die(kraken_id)
end
surface.set_tiles(tiles2, true, false)
memory.active_sea_enemies.krakens[kraken_id] = nil
if memory.active_sea_enemies.krakens[kraken_id] then
memory.active_sea_enemies.kraken_count = Math.max(0, memory.active_sea_enemies.kraken_count - 1)
memory.active_sea_enemies.krakens[kraken_id] = nil
end
local reward_items = Balance.kraken_kill_reward_items()
Common.give_items_to_crew(reward_items)