Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
direwolf420 committed May 15, 2020
1 parent 033ddec commit f69b29e
Show file tree
Hide file tree
Showing 25 changed files with 83 additions and 93 deletions.
2 changes: 1 addition & 1 deletion Buffs/WyvernCampfireBuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public override void ModifyBuffTip(int type, ref string tip, ref int rare)
{
if (type == BuffID.Campfire && Main.LocalPlayer.GetModPlayer<AssPlayer>().wyvernCampfire)
{
tip += "\nWyvern Campfire nearby" +
tip += "\nWyvern Campfire nearby" +
"\nYou are protected from Wyverns" +
"\nHarpy feathers don't knock you away";
}
Expand Down
122 changes: 61 additions & 61 deletions Effects/ShaderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,75 @@

namespace AssortedCrazyThings.Effects
{
/// <summary>
/// Responsible for dealing with shaders
/// </summary>
public static class ShaderManager
{
public static Effect CircleEffect { get; private set; }
/// <summary>
/// Responsible for dealing with shaders
/// </summary>
public static class ShaderManager
{
public static Effect CircleEffect { get; private set; }

public static Effect SetupCircleEffect(Vector2 center, int radius, Color edgeColor, Color bodyBolor = default)
{
Effect circle = CircleEffect;
if (circle != null)
{
circle.Parameters["ScreenPos"].SetValue(Main.screenPosition);
circle.Parameters["ScreenDim"].SetValue(new Vector2(Main.screenWidth, Main.screenHeight));
circle.Parameters["EntCenter"].SetValue(center);
circle.Parameters["EdgeColor"].SetValue(edgeColor.ToVector4());
circle.Parameters["BodyColor"].SetValue((bodyBolor == default ? Color.Transparent : bodyBolor).ToVector4());
circle.Parameters["Radius"].SetValue(radius);
circle.Parameters["HpPercent"].SetValue(1f);
circle.Parameters["ShrinkResistScale"].SetValue(1f / 24f);
}
return circle;
}
public static Effect SetupCircleEffect(Vector2 center, int radius, Color edgeColor, Color bodyBolor = default)
{
Effect circle = CircleEffect;
if (circle != null)
{
circle.Parameters["ScreenPos"].SetValue(Main.screenPosition);
circle.Parameters["ScreenDim"].SetValue(new Vector2(Main.screenWidth, Main.screenHeight));
circle.Parameters["EntCenter"].SetValue(center);
circle.Parameters["EdgeColor"].SetValue(edgeColor.ToVector4());
circle.Parameters["BodyColor"].SetValue((bodyBolor == default ? Color.Transparent : bodyBolor).ToVector4());
circle.Parameters["Radius"].SetValue(radius);
circle.Parameters["HpPercent"].SetValue(1f);
circle.Parameters["ShrinkResistScale"].SetValue(1f / 24f);
}
return circle;
}

public static void ApplyToScreenOnce(SpriteBatch spriteBatch, Effect effect, bool restore = true)
{
if (effect == null) return;
public static void ApplyToScreenOnce(SpriteBatch spriteBatch, Effect effect, bool restore = true)
{
if (effect == null) return;

//Apply the shader to the spritebatch from now on
StartEffectOnSpriteBatch(spriteBatch, effect);
//Apply the shader to the spritebatch from now on
StartEffectOnSpriteBatch(spriteBatch, effect);

DrawEmptyCanvasToScreen(spriteBatch);
DrawEmptyCanvasToScreen(spriteBatch);

//Normally you want to apply the shader once, and restore. This is for when you repeatedly apply a different effect without restoring vanilla
if (restore)
{
//Stop applying the shader, continue normal behavior
RestoreVanillaSpriteBatchSettings(spriteBatch);
}
}
//Normally you want to apply the shader once, and restore. This is for when you repeatedly apply a different effect without restoring vanilla
if (restore)
{
//Stop applying the shader, continue normal behavior
RestoreVanillaSpriteBatchSettings(spriteBatch);
}
}

public static void StartEffectOnSpriteBatch(SpriteBatch spriteBatch, Effect effect)
{
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, effect, Main.GameViewMatrix.TransformationMatrix);
}
public static void StartEffectOnSpriteBatch(SpriteBatch spriteBatch, Effect effect)
{
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, effect, Main.GameViewMatrix.TransformationMatrix);
}

public static void DrawEmptyCanvasToScreen(SpriteBatch spriteBatch)
{
spriteBatch.Draw(Main.magicPixel, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Transparent);
}
public static void DrawEmptyCanvasToScreen(SpriteBatch spriteBatch)
{
spriteBatch.Draw(Main.magicPixel, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Transparent);
}

public static void RestoreVanillaSpriteBatchSettings(SpriteBatch spriteBatch)
{
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
public static void RestoreVanillaSpriteBatchSettings(SpriteBatch spriteBatch)
{
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}

public static void Load()
{
if (Main.netMode != NetmodeID.Server)
{
CircleEffect = AssUtils.Instance.GetEffect("Effects/CircleShader/Circle");
}
}
public static void Load()
{
if (Main.netMode != NetmodeID.Server)
{
CircleEffect = AssUtils.Instance.GetEffect("Effects/CircleShader/Circle");
}
}

public static void Unload()
{
CircleEffect = null;
}
}
public static void Unload()
{
CircleEffect = null;
}
}
}
6 changes: 3 additions & 3 deletions Items/CaughtDungeonSoul.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using AssortedCrazyThings.Base;
using AssortedCrazyThings.Base;
using AssortedCrazyThings.NPCs.DungeonBird;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Linq;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
Expand Down
1 change: 0 additions & 1 deletion Items/ChunkysEye.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Terraria.ID;
using Terraria.ModLoader;

