Skip to content

Commit

Permalink
v0.9.2.0a
Browse files Browse the repository at this point in the history
  • Loading branch information
zerratar committed Aug 13, 2024
1 parent 2d36c4e commit 36fe4f6
Show file tree
Hide file tree
Showing 23 changed files with 198 additions and 122 deletions.
13 changes: 10 additions & 3 deletions Assets/Scripts/Camera/GameCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void Update()

// check if we are currently observing a player
// if so, then don't allow the camera to switch to the next island
if (observeCamera.HasTarget)
if (observeCamera.HasTarget && playerObserver.IsObservingPlayer)
{
return;
}
Expand Down Expand Up @@ -394,7 +394,7 @@ public void ObserveIsland(IslandController island)
if (!island) return;
if (forcedFreeCamera) return;
playerObserver.Observe(null, 0);
observeNextIslandTimer = ObserverJumpTimer;
observeNextIslandTimer = PlayerSettings.Instance.IslandObserveSeconds;
islandObserver.Observe(island, observeNextIslandTimer);
islandObserveCamera.ObserveIsland(island);
islandObserveCamera.enabled = true;
Expand Down Expand Up @@ -479,12 +479,19 @@ private bool CanObserveIsland(int totalPlayerCount, IslandController island)
{
if (island.AllowRaidWar) return false;

if (PlayerSettings.Instance.CanObserveEmptyIslands.GetValueOrDefault())
{
return true;
}

// if we dont have any players, then all islands can be observed
if (totalPlayerCount == 0)
return true;

// when we have players, we should only observe the island with players on.
return island.GetPlayerCount() > 0;
var plrCount = island.GetPlayerCount();

return plrCount > 0;
}
}

Expand Down
17 changes: 12 additions & 5 deletions Assets/Scripts/Game/Drops/PlayerItemDropText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ void Append(string msg)
return;
}

var appendStrings = new List<string>();

// we will rely on word wrapping so we don't split player names and
// they can get properly pinged in the chat.
foreach (var kvp in items)
Expand All @@ -62,19 +64,20 @@ void Append(string msg)

if (settings == PlayerItemDropMessageSettings.ItemNameOnly)
{
Append(itemName);
Next();
appendStrings.Add(itemName);
//Append(itemName + ", ");
//Next();
continue;
}

if (settings == PlayerItemDropMessageSettings.ItemNameAndCountOnly)
{
if (playersRef.Count > 1)
Append(playersRef.Count + "x " + itemName);
appendStrings.Add(playersRef.Count + "x " + itemName);
else
Append(itemName);
appendStrings.Add(itemName);

Next();
//Next();
continue;
}

Expand Down Expand Up @@ -117,6 +120,10 @@ void Append(string msg)
}
}

if (appendStrings.Count > 0)
{
Append(string.Join(", ", appendStrings) + ".");
}

var remaining = sb.ToString();
if (!string.IsNullOrEmpty(remaining))
Expand Down
8 changes: 6 additions & 2 deletions Assets/Scripts/Game/Managers/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,13 @@ void Start()
if (musicManager)
musicManager.PlayBackgroundMusic();

gameCacheStateFileLoadResult = GameCache.LoadState();

GameSystems.Start();

gameCacheStateFileLoadResult = GameCache.LoadState();
if (gameCacheStateFileLoadResult == GameCache.LoadStateResult.PlayersRestored)
{
GameCache.IsAwaitingGameRestore = true;
}
}

public PlayerItemDropText AddItems(EventItemReward[] rewards, int dungeonIndex = -1, int raidIndex = -1)
Expand Down
16 changes: 1 addition & 15 deletions Assets/Scripts/Game/Skills/Crafting/CraftingStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ public class CraftingStation : MonoBehaviour

public IslandController Island { get; private set; }

[HideInInspector] public bool IsInvalid;

public CraftingStationType StationType = CraftingStationType.Crafting;

public float ExpMultiplier = 1f;
Expand All @@ -25,19 +23,7 @@ public void AdjustPlacement()
{
PlacementUtility.PlaceOnGround(this.gameObject);
}
private float invalidTimer;
private void Update()
{
if (IsInvalid)
{
invalidTimer += GameTime.deltaTime;
if (invalidTimer >= 20)
{
invalidTimer = 0f;
IsInvalid = false;
}
}
}

