示例#1
0
        private void OnDamageBarricadeRequested(CSteamID instigatorSteamId, Transform barricadeTransform, ref ushort pendingTotalDamage, ref bool shouldAllow, EDamageOrigin damageOrigin)
        {
            if (!BarricadeManager.tryGetInfo(barricadeTransform, out _, out _, out _,
                                             out var index, out var region, out var drop))
            {
                return;
            }

            var data      = region.barricades[index];
            var buildable = new UnturnedBarricadeBuildable(data, drop);

            var nativePlayer = PlayerTool.getPlayer(instigatorSteamId);
            var player       = GetUnturnedPlayer(nativePlayer);

            var @event = pendingTotalDamage >= buildable.State.Health
                ? (UnturnedBuildableDamagingEvent) new UnturnedBarricadeDestroyingEvent(buildable, pendingTotalDamage,
                                                                                        damageOrigin, player !, instigatorSteamId)
                : new UnturnedBarricadeDamagingEvent(buildable, pendingTotalDamage, damageOrigin, player !,
                                                     instigatorSteamId);

            @event.IsCancelled = !shouldAllow;

            Emit(@event);

            pendingTotalDamage = @event.DamageAmount;
            shouldAllow        = [email protected];
        }
        private void OnDamageBarricadeRequested(CSteamID instigatorSteamId, Transform barricadeTransform,
                                                ref ushort pendingTotalDamage, ref bool shouldAllow, EDamageOrigin damageOrigin)
        {
            var drop = BarricadeManager.FindBarricadeByRootTransform(barricadeTransform);

            if (drop == null)
            {
                return;
            }

            var buildable = new UnturnedBarricadeBuildable(drop);

            var nativePlayer = PlayerTool.getPlayer(instigatorSteamId);
            var player       = GetUnturnedPlayer(nativePlayer);

            var @event = pendingTotalDamage >= buildable.State.Health
                ? (UnturnedBuildableDamagingEvent) new UnturnedBarricadeDestroyingEvent(buildable, pendingTotalDamage,
                                                                                        damageOrigin, player)
                : new UnturnedBarricadeDamagingEvent(buildable, pendingTotalDamage, damageOrigin, player);

            @event.IsCancelled = !shouldAllow;

            Emit(@event);

            pendingTotalDamage = @event.DamageAmount;
            shouldAllow        = [email protected];
        }
        private void OnDamageBarricadeRequested(CSteamID instigatorSteamId, Transform barricadeTransform, ref ushort pendingTotalDamage, ref bool shouldAllow, EDamageOrigin damageOrigin)
        {
            if (!BarricadeManager.tryGetInfo(barricadeTransform, out _, out _, out _,
                                             out var index, out var region, out var drop))
            {
                return;
            }

            var data      = region.barricades[index];
            var buildable = new UnturnedBarricadeBuildable(data, drop);

            var nativePlayer = Provider.clients.FirstOrDefault(x => x?.playerID.steamID == instigatorSteamId)?.player;
            var player       = nativePlayer == null ? null : new UnturnedPlayer(nativePlayer);

            UnturnedBuildableDamagingEvent @event;

            if (pendingTotalDamage >= buildable.State.Health)
            {
                @event = new UnturnedBarricadeDestroyingEvent(buildable, pendingTotalDamage, damageOrigin, player, instigatorSteamId);
            }
            else
            {
                @event = new UnturnedBarricadeDamagingEvent(buildable, pendingTotalDamage, damageOrigin, player, instigatorSteamId);
            }

            Emit(@event);

            pendingTotalDamage = @event.DamageAmount;
            shouldAllow        = [email protected];
        }
        private void OnModifySignRequested(CSteamID steamId, InteractableSign sign,  // lgtm [cs/too-many-ref-parameters]
                                           ref string text, ref bool shouldAllow)
        {
            var drop = BarricadeManager.FindBarricadeByRootTransform(sign.transform);

            if (drop == null)
            {
                return;
            }

            var buildable = new UnturnedBarricadeBuildable(drop);

            var nativePlayer = PlayerTool.getPlayer(steamId);
            var player       = GetUnturnedPlayer(nativePlayer);

            var @event = new UnturnedSignModifyingEvent(buildable, player, text)
            {
                IsCancelled = !shouldAllow
            };

            Emit(@event);

            text = @event.Text;

            shouldAllow = [email protected];
        }
        private void OnOpenStorageRequested(CSteamID steamId, InteractableStorage storage, ref bool shouldAllow)
        {
            var drop = BarricadeManager.FindBarricadeByRootTransform(storage.transform);

            if (drop == null)
            {
                return;
            }

            var buildable = new UnturnedBarricadeBuildable(drop);

            var nativePlayer = PlayerTool.getPlayer(steamId);
            var player       = GetUnturnedPlayer(nativePlayer);

            var @event = new UnturnedStorageOpeningEvent(buildable, player)
            {
                IsCancelled = !shouldAllow
            };

            Emit(@event);

            shouldAllow = [email protected];
        }
 public UnturnedBarricadeDamagingEvent(UnturnedBarricadeBuildable buildable, ushort damageAmount,
                                       EDamageOrigin damageOrigin, UnturnedPlayer?instigator) : base(buildable,
                                                                                                     damageAmount, damageOrigin, instigator)
 {
 }
示例#7
0
 public UnturnedBarricadeTransformedEvent(UnturnedBarricadeBuildable buildable) : base(buildable)
 {
 }
示例#8
0
 public UnturnedBarricadeTransformingEvent(UnturnedBarricadeBuildable buildable, UnturnedPlayer instigator,
                                           CSteamID instigatorId, Vector3 point, Quaternion rotation) : base(buildable, instigator, instigatorId,
                                                                                                             point, rotation)
 {
 }
 public UnturnedBarricadeDestroyedEvent(UnturnedBarricadeBuildable buildable) : base(buildable)
 {
 }
 public UnturnedBarricadeSalvagingEvent(UnturnedBarricadeBuildable buildable) : base(buildable)
 {
 }
示例#11
0
 public UnturnedBarricadeDestroyingEvent(UnturnedBarricadeBuildable buildable, ushort damageAmount,
                                         EDamageOrigin damageOrigin, UnturnedPlayer instigator, CSteamID instigatorId) : base(buildable,
                                                                                                                              damageAmount, damageOrigin, instigator, instigatorId)
 {
 }