Exemplo n.º 1
0
            public void ToggleLight(bool status)
            {
                if (config.Owner && !ins.UserHasToggled(entity.OwnerID, consumeType))
                {
                    status = false;
                }

                if (isSearchlight)
                {
                    SearchLight searchLight = entity as SearchLight;
                    if (searchLight != null)
                    {
                        if (status)
                        {
                            Item slot = searchLight.inventory.GetSlot(0);
                            if (slot == null)
                            {
                                ItemManager.Create(searchLight.fuelType).MoveToContainer(searchLight.inventory);
                            }
                        }
                        searchLight.SetFlag(BaseEntity.Flags.On, status);
                    }
                }
                else
                {
                    BaseOven baseOven = entity as BaseOven;
                    if (baseOven != null)
                    {
                        if (config.ConsumeFuel)
                        {
                            if (status)
                            {
                                baseOven.StartCooking();
                            }
                            else
                            {
                                baseOven.StopCooking();
                            }
                        }
                        else
                        {
                            if (baseOven.IsOn() != status)
                            {
                                baseOven.SetFlag(BaseEntity.Flags.On, status);
                            }
                        }
                    }
                }
                entity.SendNetworkUpdate();
            }
Exemplo n.º 2
0
        //Overwriting Oven.StartCooking
		void StartCooking(BaseOven oven)
		{
            if ((Settings.UsePermissions && !permission.UserHasPermission(oven.OwnerID.ToString(), permAllow)))
            {
                oven.StartCooking();
                return;
            }
            if (FindBurnable(oven) == null)
            {
                return;
            }
            oven.UpdateAttachmentTemperature();
            var data = oven.transform.GetOrAddComponent<FurnaceData>();
            oven.CancelInvoke(oven.Cook);
            oven.InvokeRepeating(data.CookOverride, 0.5f, 0.5f);
            oven.SetFlag(BaseEntity.Flags.On, true, false);
        }
Exemplo n.º 3
0
        // This is how we take off or land the carpet!
        object OnOvenToggle(BaseOven oven, BasePlayer player)
        {
            bool rtrn = false; // Must match other plugins with this call to avoid conflicts. QuickSmelt uses false

            CarpetEntity activecarpet;

            try
            {
                activecarpet = player.GetMounted().GetComponentInParent <CarpetEntity>() ?? null;
                if (activecarpet == null)
                {
                    oven.StopCooking();
                    return(rtrn);
                }
            }
            catch
            {
                return(null);
            }

            if (activecarpet.carpetlock != null && activecarpet.carpetlock.IsLocked())
            {
                PrintMsgL(player, "carpetlocked"); return(rtrn);
            }
            if (!player.isMounted)
            {
                return(rtrn);                  // player offline, does not mean ismounted on carpet
            }
            if (player.GetMounted() != activecarpet.entity)
            {
                return(rtrn);                                           // online player not in seat on carpet
            }
#if DEBUG
            Puts("OnOvenToggle: Player cycled lantern!");
#endif
            if (oven.IsOn())
            {
                oven.StopCooking();
            }
            else
            {
                oven.StartCooking();
            }
            if (!activecarpet.FuelCheck())
            {
                if (activecarpet.needfuel)
                {
                    PrintMsgL(player, "nofuel");
                    PrintMsgL(player, "landingcarpet");
                    activecarpet.engineon = false;
                }
            }
            var ison = activecarpet.engineon;
            if (ison)
            {
                activecarpet.islanding = true; PrintMsgL(player, "landingcarpet"); return(null);
            }
            if (!ison)
            {
                AddPlayerToPilotsList(player); activecarpet.engineon = true; return(null);
            }

            return(rtrn);
        }