Beispiel #1
0
        public void HandleMenuOnOffButton(string deployableid)
        {
            // TODO permissions
            JDeployable deployable;

            if (JDeployableManager.TryGetJDeployable(int.Parse(deployableid), out deployable))
            {
                deployable.MenuOnOffButton(this);
            }
        }
Beispiel #2
0
        public void HandleMenuButton(string deployableid, string value)
        {
            // TODO permissions
            JDeployable deployable;

            if (JDeployableManager.TryGetJDeployable(int.Parse(deployableid), out deployable))
            {
                deployable.MenuButtonCallback(this, value);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Kills JDeployable.
        /// </summary>
        /// <param name="mode"></param>
        /// <param name="remove">Remove JDeployable instance from JDeployableManager so it isn't saved</param>
        public void Kill(BaseNetworkable.DestroyMode mode = BaseNetworkable.DestroyMode.None, bool remove = true)
        {
            if (isBeingDestroyed)
            {
                return;
            }

            if (MainParent != null && !MainParent.IsDestroyed)
            {
                isBeingDestroyed = true;
                MainParent.Kill(mode);
            }

            if (remove)
            {
                JDeployableManager.RemoveJDeployable(this.Id);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Done placing deployable
        /// </summary>
        public void DonePlacing()
        {
            if (!isPlacing)
            {
                return;
            }

            if (CanCraftDeployable(placingType) && JDeployableManager.PlaceDeployable(placingType, this))               // if player can craft it and it is placed

            {
                CollectIngredients(placingType);                 // consume ingredients from player's inventory

                JInfoAttribute info;
                JDeployableManager.DeployableTypes.TryGetValue(placingType, out info);

                ShowMessage($"{info.Name} Created", "", 3);
            }

            EndPlacing();
        }