Skip to content

Commit

Permalink
Merge pull request #157 from Oarcinae/dev
Browse files Browse the repository at this point in the history
2.0.2 Minor Fixes and Features (+player list, +moat fish, +more GUI config)
  • Loading branch information
Oarcinae authored Oct 8, 2024
2 parents 841ba3b + 249b250 commit 54ab7c0
Show file tree
Hide file tree
Showing 22 changed files with 1,860 additions and 171 deletions.
14 changes: 14 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
---------------------------------------------------------------------------------------------------
Version: 2.0.2
Date: 2024-10-08
Major Features:
- Added a new GUI config for all surface specific settings that can't be made available in the mod settings. This will let you easily configure all available settings via the in game custom GUI now. It is also possible to import and export settings as a serialized string. (You can still use a custom scenario to configure all settings as well using the template provided.)
- Added a player list tab to the custom GUI so you can see all players on the server, and their locations.
Bugfixes:
- Fixed a minor issue with resource placement not calculating the angle correctly when placing solid resources.
- Removed log spam related to offline enemy protection.
- Fixed an issue with regrowth that was causing log spam about chunks not being tracked properly.
Info:
- Added fish to moats.
- Doubled the default value for "minimum distance to existing chunks". There were some concerns bases might spawn too close together in some cases, this should help alleviate that.
- Changed safe_area radii config to use chunks instead of tiles. Makes more sense for the setting and is easier to visualize distance in chunks. (Older configs should get migrated automatically, but you may want to double check your settings.)
---------------------------------------------------------------------------------------------------
Version: 2.0.1
Date: 2024-09-25
Bugfixes:
Expand Down
52 changes: 29 additions & 23 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ end)
--------------------------------------------------------------------------------
-- oarc_new_spawn_created = script.generate_event_name()

-- script.on_configuration_changed(function(data)
-- -- Regenerate event ID:
-- end)
script.on_configuration_changed(function(data)
-- Regenerate event ID:

-- Reset the players GUI
for _,player in pairs(game.players) do
RecreateOarcGui(player)
end
end)

script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
if (not StringStartsWith(event.setting, "oarc-mod")) then return end
Expand All @@ -96,6 +101,7 @@ script.on_event(defines.events.on_player_changed_surface, function(event)
SeparateSpawnsPlayerChangedSurface(event)
end)


----------------------------------------
-- Shared chat, so you don't have to type /s
-- But you do lose your player colors across forces.
Expand Down Expand Up @@ -248,30 +254,24 @@ end)
-- Gui Events
----------------------------------------
script.on_event(defines.events.on_gui_click, function(event)
if not event.element.valid then return end -- Should we ever react to invalid GUI elements?
if not event.element.valid then return end

SeparateSpawnsGuiClick(event)

ClickOarcGuiButton(event)
ServerInfoGuiClick(event)
SpawnCtrlGuiClick(event)
SettingsControlsTabGuiClick(event)
SettingsSurfaceControlsTabGuiClick(event)
OarcGuiTabsClick(event)
end)

--- Called when LuaGuiElement checked state is changed (related to checkboxes and radio buttons).
script.on_event(defines.events.on_gui_checked_state_changed, function (event)
if not event.element.valid then return end -- Should we ever react to invalid GUI elements?
if not event.element.valid then return end

SeparateSpawnsGuiCheckedStateChanged(event)

SpawnCtrlGuiOptionsSelect(event)
OarcGuiTabsCheckedStateChanged(event)
end)

script.on_event(defines.events.on_gui_selected_tab_changed, function (event)
if not event.element.valid then return end -- Should we ever react to invalid GUI elements?
if not event.element.valid then return end

OarcGuiSelectedTabChanged(event)
OarcGuiTabsSelectedTabChanged(event)
end)

-- For capturing player escaping custom GUI so we can close it using ESC key.
Expand All @@ -282,30 +282,36 @@ end)

--- For sliders and other value changing elements.
script.on_event(defines.events.on_gui_value_changed, function(event)
if not event.element.valid then return end -- Should we ever react to invalid GUI elements?
if not event.element.valid then return end

SeparateSpawnsGuiValueChanged(event)
SettingsControlsTabGuiValueChanged(event)
OarcGuiTabsValueChanged(event)
end)

--- For dropdowns and listboxes.
script.on_event(defines.events.on_gui_selection_state_changed, function(event)
if not event.element.valid then return end -- Should we ever react to invalid GUI elements?
if not event.element.valid then return end

SeparateSpawnsGuiSelectionStateChanged(event)
SettingsControlsTabGuiSelectionStateChanged(event)
OarcGuiTabsSelectionStateChanged(event)
end)

script.on_event(defines.events.on_gui_text_changed, function(event)
if not event.element.valid then return end -- Should we ever react to invalid GUI elements?
if not event.element.valid then return end

SettingsControlsTabGuiTextChanged(event)
OarcGuiTabsTextChanged(event)
end)

