Skip to content

Commit 8e67c4b

Browse files
committed
Server Tweak which ability results update last seen pos
1 parent efdf0f7 commit 8e67c4b

File tree

1 file changed

+63
-18
lines changed

1 file changed

+63
-18
lines changed

Assembly-CSharp/ServerActionBuffer.cs

Lines changed: 63 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SERVER
33
using System;
44
using System.Collections.Generic;
5+
using System.Linq;
56
//using Mirror;
67
using UnityEngine;
78
using UnityEngine.Networking;
@@ -227,15 +228,35 @@ public void SynchronizePositionsOfActorsParticipatingInPhase(AbilityPriority pha
227228
{
228229
if (abilityRequest.m_ability.RunPriority == phase)
229230
{
230-
if (abilityRequest.m_caster != null)
231+
if (abilityRequest.m_caster != null
232+
// custom
233+
&& abilityRequest.m_ability != null
234+
&& abilityRequest.m_ability.ShouldRevealCasterOnHostileAbilityHit()
235+
&& abilityRequest.m_additionalData.m_abilityResults.HitActorsArray().Any(ad => ad.GetTeam() != abilityRequest.m_caster.GetTeam())
236+
// end custom
237+
)
231238
{
232239
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {abilityRequest.m_caster.DisplayName} for using ability {abilityRequest.m_ability.m_abilityName}"); // custom
233240
abilityRequest.m_caster.SynchronizeTeamSensitiveData();
234241
}
242+
else
243+
{
244+
Log.Info($"Not requesting SynchronizeTeamSensitiveData {phase} for {abilityRequest.m_caster?.DisplayName} for using ability {abilityRequest.m_ability?.m_abilityName}"); // custom
245+
}
235246
foreach (ActorData hitActor in abilityRequest.m_additionalData.m_abilityResults.HitActorsArray())
236247
{
237-
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {abilityRequest.m_caster?.DisplayName}'s ability {abilityRequest.m_ability.m_abilityName}"); // custom
238-
hitActor.SynchronizeTeamSensitiveData();
248+
if (abilityRequest.m_caster != null
249+
&& abilityRequest.m_caster.GetTeam() != hitActor.GetTeam()
250+
&& abilityRequest.m_ability != null
251+
&& abilityRequest.m_ability.ShouldRevealTargetOnHostileAbilityHit()) // custom condition
252+
{
253+
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {abilityRequest.m_caster.DisplayName}'s ability {abilityRequest.m_ability.m_abilityName}"); // custom
254+
hitActor.SynchronizeTeamSensitiveData();
255+
}
256+
else
257+
{
258+
Log.Info($"Not requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {abilityRequest.m_caster?.DisplayName}'s ability {abilityRequest.m_ability?.m_abilityName}"); // custom
259+
}
239260
}
240261
}
241262
}
@@ -245,20 +266,35 @@ public void SynchronizePositionsOfActorsParticipatingInPhase(AbilityPriority pha
245266
{
246267
if (effect.HasResolutionAction(phase))
247268
{
248-
if (effect.Caster != null)
249-
{
250-
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {effect.Caster.DisplayName} for using effect {effect.m_effectName}"); // custom
251-
effect.Caster.SynchronizeTeamSensitiveData();
252-
}
253-
if (effect.Target != null)
269+
// if (effect.Caster != null)
270+
// {
271+
// Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {effect.Caster.DisplayName} for using effect {effect.m_effectName}"); // custom
272+
// effect.Caster.SynchronizeTeamSensitiveData();
273+
// }
274+
if (effect.Target != null
275+
// custom
276+
// but what if black hole in fog of war hits nobody? will the animation play in the wrong place?
277+
&& effect.Caster != null
278+
&& (effect.Parent.Ability == null || effect.Parent.Ability.ShouldRevealEffectHolderOnHostileEffectHit())
279+
&& effect.GetResultsForPhase(phase, true).HitActorsArray().Any(ad => ad.GetTeam() != effect.Caster.GetTeam()))
280+
//end custom
254281
{
255282
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {effect.Target.DisplayName} for being the target of {effect.Caster?.DisplayName}'s effect {effect.m_effectName}"); // custom
256283
effect.Target.SynchronizeTeamSensitiveData();
257284
}
258285
foreach (ActorData hitActor in effect.GetResultsForPhase(phase, true).HitActorsArray())
259286
{
260-
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {effect.Caster?.DisplayName}'s effect {effect.m_effectName}"); // custom
261-
hitActor.SynchronizeTeamSensitiveData();
287+
if (effect.Caster != null
288+
&& effect.Caster.GetTeam() != hitActor.GetTeam()
289+
&& (effect.Parent.Ability == null || effect.Parent.Ability.ShouldRevealTargetOnHostileEffectOrBarrierHit())) // custom condition
290+
{
291+
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {effect.Caster?.DisplayName}'s effect {effect.m_effectName}"); // custom
292+
hitActor.SynchronizeTeamSensitiveData();
293+
}
294+
else
295+
{
296+
Log.Info($"Not requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {effect.Caster?.DisplayName}'s effect {effect.m_effectName}"); // custom
297+
}
262298
}
263299
}
264300
}
@@ -267,15 +303,24 @@ public void SynchronizePositionsOfActorsParticipatingInPhase(AbilityPriority pha
267303
{
268304
if (effect.HasResolutionAction(phase))
269305
{
270-
if (effect.Caster != null)
271-
{
272-
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {effect.Caster.DisplayName} for using world effect {effect.m_effectName}"); // custom
273-
effect.Caster.SynchronizeTeamSensitiveData();
274-
}
306+
// if (effect.Caster != null)
307+
// {
308+
// Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {effect.Caster.DisplayName} for using world effect {effect.m_effectName}"); // custom
309+
// effect.Caster.SynchronizeTeamSensitiveData();
310+
// }
275311
foreach (var hitActor in effect.GetResultsForPhase(phase, true).HitActorsArray())
276312
{
277-
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {effect.Caster?.DisplayName}'s world effect {effect.m_effectName}"); // custom
278-
hitActor.SynchronizeTeamSensitiveData();
313+
if (effect.Caster != null
314+
&& effect.Caster.GetTeam() != hitActor.GetTeam()
315+
&& (effect.Parent.Ability == null || effect.Parent.Ability.ShouldRevealTargetOnHostileEffectOrBarrierHit())) // custom condition
316+
{
317+
Log.Info($"Requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {effect.Caster.DisplayName}'s world effect {effect.m_effectName}"); // custom
318+
hitActor.SynchronizeTeamSensitiveData();
319+
}
320+
else
321+
{
322+
Log.Info($"Not requesting SynchronizeTeamSensitiveData {phase} for {hitActor.DisplayName} for being hit by {effect.Caster?.DisplayName}'s world effect {effect.m_effectName}"); // custom
323+
}
279324
}
280325
}
281326
}

0 commit comments

Comments
 (0)