Example #1
0
    void Start()
    {
        cc = new ComponentCache(gameObject , ComponentCache.LogMessageLevel.all);

        Debug.LogWarning("Test Cache");
        cc.GetComponent<AudioSource>();
        cc.GetComponent<AudioSource>();
        cc.DestroyComponent<AudioSource>();

        Debug.LogWarning("Add component test");
        asrc1 = gameObject.AddComponent<AudioSource>();
        asrc1.mute = true;
        AudioSource testAs = cc.GetComponent<AudioSource>();
        if (testAs != asrc1)
            Debug.LogError("Retrieved component not the same?");

        testAs = cc.GetComponent<AudioSource>();
        if (testAs != asrc1)
            Debug.LogError("Retrieved component not the same?");

        Debug.LogWarning("Adding second component");
        AudioSource asrc2 = gameObject.AddComponent<AudioSource>();
        Debug.LogWarning("Destroying first component");
        cc.DestroyComponent(asrc1);
        cc.GetComponent<AudioSource>();
        cc.GetComponent<AudioSource>();

        Assert.IsNull(asrc1);
        Assert.IsNotNull(asrc2);
    }
Example #2
0
        public BaseTypeWalker(IType type, ComponentCache componentCache = null)
            : this(componentCache)
        {
            Contract.Requires<ArgumentNullException>(type != null);

            this.type = type.TypeDefinition;
        }
Example #3
0
        private void RestorePrefabValues(GameObject go, bool includeChildren = true)
        {
            ComponentCache componentCache = GetObjComponentCache(go, includeChildren);

            Debug.Assert(m_prefabCompValues.Length == componentCache.components.Length, "The number of components in the prefab and gameObject is not the same. Did you destroy any component by mistake?");
            //TODO: if it mismatches destroy go and instantiate a new go until it works fine. Remember to remove it from m_dicGoComp.

            if (m_prefabCompValues.Length == componentCache.components.Length)
            {
                for (int i = 0, s = componentCache.components.Length; i < s; ++i)
                {
                    Component comp = componentCache.components[i];
                    m_prefabCompValues[i].RestorePrefabValues(comp);
                }
            }
            // reset rigidBody velocity
            if (componentCache.rigidBody)
            {
                componentCache.rigidBody.velocity        = Vector3.zero;
                componentCache.rigidBody.angularVelocity = Vector3.zero;
            }
            // reset rigidBody2D velocity
            else if (componentCache.rigidBody2D)
            {
                componentCache.rigidBody2D.velocity        = Vector2.zero;
                componentCache.rigidBody2D.angularVelocity = 0f;
            }
        }
Example #4
0
    public void Modify(GameObject entity, ZDO entityZdo)
    {
        if (MaxLevel <= 1)
        {
            return;
        }

        if (MinDistanceForLevelups > 0 && entityZdo.m_position.magnitude < MinDistanceForLevelups)
        {
            return;
        }

        int minLevel = Math.Max(1, MinLevel);
        int level    = minLevel;

        for (; level < MaxLevel; ++level)
        {
            if (UnityEngine.Random.Range(0f, 100f) > LevelupChance)
            {
                break;
            }
        }

        if (minLevel > 1)
        {
            Character character = ComponentCache.Get <Character>(entity);

            if (character != null && character)
            {
                character.SetLevel(minLevel);
            }
        }
    }
