-
Notifications
You must be signed in to change notification settings - Fork 0
/
LivesPlayer_Lives.cs
47 lines (34 loc) · 1 KB
/
LivesPlayer_Lives.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
using Lives.NetProtocols;
using Terraria;
using Terraria.ModLoader;
namespace Lives {
partial class LivesPlayer : ModPlayer {
public bool AddLives( int lives ) {
var config = LivesConfig.Instance;
if( ( this.Lives + lives ) > config.MaxLives ) {
lives = config.MaxLives - this.Lives;
} else if( ( this.Lives + lives ) < 0 ) {
lives = -this.Lives;
}
this.Lives += lives;
this.UpdateMortality();
return true;
}
////////////////
public void ApplyDeathNonFinal() {
if( this.OriginalDifficulty == 2 ) { // Hardcore? Guess we're just dead, then.
return;
}
this.player.difficulty = this.OriginalDifficulty;
if( Main.netMode == 1 && this.player.whoAmI == Main.myPlayer ) {
DifficultyChangeProtocol.SendToServer( this.OriginalDifficulty );
}
}
public void ApplyDeathFinal() {
this.player.difficulty = 2; // Set hardcore
if( Main.netMode == 1 && this.player.whoAmI == Main.myPlayer ) {
DifficultyChangeProtocol.SendToServer( 2 );
}
}
}
}