Caves of Qud

Caves of Qud

WM Extended Mutations [Stable Edition]
Tyrir 1 月 1 日 下午 6:42
World Gen Errors
Encountered this exception during world generation:
Error making heroic: Aloe Fugues -> System.NullReferenceException: Object reference not set to an instance of an object at XRL.World.Parts.Mutation.SerpentineForm.Mutate (XRL.World.GameObject GO, System.Int32 Level) [0x00031] in C:\Program Files (x86)\Steam\steamapps\workshop\content\333640\2198787801\Mutations\Physical\SerpentineForm.cs:76 at XRL.World.Parts.Mutations.AddMutation (XRL.World.Parts.Mutation.BaseMutation NewMutation, System.Int32 Level, System.Boolean Sync) [0x00159] in XRL.World.Parts\Mutations.cs:483 at XRL.World.HeroMaker.MakeHero (XRL.World.GameObject BaseCreature, System.String[] AdditionalBaseTemplates, System.String[] AdditionalSpecializationTemplates, System.Int32 TierOverride, System.String SpecialType) [0x00725] in XRL.World\HeroMaker.cs:174

In SerpentineForm.cs, there are a few places that assume a creature has a Body, resulting in exceptions for creatures like Aloe Fugues above. I see examples on lines 76, 108, and 252.

For example, on line 76
BodyPart firstPart = ParentObject.GetPart<Body>().GetFirstPart(BodyPartType);
should handle the case when GetPart<Body>() returns null. You might do something like:
BodyPart firstPart = ParentObject.GetPart<Body>()?.GetFirstPart(BodyPartType); if (firstPart == null) { // handle null body
or
BodyPart firstPart; var body = ParentObject.GetPart<Body>(); if (body != null) { firstPart = GetFirstPart(BodyPartType)
< >
正在显示第 1 - 3 条,共 3 条留言
Tyrir 1 月 1 日 下午 6:46 
Also just noticed that on line 252 in SerpentineForm.cs,
BodyPart firstPart = this.ParentObject.GetPart<Body>()?.GetFirstPart(this.BodyPartType); SerpentileTail = GameObject.Create("Serpentine Tail"); if (firstPart == null || firstPart.Equipped != SerpentileTail) { firstPart.Equipped?.UnequipAndRemove(); firstPart.Equip(SerpentileTail, Forced: true); }

for the conditional, I think you meant `firstPart != null && firstPart.Equipped != SerpentineTail` ?
Winged_Monotone  [开发者] 1 月 1 日 下午 9:39 
thought I had caught everything, thanks I'll add these to the fixes for the next push
最后由 Winged_Monotone 编辑于; 1 月 1 日 下午 9:39
Winged_Monotone  [开发者] 1 月 1 日 下午 9:43 
引用自 Tyrir
Also just noticed that on line 252 in SerpentineForm.cs,
BodyPart firstPart = this.ParentObject.GetPart<Body>()?.GetFirstPart(this.BodyPartType); SerpentileTail = GameObject.Create("Serpentine Tail"); if (firstPart == null || firstPart.Equipped != SerpentileTail) { firstPart.Equipped?.UnequipAndRemove(); firstPart.Equip(SerpentileTail, Forced: true); }

for the conditional, I think you meant `firstPart != null && firstPart.Equipped != SerpentineTail` ?


Not sure what I am trying to do here actually lol, I am going through the process of removing all the FireEvents and swapping to HandleEvents and i must of overlooked this. I think I was trying to make some kind of catch for when the tail somehow magically gets unequipped.
< >
正在显示第 1 - 3 条,共 3 条留言
每页显示数: 1530 50