Example #5
0
        private ComponentCache CacheObjComponents(GameObject go, bool includeChildren = true)
        {
            s_tempCompList.Clear();
            if (includeChildren)
            {
                go.GetComponentsInChildren <Component>(true, s_tempCompList);
            }
            else
            {
                go.GetComponents <Component>(s_tempCompList);
            }
            //Keep only the components contained in the m_prefabCompValues
            for (int i = 0, s = s_tempCompList.Count, s2 = m_prefabCompValues.Length; i < s; ++i)
            {
                if (i >= s2 || s_tempCompList[i].GetType() != m_prefabCompValues[i].type) //Opt: Use RemoveRange for i >= s2.
                {
                    s_tempCompList.RemoveAt(i--);
                    s = s_tempCompList.Count;
                }
            }
            ComponentCache componentCache = new ComponentCache();

            componentCache.components = s_tempCompList.ToArray();
            componentCache.rigidBody  = go.GetComponent <Rigidbody>();
            if (!componentCache.rigidBody)
            {
                componentCache.rigidBody2D = go.GetComponent <Rigidbody2D>();
            }
            m_dicGoComp[go] = componentCache;
            return(componentCache);
        }
    internal static void ModifySpawn(CreatureSpawner spawner, GameObject spawn)
    {
        var template = LocalSpawnerManager.GetTemplate(spawner);

        if (template is null)
        {
#if DEBUG
            Log.LogTrace($"Found no config for {spawn}.");
#endif
            return;
        }

        Log.LogTrace($"Applying modifiers to spawn {spawn.name}");

        var spawnZdo = ComponentCache.GetZdo(spawn);

        if (template.Modifiers is not null)
        {
            foreach (var modifier in template.Modifiers)
            {
                try
                {
                    modifier?.Modify(spawn, spawnZdo);
                }
                catch (Exception e)
                {
                    Log.LogError($"Error while attempting to apply modifier '{modifier?.GetType()?.Name}' to local spawner '{spawner.name}'", e);
                }
            }
        }
    }
Example #7
0
    public void Modify(GameObject entity, ZDO entityZdo)
    {
        if (entity is null)
        {
            return;
        }

        var character = ComponentCache.Get <Character>(entity);

        if (character is null)
        {
            return;
        }

        if (Faction is null)
        {
            return;
        }

#if DEBUG
        Log.LogDebug($"Setting faction {Faction}");
#endif
        character.m_faction = Faction.Value;
        entityZdo?.SetFaction(Faction.Value);
    }
Example #8
0
    private EntityType GetHitterType(DamageRecord record)
    {
        EntityType hitBy = EntityType.Other;

        if (record.Hit.HaveAttacker())
        {
            GameObject attacker = ZNetScene.instance.FindInstance(record.Hit.m_attacker);

            var attackerCharacter = ComponentCache.GetComponent <Character>(attacker);

            if (attackerCharacter is not null)
            {
                if (attackerCharacter.IsPlayer())
                {
                    hitBy = EntityType.Player;
                }
                else
                {
                    hitBy = EntityType.Creature;
                }
            }
        }

        return(hitBy);
    }
    public void Modify(GameObject entity, ZDO entityZdo)
    {
        var character = ComponentCache.Get <Character>(entity);

        if (character is null)
        {
            return;
        }

        string aiConfig = "{}";

        if (!string.IsNullOrWhiteSpace(Config))
        {
            aiConfig = Config;
        }

        try
        {
            MobManager.RegisterMob(character, Guid.NewGuid().ToString(), AiName, aiConfig);

            Log.LogTrace($"Set AI '{AiName}' for spawn '{entity.name}'.");
        }
        catch (Exception e)
        {
            Log.LogError($"Failure while attempting to set AI '{AiName}' for spawn '{entity.name}'", e);
        }
    }
