-
Notifications
You must be signed in to change notification settings - Fork 1
/
VinesWorld.cs
114 lines (102 loc) · 3.79 KB
/
VinesWorld.cs
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameContent.Generation;
using Terraria.World.Generation;
using System.Collections.Generic;
using System;
using Terraria.ModLoader.IO;
using System.IO;
namespace VinesMod
{
public class VinesWorld : ModWorld
{
public static int biomeTiles = 0;
// Stuff added with the Boss
public static bool downedBlueEyeBoss = false;
public static bool downedRedBrainBoss = false;
public static bool downedGreenBeeBoss = false;
public static bool downedPurpleSlimeBoss = false;
public static bool downedYellowIchorBoss = false;
public static bool downedWhiteFlyingFishBoss = false;
public override void Initialize()
{
downedBlueEyeBoss = false;
downedRedBrainBoss = false;
downedGreenBeeBoss = false;
downedPurpleSlimeBoss = false;
downedYellowIchorBoss = false;
downedWhiteFlyingFishBoss = false;
}
public override TagCompound Save()
{
var downed = new List<string>();
if (downedBlueEyeBoss) downed.Add("BlueEye");
if (downedRedBrainBoss) downed.Add("RedBrain");
if (downedGreenBeeBoss) downed.Add("GreenBee");
if (downedPurpleSlimeBoss) downed.Add("PurpleSlime");
if (downedYellowIchorBoss) downed.Add("YellowIchor");
if (downedWhiteFlyingFishBoss) downed.Add("WhiteFlyingFish");
return new TagCompound
{
{"downed", downed }
};
}
public override void Load(TagCompound tag)
{
var downed = tag.GetList<string>("downed");
downedBlueEyeBoss = downed.Contains("BlueEye");
downedRedBrainBoss = downed.Contains("RedBrain");
downedGreenBeeBoss = downed.Contains("GreenBee");
downedPurpleSlimeBoss = downed.Contains("PurpleSlime");
downedYellowIchorBoss = downed.Contains("YellowIchor");
downedWhiteFlyingFishBoss = downed.Contains("WhiteFlyingFish");
}
public override void LoadLegacy(BinaryReader reader)
{
int loadVersion = reader.ReadInt32();
if(loadVersion == 0)
{
BitsByte flags = reader.ReadByte();
downedBlueEyeBoss = flags[0];
downedRedBrainBoss = flags[1];
downedGreenBeeBoss = flags[2];
downedPurpleSlimeBoss = flags[3];
downedYellowIchorBoss = flags[4];
downedWhiteFlyingFishBoss = flags[5];
}
}
public override void NetSend(BinaryWriter writer)
{
BitsByte flags = new BitsByte();
flags[0] = downedBlueEyeBoss;
flags[1] = downedRedBrainBoss;
flags[2] = downedGreenBeeBoss;
flags[3] = downedPurpleSlimeBoss;
flags[4] = downedYellowIchorBoss;
flags[5] = downedWhiteFlyingFishBoss;
writer.Write(flags);
}
public override void NetReceive(BinaryReader reader)
{
BitsByte flags = reader.ReadByte();
downedBlueEyeBoss = flags[0];
downedRedBrainBoss = flags[1];
downedGreenBeeBoss = flags[2];
downedPurpleSlimeBoss = flags[3];
downedYellowIchorBoss = flags[4];
downedWhiteFlyingFishBoss = flags[5];
}
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
{
//not going to mess with world gen
}
public override void TileCountsAvailable(int[] tileCounts)
{
}
public override void ResetNearbyTileEffects()
{
biomeTiles = 0;
}
}
}