示例#1
0
 object OnOvenToggle(BaseOven oven, BasePlayer player)
 {
     if (oven.needsBuildingPrivilegeToUse && !player.CanBuild())
     {
         return(null);
     }
     if (usePermissions && !permission.UserHasPermission(oven.OwnerID.ToString(), permAllow))
     {
         return(null);
     }
     if (!oven.HasFlag(BaseEntity.Flags.On))
     {
         object checkMultiplier = null;
         if (!ovenMultipliers.TryGetValue(oven.GetComponent <BaseEntity>().ShortPrefabName, out checkMultiplier))
         {
             return(null);
         }
         var ovenMultiplier = Convert.ToSingle(checkMultiplier);
         if (ovenMultiplier > 10f)
         {
             ovenMultiplier = 10f;
         }
         if (ovenMultiplier < 0.1f)
         {
             ovenMultiplier = 0.1f;
         }
         StartCooking(oven, oven.GetComponent <BaseEntity>(), ovenMultiplier);
         return(false);
     }
     return(null);
 }
示例#2
0
 void OnFindBurnable(BaseOven oven)
 {
     if (oven.GetComponent <BaseEntity>() == null)
     {
         return;
     }
     if (oven.GetComponent <BaseEntity>().GetComponent <FOG>() == null)
     {
         return;
     }
     oven.GetComponent <BaseEntity>().GetComponent <FOG>().AddFood(allChicken);
 }
示例#3
0
 void OnOvenToggle(BaseOven oven, BasePlayer player)
 {
     if (oven.GetComponent <BaseEntity>().ShortPrefabName.ToString() != "bbq.deployed")
     {
         return;
     }
     if (oven.GetComponent <FOG>() != null)
     {
         return;
     }
     oven.GetComponent <BaseEntity>().gameObject.AddComponent <FOG>();
     FOGLIST.Add(oven.GetComponent <BaseEntity>().GetComponent <FOG>());
 }
        private void OnConsumeFuel(BaseOven oven, Item fuel, ItemModBurnable burnable)
        {
            if (!isInitialized)
            {
                return;
            }

            LightController lightController = oven.GetComponent <LightController>();

            if (lightController != null)
            {
                lightController.OnConsumeFuel(fuel);
            }
        }
示例#5
0
        private Item OnFindBurnable(BaseOven oven)
        {
            if (oven.fuelType == null)
            {
                return(null);
            }
            if (!activeShortNames.Contains(oven.ShortPrefabName))
            {
                return(null);
            }
            if (HasFuel(oven))
            {
                return(null);
            }
            DecayEntity decayEnt = oven.GetComponent <DecayEntity>();

            if (decayEnt == null)
            {
                return(null);
            }
            AutomaticRefuel refuel = decayEnt.GetComponent <AutomaticRefuel>();

            if (!refuel)
            {
                decayEnt.gameObject.AddComponent <AutomaticRefuel>();
            }
            if (refuel.cupboard == null)
            {
                refuel.SearchForCupboard();
                if (refuel.cupboard == null)
                {
                    return(null);
                }
            }

            if (dontRequireFuel)
            {
                return(ItemManager.CreateByName(oven.fuelType.shortname, 1));
            }
            Item fuelItem = refuel.GetFuel();

            if (fuelItem == null)
            {
                return(null);
            }
            RemoveItemThink(fuelItem);
            ItemManager.CreateByName(oven.fuelType.shortname, 1)?.MoveToContainer(oven.inventory);
            return(null);
        }
示例#6
0
        private Item OnFindBurnable(BaseOven oven)
        {
            if (!permission.UserHasPermission(oven.OwnerID.ToString(), permissionName))
            {
                return(null);
            }
            if (oven.fuelType == null)
            {
                return(null);
            }
            if (!activeShortNames.Contains(oven.ShortPrefabName))
            {
                return(null);
            }
            if (HasFuel(oven))
            {
                return(null);
            }
            DecayEntity decayEnt = oven.GetComponent <DecayEntity>();

            if (decayEnt == null)
            {
                return(null);
            }
            BuildingPrivlidge priv = decayEnt.GetBuildingPrivilege();

            if (priv == null)
            {
                return(null);
            }
            else
            {
                if (dontRequireFuel)
                {
                    return(ItemManager.CreateByName(oven.fuelType.shortname, 1));
                }
                Item fuelItem = GetFuel(priv, oven);
                if (fuelItem == null)
                {
                    return(null);
                }
                RemoveItemThink(fuelItem);
                ItemManager.CreateByName(oven.fuelType.shortname, 1)?.MoveToContainer(oven.inventory);
                return(null);
            }
        }
示例#7
0
        private void OnEntitySpawned(BaseNetworkable entity)
        {
            if (entity.GetComponent <BaseEntity>()?.ShortPrefabName == "jackolantern.angry" || entity.GetComponent <BaseEntity>()?.ShortPrefabName == "jackolantern.happy")
            {
                entity.GetComponent <BaseOven>().fuelType = ItemManager.FindItemDefinition("wood");
            }

            BaseOven oven = entity.GetComponent <BaseOven>();

            if (!oven)
            {
                return;
            }
            if (!activeShortNames.Contains(oven.ShortPrefabName))
            {
                return;
            }
            if (!oven.GetComponent <AutomaticRefuel>())
            {
                oven.gameObject.AddComponent <AutomaticRefuel>();
            }
        }