コード例 #1
0
ファイル: Enemy.cs プロジェクト: jesterswilde/CP_Game
    IAtomicAction GetAAFromAction(Action _action)
    {
        switch (_action.Type)
        {
        case ActionType.AIMoveForward:
            return(_aaMoveForward);

        case ActionType.AIRotate:
            return(_aaRotate);

        case ActionType.AIWait:
            return(_aaWait);

        case ActionType.AIMoveTo:
            return(_aaMoveTo);

        case ActionType.AIMoveForwardUnset:
        case ActionType.AIRotateUnset:
        case ActionType.AIMoveToUnset:
        case ActionType.AIWaitUnset:
            _currentAA = null;
            break;

        case ActionType.Alert:
            Debug.Log(gameObject.name + " saw da cybapunk at approximately " + GameManager.GameTime);
            break;
        }
        return(null);
    }
コード例 #2
0
ファイル: Enemy.cs プロジェクト: jesterswilde/CP_Game
    IAtomicAction RewindAAFromAction(Action _action)
    {
        switch (_action.Type)
        {
        case ActionType.AIMoveForwardUnset:
            return(_aaMoveForward);

        case ActionType.AIRotateUnset:
            return(_aaRotate);

        case ActionType.AIWaitUnset:
            return(_aaWait);

        case ActionType.AIMoveToUnset:
            return(_aaMoveTo);

        case ActionType.AIMoveForward:
        case ActionType.AIRotate:
        case ActionType.AIMoveTo:
        case ActionType.AIWait:
            _currentAA = null;
            break;
        }
        return(null);
    }
        public override void BlockInteraction(Vector3i pos, Quaternion rot, VehicleComponent vehicle, Inventory inv = null)
        {
            if (inv == null)
            {
                return;
            }
            foreach (var offset in area)
            {
                SeedItem seed       = inv.GroupedStacks.Where(x => x.Item is SeedItem).First().Item as SeedItem;
                var      targetPos  = (rot.RotateVector(offset) + pos).XYZi;
                Result   authResult = AuthManager.IsAuthorized(targetPos, vehicle.Driver.User);
                if (authResult.Success)
                {
                    if (World.GetBlock(targetPos + Vector3i.Down).Is <Tilled>() && World.GetBlock(targetPos).Is <Empty>())
                    {
                        var changes = new InventoryChangeSet(inv, vehicle.Driver.User);
                        changes.RemoveItem(seed.Type);
                        IAtomicAction plantAction = PlayerActions.Plant.CreateAtomicAction(vehicle.Driver, targetPos, seed.Species);

                        if (new MultiAtomicAction(changes, plantAction).TryApply())
                        {
                            var plant = EcoSim.PlantSim.SpawnPlant(seed.Species, targetPos);
                            plant.Tended = true;
                        }
                    }
                }
            }
        }
コード例 #4
0
    protected override void UseAction(Action _action, float _time)
    {
        switch (_action.Type)
        {
        case ActionType.AIMoveForward:
            _currentAction = new AAMoveForward(this);
            _currentAction.UseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.AIRotate:
            _currentAction = new AARotate(this);
            _currentAction.UseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.AIMoveTo:
            _currentAction = new AAMoveTo(this);
            _currentAction.UseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.AIWait:
            _currentAction = new AAWait();
            _currentAction.UseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.AIRotateDir:
            _currentAction = new AARotateDir(this);
            _currentAction.UseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.SetTask:
            _currentTask = _action.Task;
            break;

        case ActionType.UnsetTask:
            _currentTask = null;
            break;

        case ActionType.SpliceFuture:
            _history.SpliceOffPossibleFuture();
            break;

        case ActionType.AIMoveForwardUnset:
        case ActionType.AIMoveToUnset:
        case ActionType.AIRotateUnset:
        case ActionType.AIWaitUnset:
        case ActionType.AIRotateDirUnset:
            _currentAction = null;
            break;
        }
        if (_combat != null && _action != null)
        {
            SetAction(_combat.UseAction(_action), true);
        }
    }
