This repository has been archived by the owner on Nov 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added FloorGraphicExtension and ThingWithFloorGraphic classes
- Loading branch information
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
using Verse.AI; | ||
using VFE.Mechanoids; | ||
using VFE.Mechanoids.Needs; | ||
|
||
namespace VFECore | ||
{ | ||
public class FloorGraphicExtension : DefModExtension | ||
{ | ||
public GraphicData graphicData; | ||
public override IEnumerable<string> ConfigErrors() | ||
{ | ||
graphicData.ResolveReferencesSpecial(); | ||
return base.ConfigErrors(); | ||
} | ||
} | ||
public class ThingWithFloorGraphic : ThingWithComps | ||
{ | ||
public Graphic graphicIntOverride; | ||
public Graphic FloorGraphic(FloorGraphicExtension floorGraphicExtension) | ||
{ | ||
if (graphicIntOverride == null) | ||
{ | ||
if (floorGraphicExtension.graphicData == null) | ||
{ | ||
return BaseContent.BadGraphic; | ||
} | ||
graphicIntOverride = floorGraphicExtension.graphicData.GraphicColoredFor(this); | ||
} | ||
return graphicIntOverride; | ||
} | ||
public override Graphic Graphic | ||
{ | ||
get | ||
{ | ||
var extension = this.def.GetModExtension<FloorGraphicExtension>(); | ||
if (extension != null) | ||
{ | ||
return FloorGraphic(extension); | ||
} | ||
return base.Graphic; | ||
} | ||
} | ||
} | ||
} |