Compare commits

...

3 commits

13 changed files with 168 additions and 20 deletions

View file

@ -0,0 +1,18 @@
using continuity.Content.Tiles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
namespace continuity.Content.Items.Materials
{
public class Coal : ModItem
{
public override void SetDefaults()
{
Item.DefaultToPlaceableTile(ModContent.TileType<CoalTile>());
}
}
}

View file

@ -2,7 +2,7 @@ using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Continuity.Content.Items
namespace Continuity.Content.Items.Materials
{
public class ExquisiteGel : ModItem
{

View file

@ -2,7 +2,7 @@ using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Continuity.Content.Items
namespace Continuity.Content.Items.Materials
{
public class PalishadeTissue : ModItem
{

View file

@ -1,4 +1,5 @@
using Continuity.Content.Items;
using Continuity.Content.Items.Materials;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
@ -9,7 +10,7 @@ using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace continuity.Content.Items
namespace continuity.Content.Items.Weapons
{
public class Geltana : ModItem
{

View file

@ -5,6 +5,7 @@ using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameContent.ItemDropRules;
using Continuity.Content.Items;
using Continuity.Content.Items.Materials;
namespace Continuity.Content
{

View file

@ -2,6 +2,7 @@ using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Continuity.Content.Items;
using Continuity.Content.Items.Materials;
namespace Continuity.Content
{

View file

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ID;
using Terraria;
using Terraria.IO;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.WorldBuilding;
using continuity.Content.Tiles;
namespace continuity.Content.Systems
{
public class WorldGenSystem : ModSystem
{
public static LocalizedText CoalGenMessage { get; private set; }
public override void SetStaticDefaults()
{
CoalGenMessage = Language.GetOrRegister(Mod.GetLocalizationKey($"WorldGen.{nameof(CoalGenMessage)}"));
}
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref double totalWeight)
{
int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));
if (ShiniesIndex != -1)
{
tasks.Insert(ShiniesIndex + 1, new CoalGenPass("Adding Coal to the surface layer of the world", 100));
}
}
}
public class CoalGenPass : GenPass
{
public CoalGenPass(string name, float loadWeight) : base(name, loadWeight) { }
protected override void ApplyPass(GenerationProgress progress, GameConfiguration configuration)
{
progress.Message = WorldGenSystem.CoalGenMessage.Value;
for (int k = 0; k < (int)((Main.maxTilesX * Main.maxTilesY) * 1E-03); k++)
{
int x = WorldGen.genRand.Next(0, Main.maxTilesX);
int y = WorldGen.genRand.Next((int)GenVars.rockLayerHigh, Main.maxTilesY);
WorldGen.OreRunner(x, y, 8, 2, (ushort)ModContent.TileType<CoalTile>());
}
}
}
}

35
Content/Tiles/CoalTile.cs Normal file
View file

@ -0,0 +1,35 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.WorldBuilding;
namespace continuity.Content.Tiles
{
public class CoalTile : ModTile
{
public override void SetStaticDefaults()
{
TileID.Sets.Ore[Type] = true;
Main.tileSpelunker[Type] = true; // The tile will be affected by spelunker highlighting
Main.tileMergeDirt[Type] = true;
Main.tileSolid[Type] = true;
Main.tileBlockLight[Type] = true;
Main.tileLavaDeath[Type] = true;
LocalizedText name = CreateMapEntryName();
AddMapEntry(new Color(55, 51, 52), name);
DustType = 84;
HitSound = SoundID.Tink;
}
}
}

View file

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View file

@ -21,4 +21,12 @@ Items: {
'''
DisplayName: Geltana
}
Coal: {
DisplayName: Coal
Tooltip: ""
}
}
Tiles.CoalTile.MapEntry: Coal
WorldGen.CoalGenMessage: "Industrializing the World"

View file

@ -1,16 +1,16 @@
{
"profiles": {
"Terraria": {
"commandName": "Executable",
"executablePath": "/etc/profiles/per-user/devraza/bin/dotnet",
"commandLineArgs": "$(tMLPath)",
"workingDirectory": "$(tMLSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
"executablePath": "/etc/profiles/per-user/devraza/bin/dotnet",
"commandLineArgs": "$(tMLServerPath)",
"workingDirectory": "$(tMLSteamPath)"
}
}
"profiles": {
"Terraria": {
"commandName": "Executable",
"executablePath": "$(DotNetName)",
"commandLineArgs": "$(tMLPath)",
"workingDirectory": "$(tMLSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
"executablePath": "/etc/profiles/per-user/devraza/bin/dotnet",
"commandLineArgs": "$(tMLServerPath)",
"workingDirectory": "$(tMLSteamPath)"
}
}
}

View file

@ -0,0 +1,33 @@
// DEBUG WorldGen System for testing
using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework.Input;
using Terraria.ID;
using Microsoft.Xna.Framework;
using Terraria.GameContent.Generation;
using continuity.Content.Tiles;
#if DEBUG
namespace continuity.Utilities
{
public class WorldGenWorld : ModSystem
{
public static bool JustPressed(Keys key) {
return Main.keyState.IsKeyDown(key) && !Main.oldKeyState.IsKeyDown(key);
}
public override void PostUpdateWorld() {
if (JustPressed(Keys.D1))
TestMethod((int)Main.MouseWorld.X / 16, (int)Main.MouseWorld.Y / 16);
}
// implement whatever test code you want here.
private void TestMethod(int x, int y) {
Dust.QuickBox(new Vector2(x, y) * 16, new Vector2(x + 1, y + 1) * 16, 2, Color.YellowGreen, null);
// Code to test placed here:
WorldGen.OreRunner(x, y, 8, 2, (ushort)ModContent.TileType<CoalTile>());
}
}
}
#endif

View file

@ -9,8 +9,5 @@
</PropertyGroup>
<!-- References -->
<ItemGroup>
</ItemGroup>
</Project>