コード例 #5
0
ファイル: Enemy.cs プロジェクト: jesterswilde/CP_Game
    protected override void UseAction(Action _action, float _time)
    {
        IAtomicAction _aa = GetAAFromAction(_action);

        _currentAA = _aa;
        if (_currentAA != null)
        {
            _currentAA.UseAction(_action, _time);
        }
    }
コード例 #6
0
ファイル: Enemy.cs プロジェクト: jesterswilde/CP_Game
    protected override void ReverseAction(Action _action, float _time)
    {
        IAtomicAction _aa = RewindAAFromAction(_history.PointerAction);

        _currentAA = _aa;
        if (_currentAA != null)
        {
            _currentAA.ReverseAction(_history.PointerAction, _time);
        }
    }
コード例 #7
0
 protected virtual void UnloadAll()
 {
     _history.SpliceOffPossibleFuture();
     if (_currentAction != null)
     {
         SetExternalAction(_currentAction.Unset());
         _currentAction = null;
     }
     if (_currentTask != null)
     {
         SetExternalAction(new TaskAction(ActionType.UnsetTask, _currentTask, true));
         _currentTask = null;
     }
 }
コード例 #8
0
        public static bool Prefix(ref User actor, ref IAtomicAction __result)
        {
            PlayerRunForElectionEvent cEvent = new PlayerRunForElectionEvent(ref actor);
            IEvent iEvent = cEvent;

            EventManager.CallEvent(ref iEvent);

            if (cEvent.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString());
                return(false);
            }

            return(true);
        }
コード例 #9
0
        public static bool Prefix(ref Player actor, ref Skill skill, ref IAtomicAction __result)
        {
            PlayerUnlearnSkillEvent cEvent = new PlayerUnlearnSkillEvent(ref actor, ref skill);
            IEvent iEvent = cEvent;

            EventManager.CallEvent(ref iEvent);

            if (cEvent.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString());
                return(false);
            }

            return(true);
        }
コード例 #10
0
        /// <summary>
        /// Adds an IAtomicAction as a step of this one.
        /// </summary>
        /// <param name="action">The action to add.</param>
        public void AddLogic(IAtomicAction action)
        {
            var cast = action as AtomicAction;

            if (cast != null)
            {
                _performs.AddRange(cast._performs);
                _backOuts.AddRange(cast._backOuts);
                _cleanUps.AddRange(cast._cleanUps);
            }
            else
            {
                AddLogic(action.Perform, action.BackOut, action.CleanUp);
            }
        }
コード例 #11
0
        public static bool Prefix(ref Player actor, ref Organism target, ref IAtomicAction __result)
        {
            PlayerHarvestEvent cEvent = new PlayerHarvestEvent(ref actor, ref target);
            IEvent             iEvent = cEvent;

            EventManager.CallEvent(ref iEvent);

            if (cEvent.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString());
                return(false);
            }

            return(true);
        }
コード例 #12
0
        public static bool Prefix(ref Player player, ref WorldObject __instance, ref IAtomicAction __result)
        {
            var wope      = new WorldObjectPickupEvent(ref __instance, ref player);
            var wopeEvent = (IEvent)wope;

            EventManager.CallEvent(ref wopeEvent);

            if (wope.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString("Asphalt " + nameof(WorldObjectPickupEvent)));
                return(false);
            }

            return(true);
        }
