-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBEPlayer.cs
73 lines (61 loc) · 2.67 KB
/
BEPlayer.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
using System;
using BuilderEssentials.Common;
using BuilderEssentials.Common.Configs;
using BuilderEssentials.Content.Items;
using BuilderEssentials.Content.Items.Accessories;
using BuilderEssentials.Content.UI;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.GameInput;
using Terraria.ModLoader;
namespace BuilderEssentials;
public class BEPlayer : ModPlayer
{
public static Vector2 PointedWorldCoords => Main.MouseWorld;
public static Vector2 PointedScreenCoords => Main.MouseScreen;
public static Vector2 PointedTileCoords => new(Player.tileTargetX, Player.tileTargetY);
public bool InfinitePaint { get; set; }
public bool IsImprovedRulerEquipped { get; set; }
public bool FastPlacement { get; set; }
public bool InfiniteRange { get; set; }
public bool InfinitePlacement { get; set; }
public bool InfinitePickupRange { get; set; }
public ModItem EquippedWrenchInstance { get; set; }
public override void ResetEffects() {
InfinitePaint = IsImprovedRulerEquipped = FastPlacement = InfiniteRange =
InfinitePlacement = InfinitePickupRange = false;
Player.defaultItemGrabRange = 42;
EquippedWrenchInstance = null;
}
public override void ProcessTriggers(TriggersSet triggersSet) {
if (BuilderEssentials.GetInstance().FWIncrease.JustPressed && FillWand.FillSelectionSize < 6)
FillWand.FillSelectionSize++;
if (BuilderEssentials.GetInstance().FWDecrease.JustPressed && FillWand.FillSelectionSize > 1)
FillWand.FillSelectionSize--;
if (BuilderEssentials.GetInstance().UndoPlacement.JustPressed) {
Item heldItem = Main.LocalPlayer.HeldItem;
//Hardcoded.. get a way to bind keybind to an item that's not being held..?
if (heldItem.ModItem is FillWand)
ShapesUIState.GetUIPanel<FillWandPanel>().UndoPlacement();
else if (heldItem.ModItem is ShapesDrawer)
ShapesUIState.GetUIPanel<ShapesDrawerPanel>().UndoPlacement();
}
}
public override void PostUpdate() {
MirrorPlacement.PlayerPostUpdate();
BuildingWrench.DequeueRecipeChanges();
}
public override void PostUpdateEquips() {
if (InfiniteRange) {
Player.tileRangeX += Main.screenWidth / 16 / 2;
Player.tileRangeY += Main.screenHeight / 16 / 2;
Player.blockRange += Main.screenWidth / 16 / 2;
}
if (FastPlacement) {
Player.tileSpeed += 500;
Player.wallSpeed += 500;
}
if (InfinitePickupRange)
Player.defaultItemGrabRange += ModContent.GetInstance<ServerConfig>().InfinitePickupRangeValue;
}
}