script.on_event(defines.events.on_gui_confirmed, function(event)
if not event.element.valid then return end -- Should we ever react to invalid GUI elements?
if not event.element.valid then return end

OarcGuiTabsConfirmed(event)
end)

script.on_event(defines.events.on_gui_elem_changed, function(event)
if not event.element.valid then return end

SettingsControlsTabGuiTextconfirmed(event)
OarcGuiTabsElemChanged(event)
end)

----------------------------------------
Expand Down
40 changes: 40 additions & 0 deletions devplan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,46 @@ Major:
- Radar quality affects regrowth safe range?
- Update electric pole connections for shared power if things change in V2.0

- Source: https://forums.factorio.com/115737
- Specifics that I might need to investigate:
Added LuaPlayer::land_on_planet() method.
Added LuaPlayer::enter_space_platform() and leave_space_platform() method.
Added cargo-landing-pad prototype.
Added space-platform-starter-pack, space-location, planet and space-connection prototypes.
Added surface-property and surface prototypes.
Added new controller type (remote), which is to build space platforms, so it allows ghost building but not any physical manipulation.
Added LuaPlayer::physical_surface, physical_surface_index, physical_vehicle and physical_position read.
Electric pole created through LuaSurface::create_entity can be requested to not auto connect.
Added LuaSurface::global_effect read/write.
Added LuaSurface::localised_name read/write.
LuaGameScript::print, LuaPlayer::print, LuaSurface::print and LuaForce::print no longer accept Color as a second parameter.
Added LuaSurface::set_property() and get_property() methods.
Added LuaSurface::execute_lightning() method.
Added LuaSurface::create_global_electric_network() and destroy_global_electric_network() methods.
Added LuaSurface::has_global_electric_network read.
Added LuaSurface::platform read.
Added LuaSurface::pollutant_type read.
Added airborne-pollutant prototype and changed various pollution related properties to support multiple pollution types.
Added LuaSurface::deletable read.
Added LuaForce::set_surface_hidden() and get_surface_hidden() methods.
Added cause argument to LuaSurface::create_entity.
Added LuaSurfacePrototype::surface_properties read.
Added on_player_controller_changed event.
Removed LuaPlayer::open_map, zoom_to_world, and close_map. LuaPlayer::set_controller with type 'remote' replaces these.
oved LuaGameScript::styles to LuaPrototypes::style.
Removed LuaGameScript::active_mods. Use LuaBootstrap::active_mods instead.
Renamed `global` into `storage`.
Added LuaGameScript::technology_notifications_enabled (read/write).
Added LuaGameScript::planets read.
Added LuaGameScript::get_vehicles.
Added LuaForce::platforms read.
Added LuaGameScript::set_win_ending_info() and set_lose_ending_info() methods.
Added LuaForce::unlock_space_location(), lock_space_location() and is_space_location_unlocked() methods.
Added LuaForce::create_space_platform() method.
Added LuaForce::unlock_space_platforms(), lock_space_platforms() and is_space_platforms_unlocked() methods.
Changed LuaForce::evolution_factor, evolution_factor_by_pollution, evolution_factor_by_time and evolution_factor_by_killing_spawners to get_* and set_* methods.
Added LuaForce::copy_from() and copy_chart() methods.

------------------------------------------------------------------------------------------------------------------------

Other Ideas, Not Committed:
Expand Down
5 changes: 3 additions & 2 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oarc-mod",
"version": "2.0.1",
"version": "2.0.2",
"factorio_version": "1.1",
"title": "Oarc Multiplayer Spawn",
"author": "Oarcinae",
Expand All @@ -14,6 +14,7 @@
"(?) space-exploration",
"(?) alien-biomes",
"(?) sonaxaton-research-queue",
"(?) helmod"
"(?) helmod",
"(?) rso-mod"
]
}
71 changes: 43 additions & 28 deletions lib/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ SPAWN_SHAPE_CHOICE_SQUARE = "square"
RESOURCES_SHAPE_CHOICE_CIRCLE = "circle"
RESOURCES_SHAPE_CHOICE_SQUARE = "square"

MAX_CRASHED_SHIP_RESOURCES_ITEMS = 5
MAX_CRASHED_SHIP_WRECKAGE_ITEMS = 1

-- THIS is used as the default starting items on all surfaces if no other settings are provided!
---@type OarcConfigStartingItems
NAUVIS_STARTER_ITEMS =
{
Expand Down Expand Up @@ -54,6 +58,7 @@ NAUVIS_STARTER_ITEMS =
},
}

