-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomCampfire.cs
More file actions
80 lines (66 loc) · 2.19 KB
/
CustomCampfire.cs
File metadata and controls
80 lines (66 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine;
using Verse;
namespace RC.Rimgazer
{
class CustomCampfire : Building_Campfire
{
static int state = -1;
Region bound = null;
//private static Graphic FireGraphic = GraphicDatabase.Get_Flicker("Things/Special/Fire", ShaderDatabase.MotePostLight, false, Color.blue);
public override void Destroy(DestroyMode mode = DestroyMode.Vanish)
{
base.Destroy(mode);
if (this.bound != null)
this.bound.valid = false;
}
public override void SpawnSetup()
{
if (this.def.Equals(ThingDef.Named("Campfire_ex_B")))
Log.Error("CAMPFIRE B");
if (state == 8)
{
base.SpawnSetup();
return;
}
this.DeSpawn();
state = 8;
Thing tg = GenSpawn.Spawn(ThingMaker.MakeThing(ThingDef.Named("Campfire_ex_B")), this.Position);
tg.SetFactionDirect(Faction.OfColony);
IntVec3 TMP = this.Position;
TMP.x -= 2;
TMP.z -= 2;
Room ttz = Room.MakeNew();
Region ttx = Region.MakeNewUnfilled(TMP);
((CustomCampfire)tg).bound = ttx;
ttx.Room = ttz;
int x = TMP.x;
int z = TMP.z;
int ssz = 0;
while (true)
{
//Find.RegionGrid.SetRegionAt(new IntVec3(x + (ssz % 5),0,z + (ssz / 5)), ttx);
ssz++;
if (ssz > 24)
break;
}
//ttx.extentsClose.maxX = TMP.x + 4;
//ttx.extentsClose.maxZ = TMP.z + 4;
FieldInfo myFieldInfo =
typeof(Room).GetField("cachedOpenRoofCount",BindingFlags.NonPublic | BindingFlags.Instance);
//myFieldInfo.SetValue(ttz, 0);
tg.SpawnSetup();
state = -3;
}
public override void DrawAt(Vector3 drawLoc)
{
base.DrawAt(drawLoc);
//FireGraphic.Draw(drawLoc, IntRot.north, this);
}
}
}