1. So far I've been able to use the hooks in oxide as well as setting/getting variables of objects/entities, but is there a way to catch when an instance variable/list in an entity changes?
    i.e. when an AI helicopter instance's _targetList adds or removes an entry
     
  2. Calytic

    Calytic Community Admin Community Mod

    List does not support notifications for changes.

    You will have to create a timer and compare the current list with a saved version of the list from the last check. In other words, your plugin will have to do the legwork to accomplish this.
     
  3. Alrighty, thanks for the info!
     
  4. You could try ObservableCollection<T> instead of List<T>
    ObservableCollection has a CollectionChanged event which is fired when the collection is being modified.

    Code:
    using System.Collections.ObjectModel;public class MyMemory()
    {
        private ObservableCollection<string> _ocList = new ObservableCollection<string>();    public MyMemory()
        {
         _ocList.CollectionChanged += (sender,  e) => {
                //list changed - an item was added.
                if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
                {
                    //Do what ever you want to do when an item is added here...
                    //the new items are available in e.NewItems
                }
         };
      }
    }
    
    Untested in oxide though.
     
  5. Yeah, sadly unless there's a way to override the var types on objects then I guess I have to use the timer + saved list method.