Example #10
0
        protected void Update()
        {
            if (SuperController.singleton.isLoading)
            {
                ComponentCache.Clear();
            }

            if (!_initialized || SuperController.singleton.isLoading)
            {
                return;
            }

            var sb = new StringBuilder();

            sb.Append("Up:      ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.L0) ?? float.NaN).AppendLine()
            .Append("Right:   ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.L1) ?? float.NaN).AppendLine()
            .Append("Forward: ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.L2) ?? float.NaN).AppendLine()
            .Append("Yaw:     ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.R0) ?? float.NaN).AppendLine()
            .Append("Pitch:   ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.R1) ?? float.NaN).AppendLine()
            .Append("Roll:    ").AppendFormat("{0:F3}", _valuesSource?.GetValue(DeviceAxis.R2) ?? float.NaN).AppendLine();

            ValuesSourceReportText.val = sb.ToString();

            DebugDraw.Draw();
            DebugDraw.Enabled = DebugDrawEnableToggle.val;
            _physicsIteration = 0;
        }
    public void Modify(GameObject entity, ZDO entityZdo)
    {
        var character = ComponentCache.Get <Character>(entity);

        if (character != null)
        {
            API.LevelRand(character);
        }
    }
Example #12
0
        /// <summary>
        ///     LoadContent will be called once per game and is the place to load
        ///     all of your content.
        /// </summary>
        protected sealed override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            if (!Directory.Exists("cfg"))
            {
                Directory.CreateDirectory("cfg");
            }
            if (!Directory.Exists("addons"))
            {
                Directory.CreateDirectory("addons");
            }


            ComponentCache.RegisterComponents();
            HeaderCache.RegisterHeaders();
            NetworkMethodCache.RegisterSendables();
            TileTypeCache.RegisterTileTypes();

            ServiceLocator.RegisterService(Content);
            ServiceLocator.RegisterService(spriteBatch);
            ServiceLocator.RegisterService(graphics);

            ServiceLocator.RegisterImplementations();
            DefineImplementations();
            ServiceLocator.RegisterServices();

            GameState.RegisterStates();
            ServiceLocator.Get <IPerformanceProfiler>().StartSession(false);
            for (var i = 0; i < 1000; i++)
            {
                //var world = new ObjectFactory<ThreeTierWorld>().Make(1, 1);
            }

            var time = ServiceLocator.Get <IPerformanceProfiler>().StopSession();

            Debug.WriteLine(time.TotalTime.Milliseconds);

            ServiceLocator.Get <IPropertyService>().Load("app");
            SteamCallback.Create();
            LuaContext.LoadAddons();

            Window.TextInput += ServiceLocator.Get <ITextInputService>().Execute;

            camera          = ServiceLocator.Get <ICamera>();
            input           = ServiceLocator.Get <IInput>();
            gameTimeService = ServiceLocator.Get <IGameTimeService>();
            stateService    = ServiceLocator.Get <IStateService>();
            client          = ServiceLocator.Get <IClient>();


            LoadGameContent();
        }
Example #13
0
        public void Modify(DropContext context)
        {
            CharacterDropModConfigEpicLoot config;

            if (context.Extended.Config.TryGet(CharacterDropModConfigEpicLoot.ModName, out Config cfg) && cfg is CharacterDropModConfigEpicLoot modConfig)
            {
                config = modConfig;
            }
            else
            {
                return;
            }

#if DEBUG
            Log.LogDebug("Adding magic modifiers.");
#endif

            if (InitializeMagicItem is null)
            {
#if DEBUG
                Log.LogDebug("Couldn't find LootRoller.InitializeMagicItem.");
#endif
                return;
            }

            var itemDrop = ComponentCache.GetComponent <ItemDrop>(context.Item);

            if (EpicLoot.EpicLoot.CanBeMagicItem(itemDrop.m_itemData))
            {
                var extendedItemData = new ExtendedItemData(itemDrop.m_itemData);

                var rarity = RollRarity(config);

                if (rarity is Rarity.None)
                {
                    return;
                }

                if (rarity is Rarity.Unique)
                {
                    MakeUnique(itemDrop, extendedItemData, modConfig);
                }
                else
                {
                    //Make magic.
                    var epicLootRarity = RarityToItemRarity(rarity);
                    if (epicLootRarity is not null)
                    {
                        MakeMagic(epicLootRarity.Value, itemDrop, extendedItemData, context.Pos);
                    }
                }
            }
        }
    public void Modify(GameObject entity, ZDO entityZdo)
    {
        var character = ComponentCache.Get <Character>(entity);

        if (character is null)
        {
            return;
        }

#if DEBUG
        Log.LogDebug($"Setting tamed");
#endif
        character.SetTamed(Tamed);
    }
    private static void SetCommandable(Tameable __instance)
    {
        var zdo = ComponentCache.GetZdo(__instance);

        if (zdo is null)
        {
            return;
        }

        if (zdo.GetBool("spawnthat_tamed_commandable", false))
        {
            __instance.m_commandable = true;
        }
    }
    internal static bool CheckConditionsValid(CreatureSpawner spawner)
    {
#if DEBUG && VERBOSE
        Log.LogTrace($"Testing conditions of spawner '{spawner.name}:{spawner.transform.position}'");
#endif

        var template = LocalSpawnerManager.GetTemplate(spawner);

        if (template is not null && !template.Enabled)
        {
            return(false);
        }

        if (template?.SpawnConditions is null)
        {
            return(true);
        }

        var spawnerZdo = ComponentCache.GetZdo(spawner);

        if (spawnerZdo is null)
        {
            return(true);
        }

        SpawnSessionContext context = new(spawnerZdo);

        foreach (var condition in template.SpawnConditions)
        {
            try
            {
                var validCondition = condition?.IsValid(context) ?? true;

                if (!validCondition)
                {
#if DEBUG && VERBOSE
                    Log.LogTrace($"Local Spawner '{spawner.name}', Invalid condition '{condition.GetType().Name}'");
#endif
                    return(false);
                }
            }
            catch (Exception e)
            {
                Log.LogError($"Error while attempting to check spawn condition '{condition?.GetType()?.Name}' for local spawner '{spawner.name}'. Ignoring condition", e);
            }
        }

        return(true);
    }
Example #17
0
    static int QPYX_get_value_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        ComponentCache.Injection <ComponentCache> QPYX_obj_YXQP = (ComponentCache.Injection <ComponentCache>)QPYX_o_YXQP;
            ComponentCache QPYX_ret_YXQP = QPYX_obj_YXQP.value;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index value on a nil value"));
        }
    }
Example #18
0
    static int QPYX_set_value_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        ComponentCache.Injection <ComponentCache> QPYX_obj_YXQP = (ComponentCache.Injection <ComponentCache>)QPYX_o_YXQP;
            ComponentCache QPYX_arg0_YXQP = (ComponentCache)ToLua.CheckObject <ComponentCache>(L_YXQP, 2);
            QPYX_obj_YXQP.value = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index value on a nil value"));
        }
    }
 static int SetCacheToLua(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         ComponentCache obj  = (ComponentCache)ToLua.CheckObject <ComponentCache>(L, 1);
         LuaTable       arg0 = ToLua.CheckLuaTable(L, 2);
         obj.SetCacheToLua(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #20
0
    // Start is called before the first frame update
    void Start()
    {
        List <Component> _components = new List <Component>(m_target.GetComponents <Component>());

        m_validTypes = new List <System.Type>(_components.Count);

        foreach (Component _comp in _components)
        {
            System.Type _compType = _comp.GetType();
            m_validTypes.Add(_compType);
        }

        m_target    = m_target ?? gameObject;
        m_typeCache = m_target.Cache();
    }
    static void HierarchWindowOnGUI(int instanceID, Rect selectionRect)
    {
        selectionRect.x    += selectionRect.width - 30;
        selectionRect.width = 15;

        // Go through state switchers and draw on targets
        var allComponentCaches = ComponentCache.GetAllComponentCaches();

        for (int i = 0; i < allComponentCaches.Count; i++)
        {
            var componentCache = allComponentCaches[i];
            // foreach (var item in ComponentCacheEditor.m_totalTypeNameList)
            // {
            //  string typeName = item.ToString();
            //  if(typeName.Contains(".")){
            //      typeName = typeName.Substring(typeName.LastIndexOf(".") + 1);
            //  }
            //  RenderObjectInjection(instanceID, selectionRect, componentCache, typeName, componentCache.objectList);
            // }
            RenderInjection <ComponentCache.GameObject_Injection, GameObject>(instanceID, selectionRect, componentCache, "GameObject", componentCache.gameObjectList);
            RenderInjection <ComponentCache.Transform_Injection, Transform>(instanceID, selectionRect, componentCache, "Transform", componentCache.transformList);
            RenderInjection <ComponentCache.RectTransform_Injection, RectTransform>(instanceID, selectionRect, componentCache, "RectTransform", componentCache.rectTransformList);
            RenderInjection <ComponentCache.Image_Injection, Image>(instanceID, selectionRect, componentCache, "Image", componentCache.imageList);
            RenderInjection <ComponentCache.Text_Injection, Text>(instanceID, selectionRect, componentCache, "Text", componentCache.textList);
            RenderInjection <ComponentCache.Toggle_Injection, Toggle>(instanceID, selectionRect, componentCache, "Toggle", componentCache.toggleList);
            RenderInjection <ComponentCache.Button_Injection, Button>(instanceID, selectionRect, componentCache, "Button", componentCache.buttonList);
            RenderInjection <ComponentCache.Slider_Injection, Slider>(instanceID, selectionRect, componentCache, "Slider", componentCache.sliderList);
            RenderInjection <ComponentCache.ToggleGroup_Injection, ToggleGroup>(instanceID, selectionRect, componentCache, "ToggleGroup", componentCache.toggleGroupList);
            RenderInjection <ComponentCache.InputField_Injection, InputField>(instanceID, selectionRect, componentCache, "InputField", componentCache.inputFieldList);
            RenderInjection <ComponentCache.Graphic_Injection, Graphic>(instanceID, selectionRect, componentCache, "Graphic", componentCache.graphicList);
            RenderInjection <ComponentCache.ScrollRect_Injection, ScrollRect>(instanceID, selectionRect, componentCache, "ScrollRect", componentCache.scrollRectList);
            RenderInjection <ComponentCache.Scrollbar_Injection, Scrollbar>(instanceID, selectionRect, componentCache, "Scrollbar", componentCache.scrollbarList);
            RenderInjection <ComponentCache.Dropdown_Injection, Dropdown>(instanceID, selectionRect, componentCache, "Dropdown", componentCache.dropdownList);
            RenderInjection <ComponentCache.GridLayoutGroup_Injection, GridLayoutGroup>(instanceID, selectionRect, componentCache, "GridLayoutGroup", componentCache.gridLayoutGroupList);
            RenderInjection <ComponentCache.RawImage_Injection, RawImage>(instanceID, selectionRect, componentCache, "RawImage", componentCache.rawImageList);
            RenderInjection <ComponentCache.AudioSource_Injection, AudioSource>(instanceID, selectionRect, componentCache, "AudioSource", componentCache.audioSourceList);
            RenderInjection <ComponentCache.QuickGrid_Injection, littlerbird.UI.QuickGrid>(instanceID, selectionRect, componentCache, "QuickGrid", componentCache.quickGridList);
            RenderInjection <ComponentCache.SimpleScrollView_Injection, SimpleScrollView>(instanceID, selectionRect, componentCache, "SimpleScrollView", componentCache.simpleScrollViewList);
            RenderInjection <ComponentCache.Animation_Injection, Animation>(instanceID, selectionRect, componentCache, "Animation", componentCache.animationList);
            RenderInjection <ComponentCache.Animator_Injection, Animator>(instanceID, selectionRect, componentCache, "Animator", componentCache.animatorList);
            RenderInjection <ComponentCache.SpriteAtlas_Injection, SpriteAtlas>(instanceID, selectionRect, componentCache, "SpriteAtlas", componentCache.spriteAtlasList);
            RenderInjection <ComponentCache.SpriteHolder_Injection, SpriteHolder>(instanceID, selectionRect, componentCache, "SpriteHolder", componentCache.spriteHolderList);
            RenderInjection <ComponentCache.UIStateSwitcher_Injection, UIStateSwitcher>(instanceID, selectionRect, componentCache, "UIStateSwitcher", componentCache.uiStateSwitcherList);
            RenderInjection <ComponentCache.TextWrap_Injection, TextWrap>(instanceID, selectionRect, componentCache, "TextWrap", componentCache.textWrapList);
            RenderInjection <ComponentCache.UIImageAnimation_Injection, UIImageAnimation>(instanceID, selectionRect, componentCache, "UIImageAnimation", componentCache.uiImageAnimList);
            RenderInjection <ComponentCache.ComponentCache_Injection, ComponentCache>(instanceID, selectionRect, componentCache, "ComponentCache", componentCache.cacheList);
        }
    }
Example #22
0
    public static void StartSession(SpawnSystem spawner)
    {
        try
        {
#if FALSE && DEBUG && VERBOSE
            Log.LogDebug("WorldSpawnSessionManager.StartSession");
#endif

            Spawner = spawner;
            Context = new(ComponentCache.GetZdo(Spawner));
        }
        catch (Exception e)
        {
            Log.LogError("Error during initialization of new SpawnSystem session", e);
        }
    }
Example #23
0
        protected void Update()
        {
            if (SuperController.singleton.isLoading)
            {
                ComponentCache.Clear();
            }

            if (!_initialized || SuperController.singleton.isLoading)
            {
                return;
            }

            DebugDraw.Draw();
            DebugDraw.Enabled = DebugDrawEnableToggle.val;
            _physicsIteration = 0;
        }
Example #24
0
    static int get_value(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ComponentCache.Injection <ComponentCache> obj = (ComponentCache.Injection <ComponentCache>)o;
            ComponentCache ret = obj.value;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index value on a nil value"));
        }
    }
    static int get_cacheList(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ComponentCache obj = (ComponentCache)o;
            System.Collections.Generic.List <ComponentCache.ComponentCache_Injection> ret = obj.cacheList;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index cacheList on a nil value"));
        }
    }
    static int get_group(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ComponentCache obj = (ComponentCache)o;
            string         ret = obj.group;
            LuaDLL.lua_pushstring(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index group on a nil value"));
        }
    }
    static int set_group(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ComponentCache obj  = (ComponentCache)o;
            string         arg0 = ToLua.CheckString(L, 2);
            obj.group = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index group on a nil value"));
        }
    }
        public void Modify(DropContext context)
        {
            if (context?.Item is null)
            {
                return;
            }

            if (context?.Extended?.Config?.SetQualityLevel <= 0)
            {
                return;
            }

            var itemDrop = ComponentCache.GetComponent <ItemDrop>(context.Item);

            Log.LogTrace($"Setting level of item '{context.Item.name}' to {context.Extended.Config.SetQualityLevel.Value}");
            itemDrop.m_itemData.m_quality = context.Extended.Config.SetQualityLevel;
        }