namespace AssortedCrazyThings.Items
Expand Down
1 change: 0 additions & 1 deletion Items/DesiccatedLeather.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AssortedCrazyThings.Items
Expand Down
2 changes: 1 addition & 1 deletion Items/DroneUnlockables/DroneUnlockable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class DroneRecipe : ModRecipe
{
public DroneType UnlockedType;

public DroneRecipe(Mod mod, DroneType unlockedType): base(mod)
public DroneRecipe(Mod mod, DroneType unlockedType) : base(mod)
{
UnlockedType = unlockedType;
}
Expand Down
1 change: 0 additions & 1 deletion Items/Gitgud/GitgudItem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AssortedCrazyThings.Items.Gitgud
Expand Down
4 changes: 2 additions & 2 deletions Items/IdolOfDecay.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Linq;
using AssortedCrazyThings.Base;
using AssortedCrazyThings.Base;
using AssortedCrazyThings.NPCs.DungeonBird;
using System.Linq;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
Expand Down
1 change: 0 additions & 1 deletion Items/MeatballsEye.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Terraria.ID;
using Terraria.ModLoader;

namespace AssortedCrazyThings.Items
Expand Down
3 changes: 1 addition & 2 deletions Items/Weapons/EverhallowedLantern.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using AssortedCrazyThings.Base;
using AssortedCrazyThings.Buffs;
using AssortedCrazyThings.Buffs;
using AssortedCrazyThings.Projectiles.Minions.CompanionDungeonSouls;
using AssortedCrazyThings.UI;
using Microsoft.Xna.Framework;
Expand Down
3 changes: 2 additions & 1 deletion Items/Weapons/SlimeHandlerKnapsack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ namespace AssortedCrazyThings.Items.Weapons
{
public class SlimeHandlerKnapsack : MinionItemBase
{
public static CircleUIConf GetUIConf() {
public static CircleUIConf GetUIConf()
{
List<string> textureNames = new List<string>() {
AssUtils.Instance.Name + "/Projectiles/Minions/SlimePackMinions/SlimeMinionPreview",
AssUtils.Instance.Name + "/Projectiles/Minions/SlimePackMinions/SlimeMinionAssortedPreview",
Expand Down
1 change: 0 additions & 1 deletion NPCs/ChunkysEye.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
Expand Down
2 changes: 1 addition & 1 deletion NPCs/CuteSlimes/CuteSlimeBaseNPC.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.IO;
using AssortedCrazyThings.Base;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
Expand Down
1 change: 0 additions & 1 deletion NPCs/MeatballsEye.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
Expand Down
1 change: 0 additions & 1 deletion Projectiles/Minions/Drones/HealingDrone.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using AssortedCrazyThings.Base;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;

Expand Down
2 changes: 1 addition & 1 deletion Projectiles/Minions/Drones/HeavyLaserDrone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private Vector2 BarrelPos

private bool CanOverlay => ChargeTimer >= AnimationDuration && (projectile.frame == 3 || projectile.frame == 7);

private float OverlayOpacity => (ChargeTimer - AnimationDuration) / (float) byte.MaxValue;
private float OverlayOpacity => (ChargeTimer - AnimationDuration) / (float)byte.MaxValue;

private bool playedOverheatSound = false;

Expand Down
3 changes: 1 addition & 2 deletions Projectiles/Minions/Drones/ShieldDrone.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using AssortedCrazyThings.Base;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;

Expand Down Expand Up @@ -150,7 +149,7 @@ protected override void CustomAI()

if (CanShield)
{
Vector2 shootOffset = new Vector2(0 , sinY);
Vector2 shootOffset = new Vector2(0, sinY);
Vector2 shootOrigin = projectile.Center + shootOffset;
Vector2 target = player.MountedCenter + new Vector2(0f, -5f);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public override void AI()
{
dustType = ModContent.DustType<GlitterDust57>();
}
else if(dustType == 2)
else if (dustType == 2)
{
dustType = ModContent.DustType<GlitterDust58>();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using AssortedCrazyThings.Base;
using AssortedCrazyThings.Dusts;
using AssortedCrazyThings.Dusts;
using AssortedCrazyThings.Items.Weapons;
using AssortedCrazyThings.Projectiles.Pets;
using Microsoft.Xna.Framework;
Expand Down
2 changes: 1 addition & 1 deletion Projectiles/Pets/PetEaterOfWorlds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override void SetStaticDefaults()

public override void SetDefaults()
{
AssAI.StardustDragonSetDefaults(projectile,size: HITBOX_SIZE, minion: false);
AssAI.StardustDragonSetDefaults(projectile, size: HITBOX_SIZE, minion: false);
projectile.alpha = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion Projectiles/Pets/PetGoldfishProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
if (Main.hasFocus) GetFrame();

lightColor = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16), Color.White);
SpriteEffects effects = projectile.direction != -1 ? SpriteEffects.FlipHorizontally: SpriteEffects.None;
SpriteEffects effects = projectile.direction != -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
PetPlayer mPlayer = projectile.GetOwner().GetModPlayer<PetPlayer>();
Texture2D image = mod.GetTexture("Projectiles/Pets/PetGoldfishProj_" + mPlayer.petGoldfishType);
Rectangle bounds = new Rectangle();
Expand Down
2 changes: 1 addition & 1 deletion Projectiles/Weapons/GuideVoodoorangProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override void PostAI()
{
if (Main.netMode == NetmodeID.Server)
{
NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, i, 9999f, 10f,-Main.npc[i].direction);
NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, i, 9999f, 10f, -Main.npc[i].direction);
}
Main.npc[i].StrikeNPCNoInteraction(9999, 10f, -Main.npc[i].direction);
NPC.SpawnWOF(projectile.position);
Expand Down
1 change: 0 additions & 1 deletion Tiles/SlimeBeaconTile.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using AssortedCrazyThings.Items.Placeable;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
Expand Down
3 changes: 2 additions & 1 deletion Tiles/VanityDresserTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace AssortedCrazyThings.Tiles
{
public class VanityDresserTile : ModTile
{
public override void SetDefaults() {
public override void SetDefaults()
{
Main.tileSolidTop[Type] = true;
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
Expand Down
5 changes: 2 additions & 3 deletions UI/HoverNPCUI.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using AssortedCrazyThings.Base;
using AssortedCrazyThings.NPCs;
using AssortedCrazyThings.NPCs;
using AssortedCrazyThings.NPCs.DungeonBird;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameInput;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.UI;
using Terraria.UI.Chat;
using Terraria.ID;

namespace AssortedCrazyThings.UI
{
Expand Down

0 comments on commit f69b29e

Please sign in to comment.