Example #1
0
 public void Init()
 {
     if (this.verb == null)
     {
         this.verb = (Abilities.Verb_CastAbility)Activator.CreateInstance(this.def.verbProperties.verbClass);
     }
     this.verb.loadID      = this.GetUniqueLoadID() + "_Verb";
     this.verb.verbProps   = this.def.verbProperties;
     this.verb.verbTracker = this.pawn?.verbTracker;
     this.verb.caster      = this.pawn;
     this.verb.ability     = this;
     this.autoCast         = this.def.autocastPlayerDefault;
 }
Example #2
0
        public virtual void ExposeData()
        {
            Scribe_References.Look(ref this.pawn, nameof(this.pawn));
            Scribe_Values.Look(ref this.cooldown, nameof(this.cooldown));
            Scribe_Defs.Look(ref this.def, nameof(this.def));
            Scribe_Deep.Look(ref this.verb, nameof(this.verb));
            Scribe_Values.Look(ref this.autoCast, nameof(this.autoCast));

            if (Scribe.mode == LoadSaveMode.PostLoadInit)
            {
                if (this.verb == null) // no idea how the hell that happens
                {
                    this.verb = (Abilities.Verb_CastAbility)Activator.CreateInstance(this.def.verbProperties.verbClass);
                }

                this.verb.loadID      = this.GetUniqueLoadID() + "_Verb";
                this.verb.verbProps   = this.def.verbProperties;
                this.verb.verbTracker = this.pawn?.verbTracker;
                this.verb.caster      = this.pawn;
                this.verb.ability     = this;
            }
        }