Example #29
0
    public void Modify(DropContext context)
    {
        if (context?.Item is null)
        {
            return;
        }

        if (context?.Extended?.Config?.SetDurability < 0)
        {
            return;
        }

        var itemDrop = ComponentCache.GetComponent <ItemDrop>(context.Item);

        Log.LogTrace($"Setting durability of item '{context.Item.name}' to {context.Extended.Config.SetDurability.Value}");
        itemDrop.m_itemData.m_durability = context.Extended.Config.SetDurability;
    }
    static int set_dropdownList(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ComponentCache obj = (ComponentCache)o;
            System.Collections.Generic.List <ComponentCache.Dropdown_Injection> arg0 = (System.Collections.Generic.List <ComponentCache.Dropdown_Injection>)ToLua.CheckObject(L, 2, typeof(System.Collections.Generic.List <ComponentCache.Dropdown_Injection>));
            obj.dropdownList = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index dropdownList on a nil value"));
        }
    }
Example #31
0
    static int set_value(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            ComponentCache.Injection <ComponentCache> obj = (ComponentCache.Injection <ComponentCache>)o;
            ComponentCache arg0 = (ComponentCache)ToLua.CheckObject <ComponentCache>(L, 2);
            obj.value = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index value on a nil value"));
        }
    }
    public void Modify(GameObject entity, ZDO entityZdo)
    {
        if (ExtraEffect is null)
        {
            return;
        }

        var character = ComponentCache.Get <Character>(entity);

        if (character is null)
        {
            return;
        }

        Log.LogTrace($"Setting extra effect '{ExtraEffect}' for '{entity.name}'.");
        API.SetExtraEffectCreature(character, ExtraEffect.Value);
    }
Example #33
0
 BaseTypeWalker(ComponentCache componentCache)
 {
     cache = componentCache ?? new ComponentCache();
 }