// Verse.GhostDrawer public static bool HeronDoorGhostHandler(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude) { if (thingDef is DoorExpandedDef def && def.fixedPerspective) { Graphic graphic = GhostUtility.GhostGraphicFor(baseGraphic, thingDef, ghostCol); //Graphic graphic = Traverse.Create(typeof(GhostDrawer)).Method("GhostGraphicFor", new object[] { thingDef.graphic, thingDef, ghostCol }).GetValue<Graphic>(); Vector3 loc = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor()); for (int i = 0; i < 2; i++) { bool flipped = (i != 0) ? true : false; Building_DoorExpanded.DrawParams(def, loc, rot, out var mesh, out var matrix, mod: 0, flipped: flipped); Graphics.DrawMesh(mesh: mesh, matrix: matrix, material: graphic.MatAt(rot: rot, thing: null), layer: 0); } if (thingDef?.PlaceWorkers?.Count > 0) { for (int i = 0; i < thingDef.PlaceWorkers.Count; i++) { thingDef.PlaceWorkers[index : i] .DrawGhost(def : thingDef, center : center, rot : rot, ghostCol : ghostCol); } } return(false); } return(true); }
// Verse.GhostDrawer public static bool HeronDoorGhostHandler(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude) { if (thingDef is DoorExpandedDef def && def.fixedPerspective) { //Log.Message("1"); Graphic graphic = (Graphic)AccessTools.Method(typeof(GhostDrawer), "GhostGraphicFor").Invoke(null, new object[] { thingDef.graphic, thingDef, ghostCol }); //Log.Message("2"); Vector3 loc = Gen.TrueCenter(center, rot, thingDef.Size, Altitudes.AltitudeFor(drawAltitude)); for (int i = 0; i < 2; i++) { bool flipped = (i != 0) ? true : false; Mesh mesh; Matrix4x4 matrix; Building_DoorExpanded.DrawParams(def, loc, rot, out mesh, out matrix, 0, flipped); Graphics.DrawMesh(mesh, matrix, graphic.MatAt(rot, null), 0); } if (thingDef.PlaceWorkers != null) { for (int i = 0; i < thingDef.PlaceWorkers.Count; i++) { thingDef.PlaceWorkers[i].DrawGhost(thingDef, center, rot); } } return(false); } return(true); }