mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-05 13:15:03 +02:00
tweaks and fixes
This commit is contained in:
parent
0f4cf43078
commit
92cb69c367
@ -1,5 +1,5 @@
|
||||
[mountain_fortress_v3]
|
||||
map_info_main_caption=M O U N T A I N F O R T R E S S V3
|
||||
map_info_sub_caption= ~~ diggy diggy choo choo ~~
|
||||
map_info_text=The biters have catched the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research, will overhaul your mining equipment,\nreinforcing your pickaxe as well as increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause parts of the ceiling to crumble, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nGood luck on your journey!
|
||||
map_info_text=The biters have catched the scent of fish in the cargo wagon.\nGuide the choo into the mountain and protect it as long as possible!\nThis however will not be an easy task,\nsince their strength and numbers increase over time.\n\nIn additon, the southern grounds collapse over time.\n\nDelve deep for greater treasures, but also face increased dangers.\nMining productivity research, will overhaul your mining equipment,\nreinforcing your pickaxe as well as increasing the size of your backpack.\n\nAs you dig, you will encounter impassable dark chasms or rivers.\nArtillery will try to shoot you down! Dig fast, dig north!\n\nSome explosives may cause parts of the ceiling to crumble, filling the void, creating new ways.\nAll they need is a container and a well aimed shot.\n\nEnter the cargo wagon to reveal the wagon surface!\n\nRandom buildings that generate resources can be found throughout the world.\n\nPlacing steel-chests near cargo-wagons enables you to quickly move content.\n\nStaying inside the locomotive aura prevents biters from spawning when mining entities.\n\nRPG GUI is disabled inside the locomotive.\nDisconnecting wagons is disabled.\nYou can´t cancel crafting when standing inside the locomotive aura.\n\nGood luck on your journey!
|
||||
|
||||
|
@ -1299,8 +1299,8 @@ local on_player_or_robot_built_tile = function(event)
|
||||
end
|
||||
for k, v in pairs(tiles) do
|
||||
local old_tile = v.old_tile
|
||||
if old_tile.name == 'tutorial-grid' then
|
||||
surface.set_tiles({{name = 'tutorial-grid', position = v.position}}, true)
|
||||
if old_tile.name == 'shallow-water' then
|
||||
surface.set_tiles({{name = 'shallow-water', position = v.position}}, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -303,6 +303,7 @@ local function on_player_mined_entity(event)
|
||||
if not entity.valid then
|
||||
return
|
||||
end
|
||||
local rpg_char = RPG.get_table(player.index)
|
||||
|
||||
local map_name = 'mountain_fortress_v3'
|
||||
|
||||
@ -339,7 +340,9 @@ local function on_player_mined_entity(event)
|
||||
this.mined_scrap = this.mined_scrap + 1
|
||||
Mining.on_player_mined_entity(event)
|
||||
give_coin(player)
|
||||
|
||||
if rpg_char.stone_path then
|
||||
entity.surface.set_tiles({{name = 'stone-path', position = entity.position}}, true)
|
||||
end
|
||||
if Locomotive.is_around_train(entity) then
|
||||
entity.destroy()
|
||||
return
|
||||
@ -748,6 +751,10 @@ local function on_built_entity(event)
|
||||
end
|
||||
|
||||
local upg = this.upgrades
|
||||
local surface = entity.surface
|
||||
|
||||
local e = {x = entity.position.x, y = entity.position.y}
|
||||
local get_tile = surface.get_tile(e)
|
||||
|
||||
local built = {
|
||||
['land-mine'] = upg.landmine.built,
|
||||
@ -767,8 +774,6 @@ local function on_built_entity(event)
|
||||
local name = validator[entity.name]
|
||||
|
||||
if built[entity.name] and entity.force.index == 1 then
|
||||
local surface = entity.surface
|
||||
|
||||
if built[entity.name] < limit[entity.name] then
|
||||
this.upgrades[name].built = built[entity.name] + 1
|
||||
this.upgrades.unit_number[name][entity] = entity
|
||||
@ -800,6 +805,11 @@ local function on_built_entity(event)
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
-- if get_tile.valid and get_tile.name == 'black-refined-concrete' then
|
||||
-- entity.destroy()
|
||||
-- return
|
||||
-- end
|
||||
end
|
||||
|
||||
local function on_robot_built_entity(event)
|
||||
@ -810,6 +820,10 @@ local function on_robot_built_entity(event)
|
||||
end
|
||||
|
||||
local upg = this.upgrades
|
||||
local surface = entity.surface
|
||||
|
||||
local e = {x = entity.position.x, y = entity.position.y}
|
||||
local get_tile = surface.get_tile(e)
|
||||
|
||||
local built = {
|
||||
['land-mine'] = upg.landmine.built,
|
||||
@ -829,8 +843,6 @@ local function on_robot_built_entity(event)
|
||||
local name = validator[entity.name]
|
||||
|
||||
if built[entity.name] and entity.force.index == 1 then
|
||||
local surface = entity.surface
|
||||
|
||||
if built[entity.name] < limit[entity.name] then
|
||||
this.upgrades[name].built = built[entity.name] + 1
|
||||
this.upgrades.unit_number[name][entity] = entity
|
||||
@ -862,6 +874,40 @@ local function on_robot_built_entity(event)
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
if get_tile.valid and get_tile.name == 'black-refined-concrete' then
|
||||
entity.destroy()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local on_player_or_robot_built_tile = function(event)
|
||||
local surface = game.surfaces[event.surface_index]
|
||||
|
||||
local map_name = 'mountain_fortress_v3'
|
||||
|
||||
if string.sub(surface.name, 0, #map_name) == map_name then
|
||||
return
|
||||
end
|
||||
|
||||
local tiles = event.tiles
|
||||
if not tiles then
|
||||
return
|
||||
end
|
||||
for k, v in pairs(tiles) do
|
||||
local old_tile = v.old_tile
|
||||
if old_tile.name == 'black-refined-concrete' then
|
||||
surface.set_tiles({{name = 'black-refined-concrete', position = v.position}}, true)
|
||||
end
|
||||
if old_tile.name == 'blue-refined-concrete' then
|
||||
surface.set_tiles({{name = 'blue-refined-concrete', position = v.position}}, true)
|
||||
end
|
||||
if old_tile.name == 'cyan-refined-concrete' then
|
||||
surface.set_tiles({{name = 'cyan-refined-concrete', position = v.position}}, true)
|
||||
end
|
||||
if old_tile.name == 'hazard-concrete-right' then
|
||||
surface.set_tiles({{name = 'hazard-concrete-right', position = v.position}}, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_entity_damaged, on_entity_damaged)
|
||||
@ -871,5 +917,7 @@ Event.add(defines.events.on_robot_mined_entity, on_robot_mined_entity)
|
||||
Event.add(defines.events.on_entity_died, on_entity_died)
|
||||
Event.add(defines.events.on_built_entity, on_built_entity)
|
||||
Event.add(defines.events.on_robot_built_entity, on_robot_built_entity)
|
||||
Event.add(defines.events.on_player_built_tile, on_player_or_robot_built_tile)
|
||||
Event.add(defines.events.on_robot_built_tile, on_player_or_robot_built_tile)
|
||||
|
||||
return Public
|
||||
|
@ -1,6 +1,7 @@
|
||||
local Event = require 'utils.event'
|
||||
local RPG = require 'modules.rpg_v2'
|
||||
local WPT = require 'maps.mountain_fortress_v3.table'
|
||||
local Locomotive = require 'maps.mountain_fortress_v3.locomotive'
|
||||
local Gui = require 'utils.gui'
|
||||
local format_number = require 'util'.format_number
|
||||
|
||||
@ -155,6 +156,7 @@ local function on_gui_click(event)
|
||||
local info = player.gui.top[main_frame_name]
|
||||
local wd = player.gui.top['wave_defense']
|
||||
local diff = player.gui.top['difficulty_gui']
|
||||
|
||||
if info and info.visible then
|
||||
if wd then
|
||||
wd.visible = false
|
||||
@ -197,39 +199,25 @@ local function on_gui_click(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function add_player_to_permission_group(player, group)
|
||||
if group == 'locomotive' then
|
||||
local locomotive_group = game.permissions.get_group('locomotive')
|
||||
if not locomotive_group then
|
||||
locomotive_group = game.permissions.create_group('locomotive')
|
||||
locomotive_group.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.admin_action, false)
|
||||
end
|
||||
locomotive_group = game.permissions.get_group('locomotive')
|
||||
locomotive_group.add_player(player)
|
||||
elseif group == 'default' then
|
||||
local default_group = game.permissions.get_group('Default')
|
||||
|
||||
default_group.add_player(player)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_player_changed_surface(event)
|
||||
local player = game.players[event.player_index]
|
||||
if not validate_player(player) then
|
||||
return
|
||||
end
|
||||
|
||||
local rpg_button = RPG.draw_main_frame_name
|
||||
local rpg_frame = RPG.main_frame_name
|
||||
local rpg_settings = RPG.settings_frame_name
|
||||
local main = WPT.get('locomotive')
|
||||
local icw_locomotive = WPT.get('icw_locomotive')
|
||||
local wagon_surface = icw_locomotive.surface
|
||||
local info = player.gui.top[main_button_name]
|
||||
local wd = player.gui.top['wave_defense']
|
||||
local rpg_b = player.gui.top[rpg_button]
|
||||
local rpg_f = player.gui.left[rpg_frame]
|
||||
local rpg_s = player.gui.screen[rpg_settings]
|
||||
local diff = player.gui.top['difficulty_gui']
|
||||
local charging = player.gui.top['charging_station']
|
||||
local frame = player.gui.top[main_frame_name]
|
||||
|
||||
if info then
|
||||
@ -252,21 +240,44 @@ local function on_player_changed_surface(event)
|
||||
end
|
||||
|
||||
if player.surface == main.surface then
|
||||
add_player_to_permission_group(player, 'default')
|
||||
local minimap = player.gui.left.icw_map
|
||||
if minimap and minimap.visible then
|
||||
minimap.visible = false
|
||||
end
|
||||
if rpg_b and not rpg_b.visible then
|
||||
rpg_b.visible = true
|
||||
end
|
||||
if diff and not diff.visible then
|
||||
diff.visible = true
|
||||
end
|
||||
if wd and not wd.visible then
|
||||
wd.visible = true
|
||||
end
|
||||
if charging and not charging.visible then
|
||||
charging.visible = true
|
||||
end
|
||||
|
||||
info.tooltip = 'Shows statistics!'
|
||||
info.sprite = 'item/dummy-steel-axe'
|
||||
elseif player.surface == wagon_surface then
|
||||
add_player_to_permission_group(player, 'locomotive')
|
||||
if wd then
|
||||
wd.visible = false
|
||||
end
|
||||
if rpg_b then
|
||||
rpg_b.visible = false
|
||||
end
|
||||
if rpg_f then
|
||||
rpg_f.destroy()
|
||||
end
|
||||
if rpg_s then
|
||||
rpg_s.destroy()
|
||||
end
|
||||
if diff then
|
||||
diff.visible = false
|
||||
end
|
||||
if charging then
|
||||
charging.visible = false
|
||||
end
|
||||
if info then
|
||||
info.tooltip = 'Hide locomotive minimap!'
|
||||
info.sprite = 'utility/map'
|
||||
|
@ -16,6 +16,25 @@ local function validate_entity(entity)
|
||||
return true
|
||||
end
|
||||
|
||||
local function validate_player(player)
|
||||
if not player then
|
||||
return false
|
||||
end
|
||||
if not player.valid then
|
||||
return false
|
||||
end
|
||||
if not player.character then
|
||||
return false
|
||||
end
|
||||
if not player.connected then
|
||||
return false
|
||||
end
|
||||
if not game.players[player.name] then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function delete_empty_surfaces(icw)
|
||||
for k, surface in pairs(icw.surfaces) do
|
||||
if not icw.trains[tonumber(surface.name)] then
|
||||
@ -238,17 +257,23 @@ local function construct_wagon_doors(icw, wagon)
|
||||
local area = wagon.area
|
||||
local surface = wagon.surface
|
||||
|
||||
for _, x in pairs({area.left_top.x - 0.55, area.right_bottom.x + 0.55}) do
|
||||
local main_tile_name = 'tutorial-grid'
|
||||
if wagon.entity.type == 'locomotive' then
|
||||
main_tile_name = 'black-refined-concrete'
|
||||
end
|
||||
|
||||
for _, x in pairs({area.left_top.x - 1, area.right_bottom.x + 0.5}) do
|
||||
local p = {x, area.left_top.y + 30}
|
||||
surface.set_tiles({{name = main_tile_name, position = p}}, true)
|
||||
local e =
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'car',
|
||||
name = 'player-port',
|
||||
position = {x, area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)},
|
||||
force = 'neutral',
|
||||
create_build_effect_smoke = false
|
||||
}
|
||||
)
|
||||
e.get_inventory(defines.inventory.fuel).insert({name = 'wood', count = 1})
|
||||
e.destructible = false
|
||||
e.minable = false
|
||||
e.operable = false
|
||||
@ -630,7 +655,85 @@ function Public.subtract_wagon_entity_count(icw, removed_entity)
|
||||
wagon.entity.minable = true
|
||||
end
|
||||
|
||||
function Public.use_cargo_wagon_door(icw, player, door)
|
||||
function Public.teleport_players_around(icw)
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if not validate_player(player) then
|
||||
return
|
||||
end
|
||||
|
||||
if player.surface.find_entity('player-port', player.position) then
|
||||
local door = player.surface.find_entity('player-port', player.position)
|
||||
if door and door.valid then
|
||||
local doors = icw.doors
|
||||
local wagons = icw.wagons
|
||||
|
||||
local wagon = false
|
||||
if doors[door.unit_number] then
|
||||
wagon = wagons[doors[door.unit_number]]
|
||||
end
|
||||
if wagons[door.unit_number] then
|
||||
wagon = wagons[door.unit_number]
|
||||
end
|
||||
if not wagon then
|
||||
return
|
||||
end
|
||||
|
||||
local player_data = get_player_data(icw, player)
|
||||
if player_data.state then
|
||||
player_data.state = player_data.state - 1
|
||||
if player_data.state == 0 then
|
||||
player_data.state = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if wagon.entity.surface.name ~= player.surface.name then
|
||||
local surface = wagon.entity.surface
|
||||
local x_vector = (door.position.x / math.abs(door.position.x)) * 2
|
||||
local position = {wagon.entity.position.x + x_vector, wagon.entity.position.y}
|
||||
local surface_position = surface.find_non_colliding_position('character', position, 128, 0.5)
|
||||
if wagon.entity.type == 'locomotive' then
|
||||
player.teleport(surface_position, surface)
|
||||
player_data.state = 2
|
||||
player.driving = true
|
||||
Public.kill_minimap(player)
|
||||
else
|
||||
player.teleport(surface_position, surface)
|
||||
Public.kill_minimap(player)
|
||||
end
|
||||
player_data.surface = surface.index
|
||||
elseif wagon.entity.type == 'locomotive' and player.driving then
|
||||
player.driving = false
|
||||
else
|
||||
local surface = wagon.surface
|
||||
local area = wagon.area
|
||||
local x_vector = door.position.x - player.position.x
|
||||
local position
|
||||
if x_vector > 0 then
|
||||
position = {
|
||||
area.left_top.x + 0.5,
|
||||
area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)
|
||||
}
|
||||
else
|
||||
position = {
|
||||
area.right_bottom.x - 0.5,
|
||||
area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)
|
||||
}
|
||||
end
|
||||
local p = surface.find_non_colliding_position('character', position, 128, 0.5)
|
||||
if p then
|
||||
player.teleport(p, surface)
|
||||
else
|
||||
player.teleport(position, surface)
|
||||
end
|
||||
player_data.surface = surface.index
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.use_cargo_wagon_door_with_entity(icw, player, door)
|
||||
local player_data = get_player_data(icw, player)
|
||||
if player_data.state then
|
||||
player_data.state = player_data.state - 1
|
||||
|
@ -58,7 +58,7 @@ end
|
||||
local function on_player_driving_changed_state(event)
|
||||
local icw = ICW.get()
|
||||
local player = game.players[event.player_index]
|
||||
Functions.use_cargo_wagon_door(icw, player, event.entity)
|
||||
Functions.use_cargo_wagon_door_with_entity(icw, player, event.entity)
|
||||
end
|
||||
|
||||
local function on_player_changed_surface(event)
|
||||
@ -140,6 +140,7 @@ local function on_tick()
|
||||
local tick = game.tick
|
||||
|
||||
if tick % 60 == 0 then
|
||||
Functions.teleport_players_around(icw)
|
||||
Functions.item_transfer(icw)
|
||||
end
|
||||
if tick % 240 == 0 then
|
||||
|
@ -52,6 +52,32 @@ local function validate_player(player)
|
||||
return true
|
||||
end
|
||||
|
||||
function Public.add_player_to_permission_group(player, group)
|
||||
if group == 'locomotive' then
|
||||
local locomotive_group = game.permissions.get_group('locomotive')
|
||||
if not locomotive_group then
|
||||
locomotive_group = game.permissions.create_group('locomotive')
|
||||
locomotive_group.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.admin_action, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.drop_item, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.place_equipment, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.take_equipment, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
-- locomotive_group.set_allows_action(defines.input_action.connect_rolling_stock, false)
|
||||
end
|
||||
locomotive_group = game.permissions.get_group('locomotive')
|
||||
locomotive_group.add_player(player)
|
||||
elseif group == 'default' then
|
||||
local default_group = game.permissions.get_group('Default')
|
||||
|
||||
default_group.add_player(player)
|
||||
end
|
||||
end
|
||||
|
||||
local function property_boost(data)
|
||||
local xp_floating_text_color = {r = 0, g = 127, b = 33}
|
||||
local visuals_delay = 1800
|
||||
@ -74,6 +100,7 @@ local function property_boost(data)
|
||||
Math2D.bounding_box.contains_point(area, player.position) or
|
||||
player.surface.index == locomotive_surface.index
|
||||
then
|
||||
Public.add_player_to_permission_group(player, 'locomotive')
|
||||
local pos = player.position
|
||||
RPG.gain_xp(player, 0.3 * (rpg[player.index].bonus + this.xp_points))
|
||||
|
||||
@ -86,6 +113,8 @@ local function property_boost(data)
|
||||
}
|
||||
rpg[player.index].xp_since_last_floaty_text = 0
|
||||
rpg[player.index].last_floaty_text = game.tick + visuals_delay
|
||||
else
|
||||
Public.add_player_to_permission_group(player, 'default')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,6 +10,7 @@ require 'modules.spawners_contain_biters'
|
||||
require 'modules.biters_yield_coins'
|
||||
require 'modules.wave_defense.main'
|
||||
require 'modules.mineable_wreckage_yields_scrap'
|
||||
require 'modules.charging_station'
|
||||
|
||||
local Autostash = require 'modules.autostash'
|
||||
local CS = require 'maps.mountain_fortress_v3.surface'
|
||||
@ -228,14 +229,14 @@ function Public.reset_map()
|
||||
game.reset_time_played()
|
||||
WPT.reset_table()
|
||||
Map_score.reset_score()
|
||||
-- AntiGrief.reset_tables()
|
||||
RPG.rpg_reset_all_players()
|
||||
RPG.set_surface_name('mountain_fortress_v3')
|
||||
RPG.enable_health_and_mana_bars(true)
|
||||
RPG.enable_wave_defense(true)
|
||||
RPG.enable_mana(true)
|
||||
RPG.enable_flame_boots(true)
|
||||
RPG.personal_tax_rate(1)
|
||||
RPG.personal_tax_rate(0.3)
|
||||
RPG.enable_stone_path(true)
|
||||
|
||||
disable_tech()
|
||||
|
||||
@ -251,7 +252,6 @@ function Public.reset_map()
|
||||
Entities.set_scores()
|
||||
AntiGrief.log_tree_harvest(true)
|
||||
AntiGrief.whitelist_types('tree', true)
|
||||
--AntiGrief.protect_entities(true)
|
||||
|
||||
local players = game.connected_players
|
||||
for i = 1, #players do
|
||||
@ -272,26 +272,12 @@ function Public.reset_map()
|
||||
Collapse.set_direction('north')
|
||||
Collapse.start_now(false)
|
||||
|
||||
--[[
|
||||
local x_value = rng(15, 25)
|
||||
local y_value = rng(50, 60)
|
||||
|
||||
local data = {
|
||||
['cargo-wagon'] = {left_top = {x = -x_value, y = 0}, right_bottom = {x = x_value, y = y_value}},
|
||||
['artillery-wagon'] = {left_top = {x = -x_value, y = 0}, right_bottom = {x = x_value, y = y_value}},
|
||||
['fluid-wagon'] = {left_top = {x = -x_value, y = 0}, right_bottom = {x = x_value, y = y_value}},
|
||||
['locomotive'] = {left_top = {x = -x_value, y = 0}, right_bottom = {x = x_value, y = y_value}}
|
||||
}
|
||||
ICT.set_wagon_area(data)
|
||||
|
||||
]]
|
||||
this.locomotive_health = 10000
|
||||
this.locomotive_max_health = 10000
|
||||
|
||||
Locomotive.locomotive_spawn(surface, {x = -18, y = 25})
|
||||
Locomotive.render_train_hp()
|
||||
render_direction(surface)
|
||||
-- LM.place_market()
|
||||
|
||||
WD.reset_wave_defense()
|
||||
wave_defense_table.surface_index = this.active_surface_index
|
||||
@ -632,8 +618,9 @@ local boost_difficulty = function()
|
||||
WPT.get('upgrades').landmine.limit = 100
|
||||
WPT.get().locomotive_health = 20000
|
||||
WPT.get().locomotive_max_health = 20000
|
||||
WPT.get().difficulty_set = true
|
||||
WPT.get().bonus_xp_on_join = 700
|
||||
WD.set().next_wave = game.tick + 3600 * 20
|
||||
WPT.get().difficulty_set = true
|
||||
elseif name == 'Normal' then
|
||||
rpg_extra.difficulty = 0.5
|
||||
game.forces.player.manual_mining_speed_modifier = 0.5
|
||||
@ -646,6 +633,7 @@ local boost_difficulty = function()
|
||||
WPT.get().locomotive_health = 10000
|
||||
WPT.get().locomotive_max_health = 10000
|
||||
WPT.get().bonus_xp_on_join = 300
|
||||
WD.set().next_wave = game.tick + 3600 * 15
|
||||
WPT.get().difficulty_set = true
|
||||
elseif name == 'Hard' then
|
||||
rpg_extra.difficulty = 0
|
||||
@ -659,6 +647,7 @@ local boost_difficulty = function()
|
||||
WPT.get().locomotive_health = 5000
|
||||
WPT.get().locomotive_max_health = 5000
|
||||
WPT.get().bonus_xp_on_join = 50
|
||||
WD.set().next_wave = game.tick + 3600 * 10
|
||||
WPT.get().difficulty_set = true
|
||||
end
|
||||
end
|
||||
@ -727,9 +716,9 @@ local on_init = function()
|
||||
}
|
||||
|
||||
local tooltip = {
|
||||
[1] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 1.\nMining speed boosted = 1.5.\nRunning speed boosted = 0.2.\nCrafting speed boosted = 0.4.\nCoin amount per harvest = 2.\nFlame Turret limit = 25.\nLandmine limit = 100.\nLocomotive health = 20000.\nHidden Treasure has higher chance to spawn.',
|
||||
[2] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.5.\nMining speed boosted = 1.\nRunning speed boosted = 0.1.\nCrafting speed boosted = 0.2.\nCoin amount per harvest = 1.\nFlame Turret limit = 10.\nLandmine limit = 50.\nLocomotive health = 10000.\nHidden Treasure has normal chance to spawn.',
|
||||
[3] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 3.\nLandmine limit = 10.\nLocomotive health = 5000.\nHidden Treasure has lower chance to spawn.'
|
||||
[1] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 1.\nMining speed boosted = 1.5.\nRunning speed boosted = 0.2.\nCrafting speed boosted = 0.4.\nCoin amount per harvest = 2.\nFlame Turret limit = 25.\nLandmine limit = 100.\nLocomotive health = 20000.\nHidden Treasure has higher chance to spawn.\nGrace period: 20 minutes',
|
||||
[2] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.5.\nMining speed boosted = 1.\nRunning speed boosted = 0.1.\nCrafting speed boosted = 0.2.\nCoin amount per harvest = 1.\nFlame Turret limit = 10.\nLandmine limit = 50.\nLocomotive health = 10000.\nHidden Treasure has normal chance to spawn.\nGrace period: 15 minutes',
|
||||
[3] = 'Wave Defense is based on amount of players.\nXP Extra reward points = 0.\nMining speed boosted = 0.\nRunning speed boosted = 0.\nCrafting speed boosted = 0.\nCoin amount per harvest = 1.\nFlame Turret limit = 3.\nLandmine limit = 10.\nLocomotive health = 5000.\nHidden Treasure has lower chance to spawn.\nGrace period: 10 minutes'
|
||||
}
|
||||
|
||||
Difficulty.set_difficulties(difficulties)
|
||||
|
@ -1571,8 +1571,10 @@ local function process_level_1_position(x, y, data)
|
||||
end
|
||||
|
||||
Public.levels = {
|
||||
process_level_2_position,
|
||||
process_level_4_position,
|
||||
process_level_1_position,
|
||||
process_level_2_position,
|
||||
process_level_6_position,
|
||||
process_level_2_position,
|
||||
process_level_3_position,
|
||||
@ -1598,7 +1600,7 @@ end
|
||||
local function process_bits(x, y, data)
|
||||
local levels = Public.levels
|
||||
local left_top_y = data.area.left_top.y
|
||||
local index = math.floor((math.abs(left_top_y / Public.level_depth)) % 15) + 1
|
||||
local index = math.floor((math.abs(left_top_y / Public.level_depth)) % 17) + 1
|
||||
local process_level = levels[index]
|
||||
if not process_level then
|
||||
process_level = levels[#levels]
|
||||
|
@ -4,9 +4,12 @@ local Event = require 'utils.event'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Alert = require 'utils.alert'
|
||||
local Tabs = require 'comfy_panel.main'
|
||||
local Task = require 'utils.task'
|
||||
local Token = require 'utils.token'
|
||||
local P = require 'player_modifiers'
|
||||
local WD = require 'modules.wave_defense.table'
|
||||
local Math2D = require 'math2d'
|
||||
local Session = require 'utils.session_data'
|
||||
|
||||
local points_per_level = 5
|
||||
local nth_tick = 18001
|
||||
@ -49,7 +52,8 @@ local rpg_extra = {
|
||||
enable_wave_defense = false,
|
||||
enable_flame_boots = false,
|
||||
mana_per_tick = 0.1,
|
||||
force_mana_per_tick = false
|
||||
force_mana_per_tick = false,
|
||||
enable_stone_path = false
|
||||
}
|
||||
local rpg_frame_icons = {
|
||||
'entity/small-worm-turret',
|
||||
@ -404,9 +408,140 @@ local conjure_items = {
|
||||
mana_cost = 66,
|
||||
tick = 320,
|
||||
enabled = true
|
||||
},
|
||||
[23] = {
|
||||
name = 'Conjure Raw-fish',
|
||||
obj_to_create = 'fish',
|
||||
target = false,
|
||||
amount = 4,
|
||||
damage = false,
|
||||
range = 30,
|
||||
force = 'player',
|
||||
level = 50,
|
||||
type = 'special',
|
||||
mana_cost = 120,
|
||||
tick = 320,
|
||||
enabled = true
|
||||
},
|
||||
[24] = {
|
||||
name = 'Suicidal Comfylatron',
|
||||
obj_to_create = 'suicidal_comfylatron',
|
||||
target = false,
|
||||
amount = 4,
|
||||
damage = false,
|
||||
range = 30,
|
||||
force = 'player',
|
||||
level = 60,
|
||||
type = 'special',
|
||||
mana_cost = 150,
|
||||
tick = 320,
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
local desync =
|
||||
Token.register(
|
||||
function(data)
|
||||
local entity = data.entity
|
||||
if not entity or not entity.valid then
|
||||
return
|
||||
end
|
||||
local surface = data.surface
|
||||
local fake_shooter = surface.create_entity({name = 'character', position = entity.position, force = 'enemy'})
|
||||
for i = 1, 3 do
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'explosive-rocket',
|
||||
position = entity.position,
|
||||
force = 'enemy',
|
||||
speed = 1,
|
||||
max_range = 1,
|
||||
target = entity,
|
||||
source = fake_shooter
|
||||
}
|
||||
)
|
||||
end
|
||||
if fake_shooter and fake_shooter.valid then
|
||||
fake_shooter.destroy()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local travelings = {
|
||||
'bzzZZrrt',
|
||||
'WEEEeeeeeee',
|
||||
'out of my way son',
|
||||
'on my way',
|
||||
'i need to leave',
|
||||
'comfylatron seeking target',
|
||||
'gotta go fast',
|
||||
'gas gas gas',
|
||||
'comfylatron coming through'
|
||||
}
|
||||
|
||||
local function suicidal_comfylatron(pos, surface)
|
||||
local str = travelings[math.random(1, #travelings)]
|
||||
local symbols = {'', '!', '!', '!!', '..'}
|
||||
str = str .. symbols[math.random(1, #symbols)]
|
||||
local text = str
|
||||
local e =
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'compilatron',
|
||||
position = {x = pos.x, y = pos.y + 2},
|
||||
force = 'player'
|
||||
}
|
||||
)
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'compi-speech-bubble',
|
||||
position = e.position,
|
||||
source = e,
|
||||
text = text
|
||||
}
|
||||
)
|
||||
local entities =
|
||||
surface.find_entities_filtered(
|
||||
{
|
||||
type = {'unit', 'unit-spawner', 'turret'},
|
||||
force = 'enemy',
|
||||
area = {{e.position.x - 80, e.position.y - 80}, {e.position.x + 80, e.position.y + 80}},
|
||||
limit = 1
|
||||
}
|
||||
)
|
||||
|
||||
if entities then
|
||||
for _, entity in pairs(entities) do
|
||||
if entity.name ~= 'compilatron' and entity.active then
|
||||
e.set_command(
|
||||
{
|
||||
type = defines.command.attack,
|
||||
target = entity,
|
||||
distraction = defines.distraction.none
|
||||
}
|
||||
)
|
||||
else
|
||||
e.surface.create_entity({name = 'medium-explosion', position = e.position})
|
||||
e.surface.create_entity(
|
||||
{name = 'flying-text', position = e.position, text = 'desync', color = {r = 150, g = 0, b = 0}}
|
||||
)
|
||||
e.die()
|
||||
end
|
||||
end
|
||||
local data = {
|
||||
entity = e,
|
||||
surface = surface
|
||||
}
|
||||
Task.set_timeout_in_ticks(300, desync, data)
|
||||
else
|
||||
e.surface.create_entity({name = 'medium-explosion', position = e.position})
|
||||
e.surface.create_entity(
|
||||
{name = 'flying-text', position = e.position, text = 'desync', color = {r = 150, g = 0, b = 0}}
|
||||
)
|
||||
e.die()
|
||||
end
|
||||
end
|
||||
|
||||
local function create_healthbar(player, size)
|
||||
return rendering.draw_sprite(
|
||||
{
|
||||
@ -715,6 +850,7 @@ end
|
||||
|
||||
local function extra_settings(player)
|
||||
local player_modifiers = P.get_table()
|
||||
local trusted = Session.get_trusted_table()
|
||||
local main_frame =
|
||||
player.gui.screen.add(
|
||||
{
|
||||
@ -727,7 +863,7 @@ local function extra_settings(player)
|
||||
main_frame.auto_center = true
|
||||
|
||||
local main_frame_style = main_frame.style
|
||||
main_frame_style.width = 400
|
||||
main_frame_style.width = 500
|
||||
|
||||
local info_text =
|
||||
main_frame.add({type = 'label', caption = 'Common RPG settings. These settings are per player basis.'})
|
||||
@ -797,6 +933,11 @@ local function extra_settings(player)
|
||||
local reset_gui_input = create_input_element(reset_input, 'boolean', false)
|
||||
|
||||
if not rpg_t[player.index].reset then
|
||||
if not trusted[player.name] then
|
||||
reset_gui_input.enabled = false
|
||||
reset_gui_input.tooltip = 'Not trusted.\nChecked = true\nUnchecked = false'
|
||||
goto continue
|
||||
end
|
||||
if rpg_t[player.index].level <= 49 then
|
||||
reset_gui_input.enabled = false
|
||||
reset_gui_input.tooltip = 'Level requirement: 50\nChecked = true\nUnchecked = false'
|
||||
@ -808,8 +949,11 @@ local function extra_settings(player)
|
||||
end
|
||||
else
|
||||
reset_gui_input.enabled = false
|
||||
reset_gui_input.tooltip = 'All used up!'
|
||||
end
|
||||
|
||||
::continue::
|
||||
|
||||
local magic_pickup_label =
|
||||
setting_grid.add(
|
||||
{
|
||||
@ -873,6 +1017,44 @@ local function extra_settings(player)
|
||||
local enable_entity_gui_input
|
||||
local conjure_gui_input
|
||||
local flame_boots_gui_input
|
||||
local stone_path_gui_input
|
||||
|
||||
if rpg_extra.enable_stone_path then
|
||||
local stone_path_label =
|
||||
setting_grid.add(
|
||||
{
|
||||
type = 'label',
|
||||
caption = 'Enable stone-path when mining?',
|
||||
tooltip = 'Enabling this will automatically create stone-path when you mine.'
|
||||
}
|
||||
)
|
||||
|
||||
local stone_path_label_style = stone_path_label.style
|
||||
stone_path_label_style.horizontally_stretchable = true
|
||||
stone_path_label_style.height = 35
|
||||
stone_path_label_style.vertical_align = 'center'
|
||||
|
||||
local stone_path_input = setting_grid.add({type = 'flow'})
|
||||
local stone_path_input_style = stone_path_input.style
|
||||
stone_path_input_style.height = 35
|
||||
stone_path_input_style.vertical_align = 'center'
|
||||
local stone_path
|
||||
if rpg_t[player.index].stone_path then
|
||||
stone_path = rpg_t[player.index].stone_path
|
||||
else
|
||||
stone_path = false
|
||||
end
|
||||
stone_path_gui_input = create_input_element(stone_path_input, 'boolean', stone_path)
|
||||
|
||||
if rpg_t[player.index].level <= 20 then
|
||||
stone_path_gui_input.enabled = false
|
||||
stone_path_gui_input.tooltip = 'Level requirement: 20\nChecked = true\nUnchecked = false'
|
||||
stone_path_label.tooltip = 'Level requirement: 20'
|
||||
else
|
||||
stone_path_gui_input.enabled = true
|
||||
stone_path_gui_input.tooltip = 'Checked = true\nUnchecked = false'
|
||||
end
|
||||
end
|
||||
|
||||
if rpg_extra.enable_flame_boots then
|
||||
local flame_boots_label =
|
||||
@ -1004,6 +1186,10 @@ local function extra_settings(player)
|
||||
data.flame_boots_gui_input = flame_boots_gui_input
|
||||
end
|
||||
|
||||
if rpg_extra.enable_stone_path then
|
||||
data.stone_path_gui_input = stone_path_gui_input
|
||||
end
|
||||
|
||||
local bottom_flow = main_frame.add({type = 'flow', direction = 'horizontal'})
|
||||
|
||||
local left_flow = bottom_flow.add({type = 'flow'})
|
||||
@ -1721,12 +1907,14 @@ local function regen_mana_player(players)
|
||||
|
||||
if rpg_extra.enable_health_and_mana_bars then
|
||||
if rpg_t[player.index].show_bars then
|
||||
if not rpg_t[player.index].mana_bar then
|
||||
rpg_t[player.index].mana_bar = create_manabar(player, 0.5)
|
||||
elseif not rendering.is_valid(rpg_t[player.index].mana_bar) then
|
||||
rpg_t[player.index].mana_bar = create_manabar(player, 0.5)
|
||||
if player.character and player.character.valid then
|
||||
if not rpg_t[player.index].mana_bar then
|
||||
rpg_t[player.index].mana_bar = create_manabar(player, 0.5)
|
||||
elseif not rendering.is_valid(rpg_t[player.index].mana_bar) then
|
||||
rpg_t[player.index].mana_bar = create_manabar(player, 0.5)
|
||||
end
|
||||
set_bar(rpg_t[player.index].mana, rpg_t[player.index].mana_max, rpg_t[player.index].mana_bar, true)
|
||||
end
|
||||
set_bar(rpg_t[player.index].mana, rpg_t[player.index].mana_max, rpg_t[player.index].mana_bar, true)
|
||||
end
|
||||
end
|
||||
if player.gui.left[main_frame_name] then
|
||||
@ -2087,8 +2275,17 @@ local function on_player_respawned(event)
|
||||
draw_level_text(player)
|
||||
if rpg_extra.enable_health_and_mana_bars then
|
||||
rpg_t[player.index].health_bar = create_healthbar(player, 0.5)
|
||||
if player.character and player.character.valid then
|
||||
local max_life =
|
||||
math.floor(
|
||||
player.character.prototype.max_health + player.character_health_bonus +
|
||||
player.force.character_health_bonus
|
||||
)
|
||||
set_bar(player.character.health, max_life, rpg_t[player.index].health_bar)
|
||||
end
|
||||
if rpg_extra.enable_mana then
|
||||
rpg_t[player.index].mana_bar = create_manabar(player, 0.5)
|
||||
set_bar(rpg_t[player.index].mana, rpg_t[player.index].mana_max, rpg_t[player.index].mana_bar, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -2301,7 +2498,7 @@ local function on_player_used_capsule(event)
|
||||
end
|
||||
|
||||
if mana <= object.mana_cost then
|
||||
return p('You wave your wand but nothing happens.', Color.fail)
|
||||
return p('You don´t have enough mana to cast this spell.', Color.fail)
|
||||
else
|
||||
rpg_t[player.index].mana = rpg_t[player.index].mana - object.mana_cost
|
||||
end
|
||||
@ -2328,8 +2525,9 @@ local function on_player_used_capsule(event)
|
||||
else
|
||||
force = 'player'
|
||||
end
|
||||
|
||||
if projectile_types[obj_name] then
|
||||
if object.obj_to_create == 'suicidal_comfylatron' then
|
||||
suicidal_comfylatron(position, surface)
|
||||
elseif projectile_types[obj_name] then
|
||||
for i = 1, object.amount do
|
||||
local damage_area = {
|
||||
left_top = {x = position.x - 2, y = position.y - 2},
|
||||
@ -2343,7 +2541,9 @@ local function on_player_used_capsule(event)
|
||||
end
|
||||
end
|
||||
else
|
||||
if object.biter then
|
||||
if object.obj_to_create == 'fish' then
|
||||
player.insert({name = 'raw-fish', count = object.amount})
|
||||
elseif object.biter then
|
||||
local e = surface.create_entity({name = obj_name, position = position, force = force})
|
||||
tame_unit_effects(player, e)
|
||||
else
|
||||
@ -2436,7 +2636,8 @@ function Public.rpg_reset_player(player, one_time_reset)
|
||||
rotated_entity_delay = 0,
|
||||
gui_refresh_delay = 0,
|
||||
last_mined_entity_position = {x = 0, y = 0},
|
||||
show_bars = false
|
||||
show_bars = false,
|
||||
stone_path = false
|
||||
}
|
||||
rpg_t[player.index].points_to_distribute = old_points_to_distribute + total
|
||||
rpg_t[player.index].xp = old_xp
|
||||
@ -2465,7 +2666,8 @@ function Public.rpg_reset_player(player, one_time_reset)
|
||||
rotated_entity_delay = 0,
|
||||
gui_refresh_delay = 0,
|
||||
last_mined_entity_position = {x = 0, y = 0},
|
||||
show_bars = false
|
||||
show_bars = false,
|
||||
stone_path = false
|
||||
}
|
||||
end
|
||||
draw_gui_char_button(player)
|
||||
@ -2491,6 +2693,10 @@ function Public.get_magicka(player)
|
||||
end
|
||||
|
||||
function Public.gain_xp(player, amount, added_to_pool, text)
|
||||
if not validate_player(player) then
|
||||
return
|
||||
end
|
||||
|
||||
if level_limit_exceeded(player) then
|
||||
add_to_global_pool(amount, false)
|
||||
if not rpg_t[player.index].capped then
|
||||
@ -2667,6 +2873,21 @@ function Public.personal_tax_rate(value)
|
||||
end
|
||||
end
|
||||
|
||||
--- Enables/disabled stone-path-tile creation on mined.
|
||||
---@param value <boolean>
|
||||
function Public.enable_stone_path(value)
|
||||
if value then
|
||||
rpg_extra.enable_stone_path = value
|
||||
else
|
||||
rpg_extra.enable_stone_path = nil
|
||||
end
|
||||
end
|
||||
|
||||
--- Pass along the main_button and main_frame
|
||||
Public.main_frame_name = main_frame_name
|
||||
Public.draw_main_frame_name = draw_main_frame_name
|
||||
Public.settings_frame_name = settings_frame_name
|
||||
|
||||
Gui.on_click(
|
||||
draw_main_frame_name,
|
||||
function(event)
|
||||
@ -2702,8 +2923,17 @@ Gui.on_click(
|
||||
local movement_speed_gui_input = data.movement_speed_gui_input
|
||||
local flame_boots_gui_input = data.flame_boots_gui_input
|
||||
local enable_entity_gui_input = data.enable_entity_gui_input
|
||||
local stone_path_gui_input = data.stone_path_gui_input
|
||||
|
||||
if frame and frame.valid then
|
||||
if stone_path_gui_input and stone_path_gui_input.valid then
|
||||
if not stone_path_gui_input.state then
|
||||
rpg_t[player.index].stone_path = false
|
||||
elseif stone_path_gui_input.state then
|
||||
rpg_t[player.index].stone_path = true
|
||||
end
|
||||
end
|
||||
|
||||
if enable_entity_gui_input and enable_entity_gui_input.valid then
|
||||
if not enable_entity_gui_input.state then
|
||||
rpg_t[player.index].enable_entity_spawn = false
|
||||
|
@ -53,10 +53,24 @@ function Public.reset_wave_defense()
|
||||
wave_defense.alert_boss_wave = false
|
||||
end
|
||||
|
||||
function Public.get_table()
|
||||
return wave_defense
|
||||
function Public.get(key)
|
||||
if key then
|
||||
return wave_defense[key]
|
||||
else
|
||||
return wave_defense
|
||||
end
|
||||
end
|
||||
|
||||
function Public.set(key)
|
||||
if key then
|
||||
return wave_defense[key]
|
||||
else
|
||||
return wave_defense
|
||||
end
|
||||
end
|
||||
|
||||
Public.get_table = Public.get
|
||||
|
||||
function Public.clear_corpses(value)
|
||||
if value then
|
||||
wave_defense.clear_corpses = value
|
||||
|
Loading…
x
Reference in New Issue
Block a user