Exemple #1
0
        public static void Register_OnAddType_OnRemoveType_OnUpdateAdjacentType()
        {
            foreach (BaseType type in types.Values)
            {
                Type typeOftype = type.GetType();

                if (!ItemTypes.IndexLookup.IndexLookupTable.ContainsValue(type.key))
                {
                    Log.Write(string.Format("<color=red>There is no type called {0}</color>"), type.key);
                    types.Remove(type.key);
                    continue;
                }

                if (typeOftype.GetMethod("RegisterOnAdd").DeclaringType == typeOftype)
                {
                    ItemTypesServer.RegisterOnAdd(type.key, type.RegisterOnAdd);
                }

                if (typeOftype.GetMethod("RegisterOnRemove").DeclaringType == typeOftype)
                {
                    ItemTypesServer.RegisterOnRemove(type.key, type.RegisterOnRemove);
                }

                if (typeOftype.GetMethod("RegisterOnUpdateAdjacent").DeclaringType == typeOftype)
                {
                    ItemTypesServer.RegisterOnUpdateAdjacent(type.key, type.RegisterOnUpdateAdjacent);
                }
            }
        }
Exemple #2
0
 public static void AfterItemTypesServer()
 {
     foreach (string blueprintTypename in ManagerBlueprints.blueprints.Keys)
     {
         ItemTypesServer.RegisterOnAdd(blueprintTypename + CAPSULE_SUFFIX, CapsuleBlockCode.OnPlaceCapsule);
     }
     ChatCommands.CommandManager.RegisterCommand(new CapsuleChatCommand());
 }
 public static void AfterItemTypesDefined()
 {
     foreach (string typekey in crateTypeKeys)
     {
         ItemTypesServer.RegisterOnAdd(typekey, StockpileBlockTracker.Add);
         ItemTypesServer.RegisterOnRemove(typekey, StockpileBlockTracker.Remove);
     }
 }
Exemple #4
0
 static void RegisterCallbacks()
 {
     Logger.Log("Register Crates.....");
     foreach (string crate in crateTypeKeys)
     {
         Logger.Log("Register Crate.....{0}", crate);
         ItemTypesServer.RegisterOnAdd(crate, StockpileBlockTracker.Add);
         ItemTypesServer.RegisterOnRemove(crate, StockpileBlockTracker.Remove);
     }
 }
 public static void AfterItemTypesDefined()
 {
     foreach (string blueprintTypename in ManagerBlueprints.Blueprints.Keys)
     {
         ItemTypesServer.RegisterOnAdd(blueprintTypename, ScaffoldBlockCode.AddScaffolds);
         ItemTypesServer.RegisterOnAdd(blueprintTypename + CapsulesModEntries.CAPSULE_SUFFIX, ScaffoldBlockCode.AddScaffolds);
         ItemTypesServer.RegisterOnRemove(blueprintTypename, ScaffoldBlockCode.RemoveScaffolds);
         ItemTypesServer.RegisterOnRemove(blueprintTypename + CapsulesModEntries.CAPSULE_SUFFIX, ScaffoldBlockCode.RemoveScaffolds);
     }
 }
        // using a prebuilt list of croptypes
        public static void registerTrackedTypes()
        {
            // loop through each growable type
            foreach (GrowableType gt in GrowableTypesTracker)
            {
                // register each crop with our custom crop actions


                ItemTypesServer.RegisterOnAdd(gt.TypeName, gt.OnAddAction);
                ItemTypesServer.RegisterOnRemove(gt.TypeName, gt.OnRemoveAction);
                ItemTypesServer.RegisterOnChange(gt.TypeName, gt.OnChangeAction);
            }
        }
Exemple #7
0
        // using a prebuilt list of croptypes
        public static void registerTrackedTypes()
        {
            // loop through each growable type
            foreach (GrowableType gt in GrowableTypesTracker)
            {
                // register each crop with our custom crop actions


                ItemTypesServer.RegisterOnAdd(gt.TypeName, gt.OnAddAction);
                ItemTypesServer.RegisterOnRemove(gt.TypeName, gt.OnRemoveAction);
                ItemTypesServer.RegisterOnChange(gt.TypeName, gt.OnChangeAction);
            }

            ColonyAPI.Helpers.Utilities.WriteLog("ColonyPlusPlus-Core", "Registered Crop Actions");
        }
        /// <summary>
        /// Registers this block as a crate if the isCrate property is set to true. Should be called during the AfterItemTypesDefined callback.
        /// </summary>
        public void registerAsCrate()
        {
            if (this.isCrate)
            {
                Pipliz.Log.Write("{0}: Attempting to register {1} as a crate.", NAMESPACE == null ? "" : NAMESPACE, this.ID);

                try
                {
                    ItemTypesServer.RegisterOnAdd(this.ID, StockpileBlockTracker.Add);
                    ItemTypesServer.RegisterOnRemove(this.ID, StockpileBlockTracker.Remove);
                }
                catch (Exception ex)
                {
                    Pipliz.Log.Write("{0}: Crate registration error: {1}", NAMESPACE == null ? "" : NAMESPACE, ex.Message);
                }
            }
        }
Exemple #9
0
        public void RegisterActionCallback()
        {
            // Utilities.WriteLog("Registering actions for:" + this.TypeName);
            if (this._HasAddAction)
            {
                ItemTypesServer.RegisterOnAdd(this.TypeName, this.onAddAction);
            }

            if (this._HasChangeAction)
            {
                ItemTypesServer.RegisterOnChange(this.TypeName, this.onChangeAction);
            }

            if (this._HasRemoveAction)
            {
                ItemTypesServer.RegisterOnRemove(this.TypeName, this.onRemoveAction);
            }
        }
Exemple #10
0
 public void RegisterCallback()
 {
     ItemTypesServer.RegisterOnAdd(blockName, OnAdd);
     ItemTypesServer.RegisterOnRemove(blockName, OnRemove);
 }
 public static void AfterItemTypesServer()
 {
     ItemTypesServer.RegisterOnRemove("water", WaterbucketCode.OnWaterRemoved);
     ItemTypesServer.RegisterOnAdd(MOD_PREFIX + "waterbucket", WaterbucketCode.OnAddFilled);
 }
Exemple #12
0
 public void RegisterCallbackandLoad()
 {
     ItemTypesServer.RegisterOnAdd(blockName, onAdd);
     ItemTypesServer.RegisterOnAdd(blockName, onRemove);
 }