Route player fire through daemon intent
This commit is contained in:
parent
9c3e251080
commit
c8c2cc2c55
3 changed files with 32 additions and 3 deletions
|
|
@ -752,6 +752,8 @@ static async Task InjectCultMeshCdnAssetSnapshotsAsync(
|
|||
{
|
||||
if (bundleCdnDocuments.TryGetValue(recordKey, out var bundleDocument))
|
||||
{
|
||||
if (string.Equals(Environment.GetEnvironmentVariable("AETHERIA_TRACE_EVE_SNAPSHOTS"), "1", StringComparison.Ordinal))
|
||||
Console.WriteLine($"Eve CDN snapshot schema={bundleDocument.SchemaId} record={recordKey}");
|
||||
documents.Add(bundleDocument);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1901,7 +1903,7 @@ static CultMeshCdnArtifact PackAssetBundle(string path, string platform)
|
|||
File.ReadAllBytes(path),
|
||||
new CultMeshCdnPackOptions
|
||||
{
|
||||
ChunkSizeBytes = 56 * 1024,
|
||||
ChunkSizeBytes = 24 * 1024,
|
||||
Kind = CultMeshCdnArtifactKinds.Asset,
|
||||
Version = "1",
|
||||
MimeType = "application/vnd.unity.assetbundle",
|
||||
|
|
|
|||
|
|
@ -1008,7 +1008,12 @@ namespace GameCult.Aetheria.State.Verse
|
|||
private static bool HasWeaponGroup(AetheriaRuntimeEntitySnapshotCommit entity, int weaponGroup)
|
||||
{
|
||||
var weaponGroups = entity.WeaponGroups ?? Array.Empty<IReadOnlyList<int>>();
|
||||
return weaponGroup >= 0 && weaponGroup < weaponGroups.Count;
|
||||
if (weaponGroup >= 0 && weaponGroup < weaponGroups.Count)
|
||||
return true;
|
||||
return weaponGroup == 0 &&
|
||||
(entity.WeaponStates ?? Array.Empty<AetheriaRuntimeWeaponStateCommit>())
|
||||
.Any(state => state != null &&
|
||||
string.Equals(state.BehaviorKind, "ProjectileWeapon", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
private static bool HasEquipmentBehavior(
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
StepRaiderAi(entities);
|
||||
StepTargetPursuit(entities, settings);
|
||||
StepMovement(entities, deltaSeconds);
|
||||
StepCombat(zone, entities, deltaSeconds, settings);
|
||||
StepCombat(run, zone, entities, intents, deltaSeconds, settings);
|
||||
RefreshContacts(entities, settings);
|
||||
}
|
||||
}
|
||||
|
|
@ -141,8 +141,10 @@ namespace GameCult.Aetheria.State.Verse
|
|||
}
|
||||
|
||||
private static void StepCombat(
|
||||
AetheriaRuntimeRunCheckpointCommit run,
|
||||
AetheriaRuntimeZoneSnapshotCommit zone,
|
||||
IReadOnlyList<AetheriaRuntimeEntitySnapshotCommit> entities,
|
||||
AetheriaRuntimeDaemonIntentState intents,
|
||||
double deltaSeconds,
|
||||
AetheriaRuntimeDaemonSimulationSettings settings)
|
||||
{
|
||||
|
|
@ -173,6 +175,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
if (weaponState.CooldownProgress > 0)
|
||||
continue;
|
||||
|
||||
if (IsPlayerOwned(attacker) && !WantsFire(run, zone, attacker, intents))
|
||||
continue;
|
||||
|
||||
SpawnProjectile(zone, attacker, target, settings);
|
||||
weaponState.Firing = true;
|
||||
weaponState.CoolingDown = true;
|
||||
|
|
@ -201,6 +206,23 @@ namespace GameCult.Aetheria.State.Verse
|
|||
}
|
||||
}
|
||||
|
||||
private static bool WantsFire(
|
||||
AetheriaRuntimeRunCheckpointCommit run,
|
||||
AetheriaRuntimeZoneSnapshotCommit zone,
|
||||
AetheriaRuntimeEntitySnapshotCommit attacker,
|
||||
AetheriaRuntimeDaemonIntentState intents)
|
||||
{
|
||||
var actorKey = run.EntityRecordKey(zone.ZoneIndex, attacker.EntityIndex);
|
||||
return (intents == null
|
||||
? Enumerable.Empty<AetheriaRuntimeDaemonWeaponGroupIntent>()
|
||||
: intents.WeaponGroups)
|
||||
.Any(intent => intent != null &&
|
||||
string.Equals(intent.ActorEntityKey, actorKey, StringComparison.Ordinal) &&
|
||||
intent.WeaponGroup == 0 &&
|
||||
intent.Fire &&
|
||||
intent.Active);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeWeaponStateCommit EnsureDaemonWeaponState(
|
||||
AetheriaRuntimeEntitySnapshotCommit entity,
|
||||
AetheriaRuntimeDaemonSimulationSettings settings)
|
||||
|
|
|
|||
Loading…
Reference in a new issue