コード例 #13
0
    private bool TryDamageUnfelledTree(INetObject damager, float amount, InteractionContext context)
    {
        if (this.health > 0)
        {
            List <IAtomicAction> playerActions = new List <IAtomicAction>();
            if (damager is Player)
            {
                IAtomicAction statAction = PlayerActions.Harvest.CreateAtomicAction(((Player)damager).User, this);
                playerActions.Add(statAction);

                if (!statAction.CanApplyNonDisposing().Notify((Player)damager))
                {
                    // We only want to dispose the action if it is invalid.  Othewise we want to keep it around to possibly apply later.
                    statAction.Dispose();
                    return(false);
                }
                playerActions.Add(new SimpleAtomicAction(() => (context.SelectedItem as ToolItem).AddExperience(context.Player.User, 5 * this.Species.ExperienceMultiplier, Localizer.Format("felling a {0}", this.Species.UILink()))));
            }

            MultiAtomicAction playerAction = new MultiAtomicAction(playerActions);

            // damage trunk
            this.health = Mathf.Max(0, this.health - amount);

            this.RPC("UpdateHP", this.health / this.Species.TreeHealth);

            if (this.health <= 0)
            {
                this.health = 0;
                if (!playerAction.TryApply().Success)
                {
                    throw new Exception("Killing this tree was verified to be legal a moment ago, but is not anymore.");
                }
                this.FellTree(damager);
                EcoSim.PlantSim.KillPlant(this, DeathType.Harvesting);
            }
            else
            {
                playerAction.Dispose(); // Dispose the unused action
            }
            this.Save();
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #14
0
        public override InteractResult OnActLeft(InteractionContext context)
        {
            if (context.HasBlock && context.Block.Is <Minable>())
            {
                Result result;
                if (context.Block is IRepresentsItem)
                {
                    Item          item      = Item.Get((IRepresentsItem)context.Block);
                    IAtomicAction lawAction = PlayerActions.PickUp.CreateAtomicAction(context.Player, item, context.BlockPosition.Value);
                    result = this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 1, null, lawAction);
                }
                else
                {
                    result = this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 1);
                }

                if (result.Success)
                {
                    if (RubbleObject.TrySpawnFromBlock(context.Block.GetType(), context.BlockPosition.Value))
                    {
                        context.Player.User.UserUI.OnCreateRubble.Invoke();
                    }
                }

                return((InteractResult)result);
            }
            else if (context.Target is RubbleObject)
            {
                var rubble = (RubbleObject)context.Target;
                if (rubble.IsBreakable)
                {
                    rubble.Breakup();
                    BurnCalories(context.Player);
                    return(InteractResult.Success);
                }
                else
                {
                    return(InteractResult.NoOp);
                }
            }
            else
            {
                return(InteractResult.NoOp);
            }
        }
コード例 #15
0
        public override InteractResult OnActLeft(InteractionContext context)
        {
            if (context.HasBlock)
            {
                if (context.Block is PlantBlock)
                {
                    var plant = EcoSim.PlantSim.GetPlant(context.BlockPosition.Value);
                    if (plant != null && plant is IHarvestable)
                    {
                        Result result = ((IHarvestable)plant).TryHarvest(context.Player, false);
                        if (result.Success)
                        {
                            this.BurnCalories(context.Player);
                        }
                        return((InteractResult)result);
                    }
                    else
                    {
                        return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false));
                    }
                }
                else if (context.Block.Is <Diggable>())
                {
                    if (TreeEntity.TreeRootsBlockDigging(context))
                    {
                        return(InteractResult.Failure(Localizer.DoStr("You attempt to dig up the soil, but the roots are too strong!")));
                    }

                    IAtomicAction destroyAction = UsableItemUtils.TryDestroyPlant(context.Player, context.BlockPosition.Value + Vector3i.Up);
                    return((InteractResult)this.PlayerDeleteBlock(
                               context.BlockPosition.Value, context.Player, true, 1, new DirtItem(), destroyAction));
                }
                else
                {
                    return(InteractResult.NoOp);
                }
            }
            else
            {
                return(InteractResult.NoOp);
            }
        }
コード例 #16
0
ファイル: RoadToolItem.cs プロジェクト: Ekkelus/REY-Mod
        public override InteractResult OnActLeft(InteractionContext context)
        {
            if (!context.HasBlock)
            {
                return(InteractResult.NoOp);
            }

            Type blockType = GetRoadBlock(context.Block);

            if (blockType != null)
            {
                IAtomicAction destroyAction = UsableItemUtils.TryDestroyPlant(
                    context.Player, context.BlockPosition.Value + Vector3i.Up, DeathType.Construction);
                return((InteractResult)PlayerPlaceBlock(blockType, context.BlockPosition.Value, context.Player, true, 1, destroyAction));
            }
            else
            {
                return(InteractResult.NoOp);
            }
        }
コード例 #17
0
ファイル: REWAxeItem.cs プロジェクト: EcoModManabiya/Mods
        public override InteractResult OnActLeft(InteractionContext context)
        {
            InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User);

            Random r    = new System.Random();
            int    MYpp = r.Next(100);

            if (context.HasBlock)
            {
                var block = World.GetBlock(context.BlockPosition.Value);
                if (block.Is <TreeDebris>())
                {
                    if (MYpp <= 4)
                    {
                        changes.AddItems <MYBeehiveItem>(1);
                        changes.AddItems <WoodPulpItem>(4);
                    }
                    else if (MYpp <= 20)
                    {
                        changes.AddItems <MYPlumItem>(2);
                        changes.AddItems <WoodPulpItem>(4);
                    }
                    else
                    {
                        changes.AddItems <WoodPulpItem>(5);
                    }
                    IAtomicAction lawAction = PlayerActions.PickUp.CreateAtomicAction(context.Player, Get <WoodPulpItem>(), context.BlockPosition.Value);
                    return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes, lawAction));
                }
                else
                {
                    return(InteractResult.NoOp);
                }
            }
            else
            {
                return(base.OnActLeft(context));
            }
        }
コード例 #18
0
 public override InteractResult OnActLeft(InteractionContext context)
 {
     if (context.HasBlock)
     {
         var block = World.GetBlock(context.BlockPosition.Value);
         if (block.Is <TreeDebris>())
         {
             InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User);
             changes.AddItems <WoodPulpItem>(5);
             IAtomicAction lawAction = PlayerActions.PickUp.CreateAtomicAction(context.Player, Get <WoodPulpItem>(), context.BlockPosition.Value);
             return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes, lawAction));
         }
         else
         {
             return(InteractResult.NoOp);
         }
     }
     else
     {
         return(base.OnActLeft(context));
     }
 }
コード例 #19
0
        public override InteractResult OnActLeft(InteractionContext context)
        {
            if (context.HasBlock)
            {
                var block = World.GetBlock(context.BlockPosition.Value);
                if (block.Is <TreeDebris>())
                {
                    InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User);
                    //TREE DEBRIS REWARDS
                    (EcoSim.GetSpecies(block.Get <TreeDebris>().Species) as TreeSpecies).DebrisResources.ForEach(x => changes.AddItems(x.Key, x.Value.RandInt));
                    IAtomicAction lawAction = PlayerActions.PickUp.CreateAtomicAction(context.Player.User, Get <WoodPulpItem>(), context.BlockPosition.Value);
                    var           result    = (InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, context.Player.User.Talentset.HasTalent(typeof(LoggingCleanupCrewTalent)) ? 1 : 3, null, changes, lawAction);
                    if (result.IsSuccess)
                    {
                        this.AddExperience(context.Player.User, 0.1f, Localizer.DoStr("removing tree debris"));
                    }
                    return(result);
                }

                if (block.Is <Chopable>())
                {
                    var plant = EcoSim.PlantSim.GetPlant(context.BlockPosition.Value);
                    if (plant != null)
                    {
                        return((InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false));
                    }
                }
                return(InteractResult.NoOp);
            }

            if (context.Target is WorldObject)
            {
                return(BasicToolOnWorldObjectCheck(context));
            }

            return(base.OnActLeft(context));
        }
コード例 #20
0
        public override InteractResult OnActLeft(InteractionContext context)
        {
            if (!context.HasBlock)
            {
                return(InteractResult.NoOp);
            }

            Type blockType = this.GetRoadBlock(context.Block);

            if (blockType != null)
            {
                if (TreeEntity.TreeRootsBlockDigging(context))
                {
                    return(InteractResult.Failure(Localizer.DoStr("You attempt to make a road, but the roots are too strong!")));
                }
                IAtomicAction destroyAction = UsableItemUtils.TryDestroyPlant(
                    context.Player, context.BlockPosition.Value + Vector3i.Up, DeathType.Construction);
                return((InteractResult)this.PlayerPlaceBlock(blockType, context.BlockPosition.Value, context.Player, true, 1, destroyAction));
            }
            else
            {
                return(InteractResult.NoOp);
            }
        }
 /// <summary>
 /// Adds an IAtomicAction as a step of this one.
 /// </summary>
 /// <param name="action">The action to add.</param>
 public void AddLogic(IAtomicAction action)
 {
     var cast = action as AtomicAction;
     if (cast != null) {
         _performs.AddRange(cast._performs);
         _backOuts.AddRange(cast._backOuts);
         _cleanUps.AddRange(cast._cleanUps);
     } else {
         AddLogic(action.Perform, action.BackOut, action.CleanUp);
     }
 }
コード例 #22
0
        public static bool Prefix(ref Player actor, ref Type itemType, ref Vector3i position, ref IAtomicAction __result)
        {
            PlayerPickUpEvent cEvent = new PlayerPickUpEvent(ref actor, ref itemType, ref position);
            IEvent            iEvent = cEvent;

            EventManager.CallEvent(ref iEvent);

            if (cEvent.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString());
                return(false);
            }

            return(true);
        }
コード例 #23
0
    protected override void ReverseAction(Action _action, float _time)
    {
        switch (_action.Type)
        {
        case ActionType.Instantiated:
            Destroy(gameObject);
            break;

        case ActionType.AIMoveForwardUnset:
            _currentAction = new AAMoveForward(this);
            _currentAction.ReverseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.AIRotateUnset:
            _currentAction = new AARotate(this);
            _currentAction.ReverseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.AIMoveToUnset:
            _currentAction = new AAMoveTo(this);
            _currentAction.ReverseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.AIWaitUnset:
            _currentAction = new AAWait();
            _currentAction.ReverseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.AIRotateDirUnset:
            _currentAction = new AARotateDir(this);
            _currentAction.ReverseAction(_action, _time);
            _currentTaskIndex = _action.IValue;
            break;

        case ActionType.UnsetTask:
            _currentTask = _action.Task;
            break;

        case ActionType.UnsetInterruption:
            PopInterruption();
            break;

        case ActionType.SetInterruption:
            PushInterruption();
            break;

        case ActionType.SetTask:
            _currentTask = null;
            break;

        case ActionType.LockTrans:
            transform.position = _action.Vector;
            transform.rotation = Quaternion.Euler(_action.SecondVec);
            break;

        case ActionType.AIMoveForward:
        case ActionType.AIMoveTo:
        case ActionType.AIRotate:
        case ActionType.AIWait:
        case ActionType.AIRotateDir:
            _currentAction = null;
            break;

        case ActionType.SpliceFuture:
            _history.ReloadPossibleFuture(_action.PossibleFuture);
            break;
        }
        if (_combat != null)
        {
            _combat.ReverseAction(_action);
        }
    }
コード例 #24
0
        public static bool Prefix(ref User actor, ref CraftingComponent table, ref Item item, ref IAtomicAction __result)
        {
            PlayerCraftEvent cEvent = new PlayerCraftEvent(ref actor, ref table, ref item);
            IEvent           iEvent = cEvent;

            EventManager.CallEvent(ref iEvent);

            if (cEvent.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString());
                return(false);
            }

            return(true);
        }
コード例 #25
0
        public override InteractResult OnActLeft(InteractionContext context)
        {
            if (context.HasBlock && context.Block.Is <Minable>())
            {
                var user = context.Player.User;
                var item = context.Block is IRepresentsItem?Item.Get((IRepresentsItem)context.Block) : null;

                var totalDamageToTarget = user.BlockHitCache.MemorizeHit(context.Block.GetType(), context.BlockPosition.Value, this.Tier.GetCurrentValue(context.Player.User));
                if (context.Block.Get <Minable>().Hardness <= totalDamageToTarget)
                {
                    Result result;
                    if (item != null)
                    {
                        IAtomicAction lawAction = PlayerActions.PickUp.CreateAtomicAction(context.Player.User, item, context.BlockPosition.Value);
                        result = this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 1, null, lawAction);
                    }
                    else
                    {
                        result = this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 1);
                    }

                    if (result.Success)
                    {
                        var forced = context.Player.User.Talentset.HasTalent(typeof(MiningLuckyBreakTalent)) ? 4 : -1;
                        if (RubbleObject.TrySpawnFromBlock(context.Player, context.Block.GetType(), context.BlockPosition.Value, forced))
                        {
                            var addition = item != null ? " " + (item.UILink()) : string.Empty;
                            this.AddExperience(user, 1f, new LocString(Localizer.Format("mining") + addition));
                            user.UserUI.OnCreateRubble.Invoke(item.DisplayName.NotTranslated);
                            user.BlockHitCache.ForgetHit(context.BlockPosition.Value);
                        }
                    }

                    return((InteractResult)result);
                }
                else
                {
                    this.BurnCalories(context.Player);
                }
            }
            else if (context.Target is RubbleObject)
            {
                var rubble = (RubbleObject)context.Target;
                if (rubble.IsBreakable)
                {
                    rubble.Breakup(context.Player);
                    this.BurnCalories(context.Player);
                    return(InteractResult.Success);
                }
                else
                {
                    return(InteractResult.NoOp);
                }
            }

            if (context.Target is WorldObject)
            {
                return(this.BasicToolOnWorldObjectCheck(context));
            }

            return(InteractResult.NoOp);
        }
コード例 #26
0
        public static bool Prefix(ref Guid authId, ref User actor, ref Vector2i position, ref IAtomicAction __result)
        {
            PlayerClaimPropertyEvent cEvent = new PlayerClaimPropertyEvent(ref authId, ref actor, ref position);
            IEvent iEvent = cEvent;

            EventManager.CallEvent(ref iEvent);

            if (cEvent.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString());
                return(false);
            }

            return(true);
        }
コード例 #27
0
        public static bool Prefix(ref User actor, ref Currency currency, ref float amount, ref IAtomicAction __result)
        {
            PlayerPayTaxEvent cEvent = new PlayerPayTaxEvent(ref actor, ref currency, ref amount);
            IEvent            iEvent = cEvent;

            EventManager.CallEvent(ref iEvent);

            if (cEvent.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString());
                return(false);
            }

            return(true);
        }
コード例 #28
0
 public void EnlistAction(IAtomicAction action)
 {
     _actionList.Add(action);
 }
コード例 #29
0
 public void DelistAction(IAtomicAction action)
 {
     _actionList.Remove(action);
 }
コード例 #30
0
        public static bool Prefix(ref User actor, ref StoreComponent store, ref Item item, ref int count, ref IAtomicAction __result)
        {
            PlayerBuyEvent cEvent = new PlayerBuyEvent(ref actor, ref store, ref item, ref count);
            IEvent         iEvent = cEvent;

            EventManager.CallEvent(ref iEvent);

            if (cEvent.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString());
                return(false);
            }

            return(true);
        }
コード例 #31
0
        public static bool Prefix(ref User actor, ref AirPollutionComponent obj, ref float value, ref IAtomicAction __result)
        {
            WorldPolluteEvent wpe      = new WorldPolluteEvent(ref actor, ref obj, ref value);
            IEvent            wpeEvent = wpe;

            EventManager.CallEvent(ref wpeEvent);

            if (wpe.IsCancelled())
            {
                __result = new FailedAtomicAction(new LocString("Asphalt " + nameof(WorldPolluteEvent)));
                return(false);
            }

            return(true);
        }