-- THIS is used as the default spawn config on all surfaces if no other settings are provided!
---@type OarcConfigSpawn
NAUVIS_SPAWN_CONFIG =
{
Expand All @@ -62,19 +67,19 @@ NAUVIS_SPAWN_CONFIG =
safe_area =
{
-- Safe area has no aliens
-- This is the radius in tiles of safe area.
safe_radius = CHUNK_SIZE*6,
-- This is the radius in chunks of safe area.
safe_radius = 6,

-- Warning area has significantly reduced aliens
-- This is the radius in tiles of warning area.
warn_radius = CHUNK_SIZE*12,
-- This is the radius in chunks of warning area.
warn_radius = 12,

-- 1 : X (spawners alive : spawners destroyed) in this area
warn_reduction = 20,

-- Danger area has slightly reduced aliens
-- This is the radius in tiles of danger area.
danger_radius = CHUNK_SIZE*32,
-- This is the radius in chunks of danger area.
danger_radius = 32,

-- 1 : X (spawners alive : spawners destroyed) in this area
danger_reduction = 5,
Expand Down Expand Up @@ -109,24 +114,32 @@ NAUVIS_SPAWN_CONFIG =
["iron-ore"] = {
amount = 1500,
size = 21,

-- These are only used if not using automatic placing.
x_offset = -29,
y_offset = 16
},
["copper-ore"] = {
amount = 1200,
size = 21,

-- These are only used if not using automatic placing.
x_offset = -28,
y_offset = -3
},
["stone"] = {
amount = 1200,
size = 21,

-- These are only used if not using automatic placing.
x_offset = -27,
y_offset = -34
},
["coal"] = {
amount = 1200,
size = 21,

-- These are only used if not using automatic placing.
x_offset = -27,
y_offset = -20
}
Expand All @@ -141,6 +154,8 @@ NAUVIS_SPAWN_CONFIG =
{
num_patches = 2,
amount = 900000,

-- These are only used if not using automatic placing.
-- Starting position offset (relative to bottom/south of spawn area)
x_offset_start = -3,
y_offset_start = -10,
Expand Down Expand Up @@ -202,7 +217,7 @@ OCFG = {
-- chunks. It ensures the spawn area isn't too near generated/explored/existing
-- area. The larger you make this, the further away players will spawn from
-- generated map area (even if it is not visible on the map!).
minimum_distance_to_existing_chunks = 10,
minimum_distance_to_existing_chunks = 20,

-- The range in which a player can select how close to the center of the map they want to spawn.
near_spawn_distance = 100,
Expand Down Expand Up @@ -330,11 +345,11 @@ OCFG = {
-- At what angle (in radians) do resources start.
-- 0 means starts directly east.
-- Resources are placed clockwise from there.
angle_offset = 2.32, -- 2.32 is approx SSW.
angle_offset = 2.09, -- Approx SSW.

-- At what andle do we place the last resource.
-- angle_offset and angle_final determine spacing and placement.
angle_final = 4.46, -- 4.46 is approx NNW.
angle_final = 4.18, -- Approx NNW.

-- Vertical offset in tiles for the deposit resource placement. Starting from top-left corner.
-- Only applicable for square spawns.
Expand Down Expand Up @@ -364,22 +379,22 @@ OCFG = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
["vulcanus"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
["fulgora"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
["gleba"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
},
["aquilo"] = {
starting_items = NAUVIS_STARTER_ITEMS,
spawn_config = NAUVIS_SPAWN_CONFIG
}
-- ["vulcanus"] = {
-- starting_items = NAUVIS_STARTER_ITEMS,
-- spawn_config = NAUVIS_SPAWN_CONFIG
-- },
-- ["fulgora"] = {
-- starting_items = NAUVIS_STARTER_ITEMS,
-- spawn_config = NAUVIS_SPAWN_CONFIG
-- },
-- ["gleba"] = {
-- starting_items = NAUVIS_STARTER_ITEMS,
-- spawn_config = NAUVIS_SPAWN_CONFIG
-- },
-- ["aquilo"] = {
-- starting_items = NAUVIS_STARTER_ITEMS,
-- spawn_config = NAUVIS_SPAWN_CONFIG
-- }
},

-- Surfaces blacklist (Ignore these surfaces completely for spawning and regrowth!)
Expand Down Expand Up @@ -490,10 +505,10 @@ OCFG = {
---@field shape SpawnShapeChoice Spawn a circle/octagon/square of trees around this base outline.

---@class OarcConfigSpawnSafeArea
---@field safe_radius number Safe area has no aliens This is the radius in tiles of safe area.
---@field warn_radius number Warning area has significantly reduced aliens This is the radius in tiles of warning area.
---@field safe_radius number Safe area has no aliens This is the radius in chunks of safe area.
---@field warn_radius number Warning area has significantly reduced aliens This is the radius in chunks of warning area.
---@field warn_reduction number 1 : X (spawners alive : spawners destroyed) in this area
---@field danger_radius number Danger area has slightly reduce aliens This is the radius in tiles of danger area.
---@field danger_radius number Danger area has slightly reduce aliens This is the radius in chunks of danger area.
---@field danger_reduction number 1 : X (spawners alive : spawners destroyed) in this area

---@class OarcConfigSpawnWater
Expand Down
Loading

0 comments on commit 54ab7c0

Please sign in to comment.