-
Notifications
You must be signed in to change notification settings - Fork 0
/
HardToLessHard.cs
110 lines (94 loc) · 3.28 KB
/
HardToLessHard.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
using HardToLessHard.Content.Factions;
using HardToLessHard.Content.Religions;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using System.IO;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
namespace HardToLessHard
{
public enum Biomes
{
DIRT,
length
}
public class HardToLessHard : Mod
{
public static HardToLessHard Instance;
public static BiomeData[] biomes = new BiomeData[] { new BiomeData("Dirt", new int[] {TileID.Dirt}) };
internal enum MessageType : byte
{
SoulPlayerSync
}
public override void Load()
{
Instance = this;
if (Main.netMode != NetmodeID.Server)
{
Filters.Scene["HardToLessHard:BloodScreen"] = new Filter(new ScreenShaderData(new Ref<Effect>(ModContent.Request<Effect>("HardToLessHard/Assets/Effects/BloodScreenF", AssetRequestMode.ImmediateLoad).Value), "BloodScreen"), EffectPriority.VeryHigh);
Filters.Scene["HardToLessHard:BloodScreen"].Load();
}
}
public override void Unload()
{
Instance = null;
}
public override void PostSetupContent()
{
foreach (var i in FactionLoader.factions)
{
foreach (var j in FactionLoader.factions)
{
if (i.Type == j.Type) continue;
ModFaction.SetRelation(i, j, j.DefaultRelation);
}
}
foreach (var d in DeityLoader.deities)
{
Logger.Info("-----------------");
Logger.Info(d.DisplayName);
Logger.Info(d.Name);
}
foreach (var relation in ModFaction.Relations)
{
Logger.Info(relation.Key + " : " + relation.Value);
}
}
// Override this method to handle network packets sent for this mod.
//TODO: Introduce OOP packets into tML, to avoid this god-class level hardcode.
public override void HandlePacket(BinaryReader reader, int whoAmI)
{
MessageType msgType = (MessageType)reader.ReadByte();
switch (msgType)
{
// This message syncs ExampleStatIncreasePlayer.exampleLifeFruits and ExampleStatIncreasePlayer.exampleManaCrystals
case MessageType.SoulPlayerSync:
byte playerNumber = reader.ReadByte();
Common.Players.SoulPlayer soulPlayer = Main.player[playerNumber].GetModPlayer<Common.Players.SoulPlayer>();
soulPlayer.ReceivePlayerSync(reader);
if (Main.netMode == NetmodeID.Server)
{
// Forward the changes to the other clients
soulPlayer.SyncPlayer(-1, whoAmI, false);
}
break;
default:
Logger.WarnFormat("HardToLessHard: Unknown Message type: {0}", msgType);
break;
}
}
}
public struct BiomeData
{
public string name;
public int[] tiles;
public BiomeData(string name, int[] tiles)
{
this.name = name;
this.tiles = tiles;
}
}
}