void Start()
{
this.Island = GetComponentInParent<IslandController>();
Expand Down
15 changes: 1 addition & 14 deletions Assets/Scripts/Game/Skills/Fishing/FishingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class FishingController : MonoBehaviour
public Transform LookTransform => !!rotationTarget ? rotationTarget : transform;

public IslandController Island { get; private set; }
[HideInInspector] public bool IsInvalid;

[ReadOnly]
public float MaxActionDistance = 5;
Expand All @@ -21,19 +20,7 @@ public void AdjustPlacement()
{
PlacementUtility.PlaceOnGround(this.gameObject);
}
private float invalidTimer;
private void Update()
{
if (IsInvalid)
{
invalidTimer += GameTime.deltaTime;
if (invalidTimer >= 20)
{
invalidTimer = 0f;
IsInvalid = false;
}
}
}

void Start()
{
this.Island = GetComponentInParent<IslandController>();
Expand Down
16 changes: 2 additions & 14 deletions Assets/Scripts/Game/Skills/Mining/RockController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class RockController : MonoBehaviour
{
public IslandController Island { get; private set; }
[HideInInspector] public bool IsInvalid;


[ReadOnly]
public float MaxActionDistance = 5;
Expand All @@ -15,19 +15,7 @@ public void AdjustPlacement()
{
PlacementUtility.PlaceOnGround(this.gameObject);
}
private float invalidTimer;
private void Update()
{
if (IsInvalid)
{
invalidTimer += GameTime.deltaTime;
if (invalidTimer >= 20)
{
invalidTimer = 0f;
IsInvalid = false;
}
}
}

void Start()
{
this.Island = GetComponentInParent<IslandController>();
Expand Down
2 changes: 0 additions & 2 deletions Assets/Scripts/Game/Skills/Woodcutting/FarmController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ public class FarmController : MonoBehaviour
//public double Experience => GameMath.GetFishingExperience(Level);
public int Resource => 1;

[HideInInspector] public bool IsInvalid;

public float MaxActionDistance = 5;

public IslandController Island;
Expand Down
14 changes: 2 additions & 12 deletions Assets/Scripts/Game/Skills/Woodcutting/GatherController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ private readonly ConcurrentDictionary<Guid, PlayerController> gatherers

public IReadOnlyList<PlayerController> Gatherers => gatherers.Values.ToList();

[HideInInspector] public bool IsInvalid;

void Start()
{
maxRespawnTimeSeconds = respawnTimeSeconds;
Expand All @@ -46,19 +44,11 @@ void Start()
MaxActionDistance = collider.radius;
}
}
private float invalidTimer;

public override void Poll()
{
if (IsInvalid)
{
invalidTimer += GameTime.deltaTime;
if (invalidTimer >= 20)
{
invalidTimer = 0f;
IsInvalid = false;
}
}
}

public void AddGatherer(PlayerController player)
{
gatherers[player.Id] = player;
Expand Down
11 changes: 0 additions & 11 deletions Assets/Scripts/Game/Skills/Woodcutting/TreeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ private readonly ConcurrentDictionary<string, PlayerController> woodCutters
public bool IsStump => health <= 0;

public IslandController Island { get; private set; }
[HideInInspector] public bool IsInvalid;

[ReadOnly]
public float MaxActionDistance = 5f;

private float maxRespawnTimeSeconds;
private float minRespawnTimeSeconds;
private float invalidTimer;

[Button("Adjust Placement")]
public void AdjustPlacement()
Expand Down Expand Up @@ -66,15 +64,6 @@ void Awake()

public override void Poll()
{
if (IsInvalid)
{
invalidTimer += GameTime.deltaTime;
if (invalidTimer >= 20)
{
invalidTimer = 0f;
IsInvalid = false;
}
}
}

public void DecreaseRespawnTime()
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/GameCache.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace Assets.Scripts
{
Expand Down Expand Up @@ -147,6 +148,7 @@ private static RestorableGameState GetLatestCache()
usedPlayerStateCacheFileName = file;
}
}
stateCache = state;
return state;
}

Expand Down
22 changes: 22 additions & 0 deletions Assets/Scripts/GameObjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,26 @@ public static T EnsureComponent<T>(this GameObject go, Action<T> onAddOrGet = nu
return c;
}


public static string GetHierarchyPath(this MonoBehaviour obj)
{
return obj.transform.GetHierarchyPath();
}

public static string GetHierarchyPath(this GameObject obj)
{
return obj.transform.GetHierarchyPath();
}

public static string GetHierarchyPath(this Transform transform)
{
string path = transform.name;
while (transform.parent != null)
{
transform = transform.parent;
path = transform.name + "/" + path;
}
return path;
}

}
6 changes: 6 additions & 0 deletions Assets/Scripts/QueryEngineAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,14 @@ private static QueryEngineContext RebuildDataContext(GameManager gm)
QueryEngineContext.Column<PlayerSettings, bool>("Game.AutoKickAfkPlayers", x => x.AutoKickAfkPlayers.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, bool>("Game.LocalBotServerDisabled", x => x.LocalBotServerDisabled.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, bool>("Game.AlertExpiredStateCacheInChat", x => x.AlertExpiredStateCacheInChat.GetValueOrDefault()),

QueryEngineContext.Column<PlayerSettings, bool>("Game.CanObserveEmptyIslands", x => x.CanObserveEmptyIslands.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, int>("Game.PlayerBoostRequirement", x => x.PlayerBoostRequirement.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, int>("Game.ItemDropMessageType", x => x.ItemDropMessageType.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, int>("Game.PathfindingQualitySettings", x => x.PathfindingQualitySettings.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, int>("Game.LocalBotPort", x => x.LocalBotPort.GetValueOrDefault()),

QueryEngineContext.Column<PlayerSettings, float>("Game.IslandObserveSeconds", x => x.IslandObserveSeconds),

QueryEngineContext.Column<PlayerSettings, float>("Sound.MusicVolume", x => x.MusicVolume.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, float>("Sound.RaidHornVolume", x => x.RaidHornVolume.GetValueOrDefault()),
Expand All @@ -200,6 +205,7 @@ private static QueryEngineContext RebuildDataContext(GameManager gm)
QueryEngineContext.Column<PlayerSettings, float>("UI.PlayerListSize", x => x.PlayerListSize.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, float>("UI.PlayerListScale", x => x.PlayerListScale.GetValueOrDefault()),

QueryEngineContext.Column<PlayerSettings, int>("Graphics.QualityLevel", x => x.QualityLevel.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, float>("Graphics.DPIScale", x => x.DPIScale.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, bool>("Graphics.PotatoMode", x => x.PotatoMode.GetValueOrDefault()),
QueryEngineContext.Column<PlayerSettings, bool>("Graphics.AutoPotatoMode", x => x.AutoPotatoMode.GetValueOrDefault()),
Expand Down
Loading

0 comments on commit 36fe4f6

Please sign in to comment.