-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTestItem.cs
More file actions
130 lines (115 loc) · 4.18 KB
/
TestItem.cs
File metadata and controls
130 lines (115 loc) · 4.18 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using InnoVault.Actors;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace InnoVault
{
#if DEBUG
internal class TestItem : ModItem
{
public override string Texture => "InnoVault/icon";
public override bool IsLoadingEnabled(Mod mod) {
return true;
}
public override void SetDefaults() {
Item.width = 80;
Item.height = 80;
Item.damage = 9999;
Item.DamageType = DamageClass.Default;
Item.useAnimation = Item.useTime = 13;
Item.useTurn = true;
Item.useStyle = ItemUseStyleID.Swing;
Item.knockBack = 2.25f;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.shootSpeed = 8f;
Item.shoot = ProjectileID.PurificationPowder;
Item.value = 7;
Item.rare = ItemRarityID.Yellow;
}
public override void UpdateInventory(Player player) {
}
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) {
return false;
}
public override bool AltFunctionUse(Player player) {
return true;
}
public override void HoldItem(Player player) {
}
public override bool? UseItem(Player player) {
if (player.whoAmI != Main.myPlayer) {
return true;
}
////左键:进入石头维度
//if (player.altFunctionUse != 2) {
// if (!DimensionLoader.AnyActive()) {
// //当前在主世界,进入石头维度
// if (DimensionLoader.Enter<StoneDimension>()) {
// VaultUtils.Text("正在进入石头维度...", Color.Cyan);
// }
// else {
// VaultUtils.Text("无法进入石头维度!", Color.Red);
// }
// }
// else {
// VaultUtils.Text("你已经在维度中了!右键退出", Color.Yellow);
// }
//}
////右键:退出维度
//else {
// if (DimensionLoader.AnyActive()) {
// DimensionLoader.Exit();
// VaultUtils.Text("正在退出维度...", Color.Cyan);
// }
// else {
// VaultUtils.Text("你已经在主世界了!", Color.Yellow);
// }
//}
return true;
}
}
internal class TestProj : ModProjectile
{
public override string Texture => "InnoVault/icon";
public override void SetDefaults() {
Projectile.width = Projectile.height = 32;
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.timeLeft = 60;
}
public override void AI() {
if (Projectile.ai[0] == 0 && !VaultUtils.isClient) {
ActorLoader.NewActor<TestActor>(Projectile.Center);
}
Projectile.ai[0]++;
}
}
internal class TestActor : Actor
{
[SyncVar]
public int NumValue;
public override void OnSpawn(params object[] args) {
Width = 100;
Height = 100;
NetUpdate = true;
}
public override void AI() {
if (HitBox.Intersects(Main.MouseWorld.GetRectangle(1))
&& Main.mouseLeft) {
NumValue++;
NetUpdate = true;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, ref Color drawColor) {
Main.spriteBatch.Draw(TextureAssets.Projectile[ModContent.ProjectileType<TestProj>()].Value
, Center - Main.screenPosition, null, Color.Red, 0, Velocity, 1f, SpriteEffects.None, 0);
Utils.DrawBorderString(spriteBatch, $"NumValue: {NumValue}", Center - Main.screenPosition + new Vector2(0, 40), Color.White);
return false;
}
}
#endif
}