-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using HEROsMod.UIKit; | ||
using HEROsMod.UIKit.UIComponents; | ||
using Microsoft.Xna.Framework; | ||
using System; | ||
using Terraria; | ||
using Terraria.ModLoader; | ||
|
||
namespace HEROsMod.HEROsModServices | ||
{ | ||
/// <summary> | ||
/// A service that hacks the lighting values for the player | ||
/// </summary> | ||
class LightHack : HEROsModService | ||
{ | ||
internal static int LightStrength; | ||
internal static float[] LightStrengthValues = new float[] { 0, .25f, .5f, 1f }; | ||
private static string[] LightStrengthStrings = new string[] { "LightHack: Disabled", "LightHack: 25%", "LightHack: 50%", "LightHack: 100%" }; | ||
|
||
public LightHack(UIHotbar hotbar) | ||
{ | ||
IsInHotbar = true; | ||
HotbarParent = hotbar; | ||
this._name = "Light Hack"; | ||
this._hotbarIcon = new UIImage(HEROsMod.instance.GetTexture("Images/lighthack")); | ||
this._hotbarIcon.onLeftClick += (s, e) => | ||
{ | ||
buttonLogic(true); | ||
}; | ||
this._hotbarIcon.onRightClick += (s, e) => | ||
{ | ||
buttonLogic(false); | ||
}; | ||
this.HotbarIcon.Tooltip = LightStrengthStrings[LightStrength]; | ||
_hotbarIcon.Opacity = 0.5f; | ||
} | ||
|
||
public override void MyGroupUpdated() | ||
{ | ||
this.HasPermissionToUse = HEROsModNetwork.LoginService.MyGroup.HasPermission("LightHack"); | ||
} | ||
|
||
public void buttonLogic(bool leftMouse) | ||
{ | ||
LightStrength = leftMouse ? (LightStrength + 1) % LightStrengthStrings.Length : (LightStrength + LightStrengthStrings.Length - 1) % LightStrengthStrings.Length; | ||
HotbarIcon.Tooltip = LightStrengthStrings[LightStrength]; | ||
_hotbarIcon.Opacity = (LightStrengthValues[LightStrength] + 1f) / 2; | ||
} | ||
} | ||
|
||
public class LightHackGlobalWall : GlobalWall | ||
{ | ||
public override void ModifyLight(int i, int j, int type, ref float r, ref float g, ref float b) | ||
{ | ||
if (LightHack.LightStrength > 0) | ||
{ | ||
r = MathHelper.Clamp(r + LightHack.LightStrengthValues[LightHack.LightStrength], 0, 1); | ||
g = MathHelper.Clamp(g + LightHack.LightStrengthValues[LightHack.LightStrength], 0, 1); | ||
b = MathHelper.Clamp(b + LightHack.LightStrengthValues[LightHack.LightStrength], 0, 1); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters