Ejemplo n.º 1
0
 public override string GetActivationText(global::WorldBase _world, global::BlockValue _blockValue, int _clrIdx, global::Vector3i _blockPos, global::EntityAlive _entityFocusing)
 {
     return(string.Format(Localization.Get("takeandreplace"), Localization.Get(_blockValue.Block.GetBlockName())));
     //    return "Press <E> to remove the wood from this block.";
 }
Ejemplo n.º 2
0
 public override string GetActivationText(global::WorldBase _world, global::BlockValue _blockValue, int _clrIdx, global::Vector3i _blockPos, global::EntityAlive _entityFocusing)
 {
     return("Press <E> to remove the wood from this block.");
 }
Ejemplo n.º 3
0
 public override bool OnBlockActivated(int _indexInBlockActivationCommands, global::WorldBase _world, int _cIdx, global::Vector3i _blockPos, global::BlockValue _blockValue, global::EntityAlive _player)
 {
     this.TakeItemWithTimer(_cIdx, _blockPos, _blockValue, _player);
     return(true);
 }
Ejemplo n.º 4
0
    public override string GetActivationText(global::WorldBase _world, global::BlockValue _blockValue, int _clrIdx, global::Vector3i _blockPos, global::EntityAlive _entityFocusing)
    {
        if (!_world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false))
        {
            return(string.Empty);
        }

        global::Block block     = global::Block.list[_blockValue.type];
        string        blockName = block.GetBlockName();

        return(string.Format(global::Localization.Get("pickupPrompt", string.Empty), global::Localization.Get(blockName, string.Empty)));
    }
    public override bool OnBlockActivated(int _indexInBlockActivationCommands, global::WorldBase _world, int _cIdx, global::Vector3i _blockPos, global::BlockValue _blockValue, global::EntityAlive _player)
    {
        global::BlockValue block = _world.GetBlock(_blockPos.x, _blockPos.y - 1, _blockPos.z);

        if (global::Block.list[block.type].HasTag(global::BlockTags.Door))
        {
            _blockPos = new global::Vector3i(_blockPos.x, _blockPos.y - 1, _blockPos.z);
            return(this.OnBlockActivated(_indexInBlockActivationCommands, _world, _cIdx, _blockPos, _blockValue, _player));
        }
        global::TileEntityVendingMachine tileEntityVendingMachine = _world.GetTileEntity(_cIdx, _blockPos) as global::TileEntityVendingMachine;

        if (tileEntityVendingMachine == null)
        {
            return(false);
        }
        global::LocalPlayerUI uiforPlayer = global::LocalPlayerUI.GetUIForPlayer(_player as global::EntityPlayerLocal);

        if (null != uiforPlayer)
        {
            switch (_indexInBlockActivationCommands)
            {
            case 0:
                return(this.OnBlockActivated(_world, _cIdx, _blockPos, _blockValue, _player));

            case 1:
            {
                this.tmpPickupUiforPlayer = uiforPlayer;
                this.tmpPickupClrIdx      = _cIdx;
                this.tmpPickupBlockPos    = _blockPos;
                this.tmpPickupItemStack   = new global::ItemStack(_blockValue.ToItemValue(), 1);
                this.TakeItemWithTimer(_cIdx, _blockPos, _blockValue, _player);
                return(true);
            }

            case 2:
                uiforPlayer.windowManager.Open(global::GUIWindowKeypad.ID, true, false, true);
                global::NGuiKeypad.Instance.LockedItem = tileEntityVendingMachine;
                return(true);
            }
        }
        return(false);
    }
    public void TakeItemWithTimer(int _cIdx, global::Vector3i _blockPos, global::BlockValue _blockValue, global::EntityAlive _player)
    {
        if (_blockValue.damage > 0)
        {
            global::GameManager.ShowTooltipWithAlert(_player as global::EntityPlayerLocal, global::Localization.Get("ttRepairBeforePickup", string.Empty), "ui_denied");
            return;
        }
        global::LocalPlayerUI playerUI = (_player as global::EntityPlayerLocal).PlayerUI;

        playerUI.windowManager.Open("timer", true, false, true);
        global::XUiC_Timer     xuiC_Timer     = (global::XUiC_Timer)playerUI.xui.GetChildByType <global::XUiC_Timer>();
        global::TimerEventData timerEventData = new global::TimerEventData();

        timerEventData.Data = new object[]
        {
            _cIdx,
            _blockValue,
            _blockPos,
            _player
        };
        timerEventData.Event += this.TakeBlock;
        xuiC_Timer.SetTimer(this.TakeDelay, timerEventData);
    }
    public override global::BlockActivationCommand[] GetBlockActivationCommands(global::WorldBase _world, global::BlockValue _blockValue,
                                                                                int _clrIdx, global::Vector3i _blockPos, global::EntityAlive _entityFocusing)
    {
        BlockActivationCommand[] returnVal = base.GetBlockActivationCommands(_world, _blockValue, _clrIdx, _blockPos, _entityFocusing);

        global::TileEntityVendingMachine tileEntityVendingMachine = _world.GetTileEntity(_clrIdx, _blockPos) as global::TileEntityVendingMachine;
        string @string = global::GamePrefs.GetString(global::EnumGamePrefs.PlayerId);

        returnVal[1].enabled = (this.CanPickup && _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false));

        return(returnVal);
    }
Ejemplo n.º 8
0
    public override void Execute(List <string> _params, global::CommandSenderInfo _senderInfo)
    {
        int id;

        if (int.TryParse(_params[0], out id))
        {
            global::Entity entity = null;
            for (int i = global::GameManager.Instance.World.Entities.list.Count - 1; i >= 0; i--)
            {
                global::Entity curEntity = global::GameManager.Instance.World.Entities.list[i];
                if (curEntity.entityId == id)
                {
                    entity = curEntity;
                    break;
                }
            }
            if (entity == null)
            {
                global::SingletonMonoBehaviour <global::SdtdConsole> .Instance.Output("Not a valid entity");

                return;
            }
            global::EntityAlive entityAlive = null;
            if (entity is global::EntityAlive)
            {
                entityAlive = (global::EntityAlive)entity;
            }

            string output = "Entity infos:\n";
            output += (entity.ToString() + "\n");
            output += ("pos = " + entity.GetPosition().ToString() + "\n");
            output += ("rot = " + entity.rotation.ToString() + "\n");
            output += ("lifetime = " + ((entity.lifetime != float.MaxValue) ? entity.lifetime.ToCultureInvariantString("0.0").ToString() : "float.Max".ToString()));
            output += ("remote = " + entity.isEntityRemote.ToString() + "\n");
            output += ("dead = " + entity.IsDead().ToString() + "\n");

            if (entityAlive != null)
            {
                output += ("health = " + entityAlive.Health.ToString() + " / " + entityAlive.classMaxHealth.ToString() + "\n");
                output += ("stamina = " + entityAlive.Stamina.ToString() + " / " + entityAlive.classMaxStamina.ToString() + "\n");
                output += ("food = " + entityAlive.Stats.Food.ToString() + " / " + entityAlive.classMaxFood.ToString() + "\n");
                output += ("water = " + entityAlive.Stats.Water.ToString() + " / " + entityAlive.classMaxWater.ToString() + "\n");
                output += ("sickness = " + entityAlive.Stats.Sickness.ToString() + " / " + entityAlive.classMaxSickness.ToString() + "\n");

                Animation[] animation = entityAlive.gameObject.GetComponentsInChildren <Animation>();
                if (animation != null && animation.Length > 0)
                {
                    output += ("Animations:\n");
                    foreach (AnimationState state in animation[0])
                    {
                        output += ("state: " + state.name + " / clip: " + state.clip.name + " / enabled = " + state.enabled.ToString() + " / length: " + state.clip.length.ToString() + "\n");
                    }
                }

                Animator[] animator = entityAlive.gameObject.GetComponentsInChildren <Animator>();
                if (animator != null && animator.Length > 0)
                {
                    AnimatorClipInfo[] animatorClipInfo = animator[0].GetCurrentAnimatorClipInfo(0);
                    if (animatorClipInfo != null && animatorClipInfo.Length > 0)
                    {
                        output += ("AnimatorClipInfo: " + animatorClipInfo[0].clip.name + " / length = " + animatorClipInfo[0].clip.length.ToString() + "\n");
                    }

                    AnimatorStateInfo animatorStateInfo = animator[0].GetCurrentAnimatorStateInfo(0);
                    output += ("AnimatorStateInfo: length = " + animatorStateInfo.length.ToString() + " / speed = " + animatorStateInfo.speed.ToString() + "\n");
                }

                Renderer[] renderers = entityAlive.GetComponentsInChildren <Renderer>();
                output += "Renderers:\n";
                foreach (Renderer rend in renderers)
                {
                    output += ("object " + rend.gameObject.name + " material = " + rend.material.shader.name + "\n");
                }
            }

            global::SingletonMonoBehaviour <global::SdtdConsole> .Instance.Output(output);
        }
        else
        {
            global::SingletonMonoBehaviour <global::SdtdConsole> .Instance.Output("Entity '" + _params[0] + "' not found");
        }
    }
    public override global::BlockActivationCommand[] GetBlockActivationCommands(global::WorldBase _world, global::BlockValue _blockValue, int _clrIdx, global::Vector3i _blockPos, global::EntityAlive _entityFocusing)
    {
        bool flag = _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false);

        this.blockActivationCommand[0].enabled = (this.CanPickup && flag && this.TakeDelay > 0f);
        return(this.blockActivationCommand);
    }
 public override string GetActivationText(global::WorldBase _world, global::BlockValue _blockValue, int _clrIdx, global::Vector3i _blockPos, global::EntityAlive _entityFocusing)
 {
     // If this.CanPickup is enabled, we don't want to be bothered by the pickup text when in the middle of a blood moon
     return(string.Empty);
 }
    public override bool OnBlockActivated(int _indexInBlockActivationCommands, global::WorldBase _world, int _cIdx, global::Vector3i _blockPos, global::BlockValue _blockValue, global::EntityAlive _player)
    {
        global::BlockValue block = _world.GetBlock(_blockPos.x, _blockPos.y - 1, _blockPos.z);

        if (global::Block.list[block.type].HasTag(global::BlockTags.Door))
        {
            _blockPos = new global::Vector3i(_blockPos.x, _blockPos.y - 1, _blockPos.z);
            return(this.OnBlockActivated(_indexInBlockActivationCommands, _world, _cIdx, _blockPos, _blockValue, _player));
        }
        if (_indexInBlockActivationCommands != 0)
        {
            return(false);
        }

        this.TakeItemWithTimer2(_cIdx, _blockPos, _blockValue, _player);
        return(true);
    }