Skip to content

Commit

Permalink
Better death tracking, including for vehicles. Cleaned up some old fi…
Browse files Browse the repository at this point in the history
…les.
  • Loading branch information
DanielWillett committed Jan 17, 2025
1 parent c806dc6 commit 4c41fc7
Show file tree
Hide file tree
Showing 42 changed files with 815 additions and 1,106 deletions.
6 changes: 3 additions & 3 deletions UncreatedWarfare/Commands/Structure/StructureCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Players;
using Uncreated.Warfare.Teams;
using Uncreated.Warfare.Translations;
Expand Down Expand Up @@ -47,10 +47,10 @@ public sealed class StructureTranslations : PropertiesTranslationCollection
public readonly Translation<Asset, IPlayer, IPlayer, FactionInfo> StructureExamineLastOwnerChat = new Translation<Asset, IPlayer, IPlayer, FactionInfo>("<#c6d4b8>Last owner of <#e6e3d5>{0}</color>: {1} <i>({2})</i>, Team: {3}.", TranslationOptions.TMProUI | TranslationOptions.NoRichText, arg0Fmt: RarityColorAddon.Instance, arg1Fmt: WarfarePlayer.FormatColoredPlayerName, arg2Fmt: WarfarePlayer.FormatSteam64, arg3Fmt: FactionInfo.FormatColorDisplayName);

[TranslationData]
public readonly Translation<Asset, IPlayer, FactionInfo, string, ulong> VehicleExamineLastOwnerPrompt = new Translation<Asset, IPlayer, FactionInfo, string, ulong>("Owner of {0}: {1}, Team: {2}. Previous Owner: {3} ({4}).", TranslationOptions.TMProUI | TranslationOptions.NoRichText, arg1Fmt: WarfarePlayer.FormatPlayerName, arg2Fmt: FactionInfo.FormatDisplayName);
public readonly Translation<Asset, IPlayer, FactionInfo> VehicleExamineLastOwnerPrompt = new Translation<Asset, IPlayer, FactionInfo>("Owner of {0}: {1}, Team: {2}.", TranslationOptions.TMProUI | TranslationOptions.NoRichText, arg1Fmt: WarfarePlayer.FormatPlayerName, arg2Fmt: FactionInfo.FormatDisplayName);

[TranslationData]
public readonly Translation<Asset, IPlayer, IPlayer, FactionInfo, string, ulong> VehicleExamineLastOwnerChat = new Translation<Asset, IPlayer, IPlayer, FactionInfo, string, ulong>("<#c6d4b8>Owner of <#e6e3d5>{0}</color>: {1} <i>({2})</i>, Team: {3}. Previous Owner: {4} <i>({5})</i>.", TranslationOptions.TMProUI | TranslationOptions.NoRichText, arg0Fmt: RarityColorAddon.Instance, arg1Fmt: WarfarePlayer.FormatColoredPlayerName, arg2Fmt: WarfarePlayer.FormatSteam64, arg3Fmt: FactionInfo.FormatColorDisplayName);
public readonly Translation<Asset, IPlayer, IPlayer, FactionInfo> VehicleExamineLastOwnerChat = new Translation<Asset, IPlayer, IPlayer, FactionInfo>("<#c6d4b8>Owner of <#e6e3d5>{0}</color>: {1} <i>({2})</i>, Team: {3}.", TranslationOptions.TMProUI | TranslationOptions.NoRichText, arg0Fmt: RarityColorAddon.Instance, arg1Fmt: WarfarePlayer.FormatColoredPlayerName, arg2Fmt: WarfarePlayer.FormatSteam64, arg3Fmt: FactionInfo.FormatColorDisplayName);

[TranslationData(IsPriorityTranslation = false)]
public readonly Translation<string> StructureSaveInvalidProperty = new Translation<string>("<#ff8c69>{0} isn't a valid a structure property. Try putting 'owner' or 'group'.");
Expand Down
14 changes: 3 additions & 11 deletions UncreatedWarfare/Commands/Structure/StructureExamineCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Uncreated.Warfare.Components;
using Uncreated.Warfare.Components;
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Layouts.Teams;
using Uncreated.Warfare.Players;
Expand Down Expand Up @@ -56,27 +56,19 @@ private async Task ExamineVehicle(InteractableVehicle vehicle, WarfarePlayer pla
else
{
Team team = _teamManager.GetTeam(vehicle.lockedGroup);
ulong prevOwner = vehicle.transform.TryGetComponent(out VehicleComponent vcomp) ? vcomp.PreviousOwner : 0ul;
IPlayer names = await _userDataService.GetUsernamesAsync(vehicle.lockedOwner.m_SteamID, token).ConfigureAwait(false);
string prevOwnerName;
if (prevOwner != 0ul)
{
PlayerNames pl = await _userDataService.GetUsernamesAsync(prevOwner, token).ConfigureAwait(false);
prevOwnerName = pl.GetDisplayNameOrPlayerName();
}
else prevOwnerName = "None";
await UniTask.SwitchToMainThread(token);
if (sendurl)
{
Context.ReplySteamProfileUrl(_translations.VehicleExamineLastOwnerPrompt
.Translate(vehicle.asset, names, team.Faction, prevOwnerName, prevOwner, player, canUseIMGUI: true), vehicle.lockedOwner);
.Translate(vehicle.asset, names, team.Faction, player, canUseIMGUI: true), vehicle.lockedOwner);
}
else
{
OfflinePlayer pl = new OfflinePlayer(vehicle.lockedOwner);
await pl.CacheUsernames(_userDataService, token).ConfigureAwait(false);
await UniTask.SwitchToMainThread(token);
Context.Reply(_translations.VehicleExamineLastOwnerChat, vehicle.asset, names, pl, team.Faction, prevOwnerName, prevOwner);
Context.Reply(_translations.VehicleExamineLastOwnerChat, vehicle.asset, names, pl, team.Faction);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion UncreatedWarfare/Commands/TeamsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Layouts.Teams;
using Uncreated.Warfare.Lobby;
using Uncreated.Warfare.Players;
using Uncreated.Warfare.Players.Permissions;
using Uncreated.Warfare.Translations;
using Uncreated.Warfare.Zones;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Interaction.Commands;
using Uncreated.Warfare.Players;
using Uncreated.Warfare.Players.Management;

Expand Down
Loading

0 comments on commit 4c41fc7

Please sign in to comment.