1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2025-01-05 22:53:48 +02:00

Merge pull request #223 from Oarcinae/213-able-to-edit-other-forces-bases

Exposing friendly and cease fire in mod settings.
This commit is contained in:
Oarcinae 2024-10-25 19:58:53 -04:00 committed by GitHub
commit ec109a2c3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 53 additions and 6 deletions

View File

@ -4,6 +4,7 @@ Date: ????
Minor Features:
- Add GPS ping for when player clicks on someone's location in the player list.
- Players can now reset themselves if they want a different spawn. Available in the spawn controls tab of the custom GUI. This feature is enabled by default but can be disabled with a setting.
- New settings allow changing if player teams are friendly and/or have a cease fire. Exposed because friendly forces are problematic due to griefing. CooP is still the default setting.
Changes:
- Change default spacing between fluid resource patches (like crude-oil) to be 6 instead of 4.
- Added config setting to control the spacing between fluid resource patches. (Not exposed in the GUI.)

View File

@ -1,5 +1,8 @@
ACTIVE ITEMS:
-- Look into on_player_driving_changed_state for detecting player rocket/platform transitions.
-- Look at rocket launch events and this: `event.rocket.cargo_pod`
------------------------------------------------------------------------------------------------------------------------
BACKLOG:

View File

@ -346,6 +346,12 @@ OCFG = {
-- But it also means you can't talk privately with your own team.
enable_shared_team_chat = true,
-- Friendly teams can modify each other's buildings and view each other's map area.
enable_friendly_teams = true,
-- This means team's turrets won't shoot other team's stuff.
enable_cease_fire = true,
-- Enable if players can allow others to join their base.
-- And specify how many including the host are allowed.
enable_shared_spawns = true,
@ -584,8 +590,10 @@ OCFG = {
---@field far_spawn_distance number The furthest a player can spawn from the origin. (Not exact, but close).
---@field enable_buddy_spawn boolean Allow 2 players to spawn next to each other, each with their own starting area.
---@field enable_offline_protection boolean Inhibits enemy attacks on bases where all players are offline. Not 100% guaranteed!
---@field enable_shared_team_vision boolean Enable shared vision between teams (all teams are COOP regardless)
---@field enable_shared_team_vision boolean Enable shared vision between teams
---@field enable_shared_team_chat boolean Share local team chat with all teams
---@field enable_friendly_teams boolean Friendly teams can modify each other's buildings.
---@field enable_cease_fire boolean This means team's turrets won't shoot other team's stuff.
---@field enable_shared_spawns boolean Enable if players can allow others to join their spawn.
---@field number_of_players_per_shared_spawn number Number of players allowed to join a shared spawn.
---@field enable_friendly_fire boolean Set to true if you want to shoot your own chests and stuff.

View File

@ -44,6 +44,8 @@ OCFG_KEYS =
["gameplay_sharing_SUBHEADER"] = {mod_key = "" , ocfg_keys = {""}, type = "subheader", text = {"oarc-settings-section-subheader-sharing"}},
["gameplay.enable_shared_team_vision"] = {mod_key = "oarc-mod-enable-shared-team-vision" , ocfg_keys = {"gameplay", "enable_shared_team_vision"}, type = "boolean"},
["gameplay.enable_shared_team_chat"] = {mod_key = "oarc-mod-enable-shared-team-chat" , ocfg_keys = {"gameplay", "enable_shared_team_chat"}, type = "boolean"},
["gameplay.enable_friendly_teams"] = {mod_key = "oarc-mod-enable-friendly-teams" , ocfg_keys = {"gameplay", "enable_friendly_teams"}, type = "boolean"},
["gameplay.enable_cease_fire"] = {mod_key = "oarc-mod-enable-cease-fire" , ocfg_keys = {"gameplay", "enable_cease_fire"}, type = "boolean"},
["gameplay.enable_shared_power"] = {mod_key = "oarc-mod-enable-shared-power" , ocfg_keys = {"gameplay", "enable_shared_power"}, type = "boolean"},
["gameplay.enable_shared_chest"] = {mod_key = "oarc-mod-enable-shared-chest" , ocfg_keys = {"gameplay", "enable_shared_chest"}, type = "boolean"},
["gameplay.enable_coin_shop"] = {mod_key = "oarc-mod-enable-coin-shop" , ocfg_keys = {"gameplay", "enable_coin_shop"}, type = "boolean"},
@ -387,7 +389,7 @@ end
---@return nil
function ApplyRuntimeChanges(oarc_setting_index)
---Handle changing enable_shared_team_vision
-- Handle changing enable_shared_team_vision
if (oarc_setting_index == "gameplay.enable_shared_team_vision") then
for _,force in pairs(game.forces) do
if (not TableContains(ENEMY_FORCES_NAMES_INCL_NEUTRAL, force.name)) then
@ -395,7 +397,7 @@ function ApplyRuntimeChanges(oarc_setting_index)
end
end
---Handle changing enable_friendly_fire
-- Handle changing enable_friendly_fire
elseif (oarc_setting_index == "gameplay.enable_friendly_fire") then
for _,force in pairs(game.forces) do
if (not TableContains(ENEMY_FORCES_NAMES_INCL_NEUTRAL, force.name)) then
@ -403,5 +405,10 @@ function ApplyRuntimeChanges(oarc_setting_index)
end
end
-- Handle changing enable_friendly_teams or enable_cease_fire
elseif (oarc_setting_index == "gameplay.enable_friendly_teams") or
(oarc_setting_index == "gameplay.enable_cease_fire") then
ConfigurePlayerForceRelationships(storage.ocfg.gameplay.enable_friendly_teams,
storage.ocfg.gameplay.enable_cease_fire)
end
end

View File

@ -1468,7 +1468,8 @@ function CreatePlayerForce(force_name)
new_force.friendly_fire = storage.ocfg.gameplay.enable_friendly_fire
-- SetCeaseFireBetweenAllPlayerForces()
-- SetFriendlyBetweenAllPlayerForces()
ConfigurePlayerForceRelationships(true, true)
ConfigurePlayerForceRelationships(storage.ocfg.gameplay.enable_friendly_teams,
storage.ocfg.gameplay.enable_cease_fire)
-- ConfigureEnemyForceRelationshipsForNewPlayerForce(new_force)
else
log("TOO MANY FORCES!!! - CreatePlayerForce()")

View File

@ -22,6 +22,8 @@ oarc-mod-enable-buddy-spawn=Enable buddy spawn
oarc-mod-enable-offline-protection=Offline protection
oarc-mod-enable-shared-team-vision=Shared team vision
oarc-mod-enable-shared-team-chat=Shared team chat
oarc-mod-enable-friendly-teams=Friendly teams
oarc-mod-enable-cease-fire=Cease fire teams
oarc-mod-enable-shared-spawns=Shared spawns
oarc-mod-number-of-players-per-shared-spawn=Number of players per shared spawn
oarc-mod-enable-friendly-fire=Enable friendly fire
@ -81,8 +83,10 @@ oarc-mod-far-spawn-distance=The maximum distance a player can choose to spawn fr
oarc-mod-enable-buddy-spawn=Allow spawning with a buddy. 2 players can spawn next to each other with their own starting areas.
oarc-mod-enable-offline-protection=This inhibits enemy attacks on bases where all players are offline. Not 100% guaranteed!
oarc-mod-enable-shared-team-vision=Makes sure all teams can see each other's map and radar coverage.
oarc-mod-enable-shared-team-vision=Makes sure all teams can see each other's map and radar coverage. This requires friendly teams!
oarc-mod-enable-shared-team-chat=All teams can see each other's chat messages.
oarc-mod-enable-friendly-teams=All teams are friendly to each other. Friends have unrestricted access to buildings and turrets won't fire at them.
oarc-mod-enable-cease-fire=All teams are at cease fire. Turrets will not fire at other teams.
oarc-mod-enable-shared-spawns=Allow players to share their spawn areas for other players to join.
oarc-mod-number-of-players-per-shared-spawn=Number of players that can join a shared spawn, including the original player.
oarc-mod-enable-friendly-fire=Enables friendly fire. So you can shoot your chests (or run over your friends with a train). This lets you damage your OWN team.

View File

@ -0,0 +1,9 @@
--Need to make sure the new config settings are added.
if storage.ocfg.gameplay.enable_friendly_teams == nil then
storage.ocfg.gameplay.enable_friendly_teams = true
log("Updating gameplay config with new 'enable_friendly_teams' setting.")
end
if storage.ocfg.gameplay.enable_cease_fire == nil then
storage.ocfg.gameplay.enable_cease_fire = true
log("Updating gameplay config with new 'enable_cease_fire' setting.")
end

View File

@ -130,7 +130,21 @@ data:extend({
name = "oarc-mod-enable-shared-team-chat",
setting_type = "runtime-global",
default_value = true,
order = "d4"
order = "d31"
},
{
type = "bool-setting",
name = "oarc-mod-enable-friendly-teams",
setting_type = "runtime-global",
default_value = true,
order = "d32"
},
{
type = "bool-setting",
name = "oarc-mod-enable-cease-fire",
setting_type = "runtime-global",
default_value = true,
order = "d33"
},
{
type = "bool-setting",