-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.cs
60 lines (52 loc) · 2.04 KB
/
Player.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
using System;
using Microsoft.Xna.Framework;
using SpawnHouses.Structures;
using SpawnHouses.Structures.Structures;
using Terraria;
using Terraria.ModLoader;
namespace SpawnHouses;
public class Player : ModPlayer
{
public override void OnEnterWorld()
{
if (ModHelper.ErrorLoadingMS)
Main.NewText("Generated Houses had an issue loading Magic Storage content, so Magic Storage features in Generated Houses are disabled. Please contact the author about this issue!", Color.Red);
}
private int _frameCounter = 0;
public override void PostUpdate()
{
_frameCounter++;
if (_frameCounter >= 16)
{
_frameCounter = 0;
int x = (int)Player.Center.X / 16;
int y = (int)Player.Center.Y / 16;
if (SpawnHousesSystem.MainBasement is not null && SpawnHousesSystem.MainBasement.Status == StructureStatus.GeneratedButNotFound)
{
if (
x > SpawnHousesSystem.MainBasement.EntryPosX - 7
&& x < SpawnHousesSystem.MainBasement.EntryPosX + 7
&& y > SpawnHousesSystem.MainBasement.EntryPosY + 6
&& y < SpawnHousesSystem.MainBasement.EntryPosY + 20
)
{
SpawnHousesSystem.MainBasement.OnFound();
}
}
if (SpawnHousesSystem.BeachHouse is not null && SpawnHousesSystem.BeachHouse.Status == StructureStatus.GeneratedButNotFound)
{
int houseCenterX = SpawnHousesSystem.BeachHouse.X + BeachHouse._structureXSize / 2;
int houseCenterY = SpawnHousesSystem.BeachHouse.Y + BeachHouse._structureYSize / 2;
if (
x > houseCenterX - 70
&& x < houseCenterX + 70
&& y > houseCenterY - 44
&& y < houseCenterY + 44
)
{
SpawnHousesSystem.BeachHouse.OnFound();
}
}
}
}
}