From 41e9baff6e28c5836b984c25f91f232145c30218 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Mon, 15 Dec 2025 20:02:38 -0800 Subject: [PATCH] reverted sea gen + readded eutro sand walls --- Items/Placeables/SunkenSea/EutrophicSand.cs | 11 +- Items/Placeables/Walls/EutrophicSandWall.cs | 31 + Items/Placeables/Walls/EutrophicSandWall.png | Bin 0 -> 291 bytes .../Placeables/Walls/EutrophicSandWallSafe.cs | 39 + .../Walls/EutrophicSandWallSafe.png | Bin 0 -> 291 bytes .../Mods.CalamityMod.Items.Placeables.hjson | 10 + Systems/World/WorldgenManagementSystem.cs | 36 +- Walls/EutrophicSandWall.cs | 30 + Walls/EutrophicSandWall.png | Bin 0 -> 6952 bytes Walls/EutrophicSandWallSafe.cs | 18 + Walls/EutrophicSandWallSafe.png | Bin 0 -> 6939 bytes Walls/NavyslateWall.cs | 1 - World/SunkenSea.cs | 3169 ++++------------- 13 files changed, 937 insertions(+), 2408 deletions(-) create mode 100644 Items/Placeables/Walls/EutrophicSandWall.cs create mode 100644 Items/Placeables/Walls/EutrophicSandWall.png create mode 100644 Items/Placeables/Walls/EutrophicSandWallSafe.cs create mode 100644 Items/Placeables/Walls/EutrophicSandWallSafe.png create mode 100644 Walls/EutrophicSandWall.cs create mode 100644 Walls/EutrophicSandWall.png create mode 100644 Walls/EutrophicSandWallSafe.cs create mode 100644 Walls/EutrophicSandWallSafe.png diff --git a/Items/Placeables/SunkenSea/EutrophicSand.cs b/Items/Placeables/SunkenSea/EutrophicSand.cs index c334d3a5d2..6ecae8ffb1 100644 --- a/Items/Placeables/SunkenSea/EutrophicSand.cs +++ b/Items/Placeables/SunkenSea/EutrophicSand.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Projectiles.Typeless; using Terraria.ID; using Terraria.ModLoader; @@ -22,5 +23,13 @@ namespace CalamityMod.Items.Placeables.SunkenSea Item.ammo = AmmoID.Sand; Item.notAmmo = true; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + } } } diff --git a/Items/Placeables/Walls/EutrophicSandWall.cs b/Items/Placeables/Walls/EutrophicSandWall.cs new file mode 100644 index 0000000000..f6249281ec --- /dev/null +++ b/Items/Placeables/Walls/EutrophicSandWall.cs @@ -0,0 +1,31 @@ +using Terraria.ID; +using Terraria.ModLoader; +using WallTiles = CalamityMod.Walls; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class EutrophicSandWall : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + ItemID.Sets.DrawUnsafeIndicator[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + } +} \ No newline at end of file diff --git a/Items/Placeables/Walls/EutrophicSandWall.png b/Items/Placeables/Walls/EutrophicSandWall.png new file mode 100644 index 0000000000000000000000000000000000000000..04e425d8b53d9e480c4a72014703e1e31982eef7 GIT binary patch literal 291 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GGLLkg|>2BR0px{+c z7srr_TYIP4b00DgaR0p2<%lbbtjI14jgrY+eL)3nC~fQOeKVi#(bP$sJ>}-Q+f4r@(;elO6ficvvlIEYJiD=}!16v<&*lYk z!t2$4d^yj=tl1F|xbRu9dE5itM)gfCUs-b4l(ZAqOt6x9U%@Eu#H#hFPqT2^vm5-H z!ul7w(^R7>#MjMp5SCm2UH+ch?Bgae4|3myEZp|HqR~zxIr`v>GFiO~>VERGR-WzU mye|A "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 400; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() + { + Item.width = 12; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 7; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.png b/Items/Placeables/Walls/EutrophicSandWallSafe.png new file mode 100644 index 0000000000000000000000000000000000000000..04e425d8b53d9e480c4a72014703e1e31982eef7 GIT binary patch literal 291 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GGLLkg|>2BR0px{+c z7srr_TYIP4b00DgaR0p2<%lbbtjI14jgrY+eL)3nC~fQOeKVi#(bP$sJ>}-Q+f4r@(;elO6ficvvlIEYJiD=}!16v<&*lYk z!t2$4d^yj=tl1F|xbRu9dE5itM)gfCUs-b4l(ZAqOt6x9U%@Eu#H#hFPqT2^vm5-H z!ul7w(^R7>#MjMp5SCm2UH+ch?Bgae4|3myEZp|HqR~zxIr`v>GFiO~>VERGR-WzU mye|A genpass.Name.Equals("Cactus, Palm Trees, & Coral")); - if (sunkenSeaIndex != -1) + // Sunken sea + int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Settle Liquids Again")); + if (SunkenSeaIndex != -1) { - tasks.Insert(sunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => + tasks.Insert(SunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => { - int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; - int sunkenSeaY = Main.maxTilesY / 2; - - // place each piece of the sunken sea based on the above positons - - // messages intentionally in the "incorrect" order for the player's experience. - // they'll see the OG message first, then subsequent biomes are placed in vertical order. - // it breaks up the 3 minute gen time and makes it more interesting for those who dont tab out while worldgen runs, - // rather than keeping the player in the dark about what's happening. - // it doesn't have to make sense, just be cool for the players :) -ena - //SunkenSea.PlaceBasaltGullyBorderBlend(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; - SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.TimelessShores").Value; - SunkenSea.PlaceRadiantReefs(sunkenSeaX, sunkenSeaY + 110); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.RadiantReefs").Value; - SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 500); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.PolypForest").Value; - SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); - SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); - SunkenSea.PlaceGleamingBurrowsGeodes(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GleamingBurrows").Value; - SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BasaltGully").Value; - //SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); - SunkenSea.PlaceSunkenSeaAmbience(); + + Point ssBottomLeft = new Point(GenVars.UndergroundDesertLocation.Left, Main.maxTilesY - 400); + SunkenSea.Place(ssBottomLeft); })); } diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs new file mode 100644 index 0000000000..9c9f6ff2d6 --- /dev/null +++ b/Walls/EutrophicSandWall.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class EutrophicSandWall : ModWall + { + public override void SetStaticDefaults() + { + DustType = 108; + AddMapEntry(new Color(11, 56, 81)); + } + + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].LiquidAmount == 0 && j < Main.maxTilesY - 205) + { + Main.tile[i, j].Get().LiquidType = LiquidID.Water; + Main.tile[i, j].LiquidAmount = byte.MaxValue; + WorldGen.SquareTileFrame(i, j); + if (Main.dedServ) + NetMessage.sendWater(i, j); + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} \ No newline at end of file diff --git a/Walls/EutrophicSandWall.png b/Walls/EutrophicSandWall.png new file mode 100644 index 0000000000000000000000000000000000000000..1e65f4f49eb66b2195dde3eb8283a29706e762f3 GIT binary patch literal 6952 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 num = fail ? 1 : 3; + } +} \ No newline at end of file diff --git a/Walls/EutrophicSandWallSafe.png b/Walls/EutrophicSandWallSafe.png new file mode 100644 index 0000000000000000000000000000000000000000..b884b458fe8bb09012b22f1a3a0ba62df0ea79be GIT binary patch literal 6939 zcmZ{peLU0q`^Ptt;zTLY4Xg7#6q+d^cMT`qaO5^llbgOO%-xZ@wUei>v_Gd_wG2IJ+(z) zw*m+R+H&Uf2^SCuOb0&KY}yDsp^t{I185TP z5I;3pApW52vG&QiN-{9w-?<2{!!+2gGoBpK(Z-n(?d2D zkMzs)y?+X_{P&^^8G^rkPFRkn(dcTp$Y=7i03&g%a%_sn{<2CTWmzT&j|@T}V$<_( z^4GRc+@g7FEt;Lx&{{=CO-`JtVk9qp`BZ(e1~D9Gc%>Mt-+pcLY2ONLt5>*z5&DUa zzG~@g<}g#)%zG~_&7UOhZl7$Qg$s`6=KR?Rxa?1Al&^dUCxXn?2xRWwVR++597CX* zkBeJ8kfK)m1^g{AV5DN9>hV zW>T1{mFsqw9iv9GU;ilhSz_Wv!742R!_Dq2gTg#Zjk86MK2vLz_$f?E`Fd0T_0e+pSS3a zEON?NSj$X@9RGq+C%Pkar&@61S+GoY6TM68QJ)ob8OFd7xVpoX(4=nNf>P~imZ<_HhpY@wl1!3<|P&fbnur{Da7CsMojDI&eLr4ga`YIOh11Q)zb2 zgK1y-InOqlw>GC2=KyidjSX(KPequ`UT(O`&I#U2O`m)SuRYNih{--)azu^bDsCt1 zSsMR*{1whrApfn9TX5M{X)JBcUTbGI3L!A$FU%h-L|`Ve>r)szDkBAt@NdF;z11tT z{VeRUVb$!JZ2gfd;#%Hp+NF;_i^_CIPJ+N+nb3kuysLr0>ZR0u{_=M|T#M6*VRvnE1gNC2jVr?t35q_RQgR?Xf-;idvhi_$m6D94&6KZKrQ@#NtnbL(jNl zwKbsn$sC0tz5Q=WTB}1yd``zM0GnRHMk5?KcFphCm`B%zsNJ`miqjrv!8Af6= zopw2SV#78NHtk=_D%(we@vJP59kVM*J|Da7gOBug}A0t11Hugoxet9XDHH4zf*ej-P zr*Urkhn2;IzF20Q0+XrS=}w3xT)5#6FQFXar+q**-SGz=0B-o~`h?#q8q$p9qKQYH z@MuEu8uM@*Q=(|lZS|9BL~~^SD!&g-$*1ZRMjD>c!-O^@@dEI^S_La9llZYychJn% zaubZ~EPg@RN(&5x+0J5vTjK7`ZV8*iFn=rK8tt-ITn8eYW{R_q(XH{!!bbQ^v8X#D zb_&9w4TX#~E@y<`HXu2uE`h58J>>2rMk0o^_wAOt<93az?*57diec3P6pHoGy3B z!(z3(@(a3(wRkaXoV?B!I~f@Q2#eZC`0^g;PB|ttk(_ruL8*trK{OYsynCSODiziHM80G51L8UY9pRnMo z0&#OJkG~Di>x6@_veH80{@^4HTab>&BfWZL#;y}u`#6qa;)r>1U{#M*%JG}qdf|9> zR<>?4c6~2C+y=@*NMlAn<%?l${GN4Rq*_HH3nE9=77;q?8#}5R%ZmWYLdC9iOW{jj zBGrjG5*;Y6#!Wzc2*(3^2l9iA4dX;L#BxjX7DB!{BhCD%jZUhkbw}fYo_<6%wKp@9 zvLAoV z$pNLmL%wfMj&hbxcWjB4mFFjKw(OZ#9mp7eIH2wZqvOn}H@nqOeY5&*;yEHHAb-3S z^&?RFmxn;QHk*jB!;T@hjLk#Ipp$FNF_99Z@d6&moM$Uf#@4tBE&yxwO= zYgfIAO__Ykq%-kT*s=dLNsWm7`r69uNl9?i5k^( zO7Ne1Ff1T?HcJUSwyRKvzS9btZ{Vtts<01ggcbU2|Krdbh-I75`N2K(m(S;_+$F)W z4Mid@g&1ewL>wPnJarlO&8YHXg84$mg!#W}F%aw~mnlikuX{D_(C|qsT^W~veR8zY z5>rGWLZs}efg|`CYF2r>0Y5);8u91EabZAKlmn_JSHW$pmV}~sbT1bu1KyI1RzYqm z(pK=w(5eNel{jrVz})-6bZ4(MgW@A>1&prKCy#R~a`oVT-VtwS$pFu^kRp{M(hB2@ zO_Jb}KM&~^+`fNE=)-*y{(b^L><3C0pA3k%@21|X5E`@fs@SLrO~c!ER(-gk z9&1j>m@_*Ck>f;Z3l0 zxL72(8-{*g)Y`FAoiDUS4~D1fqmG-POC}(S^#9L`O>|b&YA0^4xHr4LCjyB-f$*Hw zRq%~HJM&b&5tgi<*`PJz-9i29^1@&Jn(Lxtjj!rTe4Hp4+xElKL&D}yg1=zIUha{4 z4Y-2u&Urle;`Y~cynQld*OLgv^teSmoO}xgnYGxr8-hd8gVz`R*`usb;faL#A5FY@ z%O?5|rDCE)Ss73o+hhov0J^?Y*nU;-XO5=hnug+D_^${F88AyM66bP85Zd$}G_N4> z^gY7mp_(o@ahysOGzkTA>*^IKXnJB|?bSfo`C0oRKC9L&^~y*kI@APg3sEdvZhOFr znZia#nEZUr=PH$T|7b6+OoDCApql=Y2R`ae@uF)h?Sc0}urmt^*f{sy@PPb%Xql?BI4u1Frh&(b4ltkZ_V~lr z>*)UZ6Fy{YUO>c3TY6sq@#%f>v$|C-m=c~c!sK-E;>8$2sX+lP<*d5*2^znb1_O)& zZO9g|Z@j6nXTcBeA+}Xps%VP+ZR~lz#_KK%QVpm&1QK<=S*}&O6s0gU(0ZcUp5F|2 zFedNqTf??(8%_GR#3=Km-TBJ)i!_pca=?8|Y~EZs?(2<03UGW|?up+sl@j?k&!OKc z9wKLKL=xfNaj?P&vFn~uXZAxnoTz;v^u;MvU&_v2IG+_CunYS5`EM1N;2(Q>nvPoy z%8cng6RitUmZ`a3*cTrEnSFH0e4Ws?MA9WFMs<+kW&(>r@d2FnqNvAXXCKUSz$^Nj zH099fHp@gnVhKvAg5y!>?==gG%1e5j4wqt`b$Y7jM!)2xzt5K9Uc2qJeGpPYpp~Z{ z^x$l+c6_-ccRC{^r~dN@2S?bfCQd3oCo`X-R8!#7*b)&aLV@n4>E@2uS~>E ziPrkJjGM|);1Jcogj)Rdp*?)YDXkOWVt_J~*&&r%)K}wBJPKUFa|XmTUFgby;oB6E z)Me^4?vvj}iYO~5v1rmGj638hGVo>|_U4VLuAiEg^#-@rpu8kR9W-v%m`m_eMwofW zGV3<>@LXq~Q`8112|EnZ9h*+Ob29o_o;?p4aJ*AQ64AfkAJO~p8^u!puA)YDG0OMcDFU1 zf;Mz`Gc2M!oB1pDIkzK0jmz@sE|{y^SsNb5fD&d)(%kKv$dX^nEw5CDa4#sN;>X(d zka`@>qHIcN?q*ym%)xp-QZcdB}V#<0m&T(<#^0> zhZ)G+GUBn9aNw8OgpbBq12*r86YHV9ulcf4Zf+N;sZDWxa6a=6gyk}>6f!_X@ysfA zRuQQ$$g8U?(y+}IHgYAy(n;yb6O8dWrBtr&9@yLl`LCQ_+aQ?!Wo=B36)v$25Jb%( zfooMCJF5Xd?+zGR@n^m=b^A5Csy!CeH?c-uzeZ&<-Lng24lO&gu zkpRcb6@`32dTy<&!PUs>gIH)o<6_%o8a+G<&J!QhY`ETQ42F6s9iq15bFTXC^v%g%wT^qu%{JFfuY+d;YtwMZ9(iGpTIXXt2SYt8h(q^Mhib_`l zM$5GmkaOB*v&|Q3Nr3a!Zx&$KJuCx6s7~FI%!W9yb>PYneh$!}nZPl?K1`^fLnAs$ zS~;Vm0qR6PHxt*GDzziywwB#C0ZLACN-*n*x7zzijbcmF=Fkhrf5~1Evs4O|gtX;S z3Z_A3&U>W?eID6BUrp_A;C>yZr99izn;50T=_CcfCn)|6l!ylDa4g*q3{bPvn=2ay zRNhF&cQvYZs;=r?=nE(7tGO|i-X)VKz)vD0(x`VX#rR{?p>>$gbDh|2ms}OU&Fh=6 zcDAxe<&T_931V|H*`v)?)v!`}4a!#$P+MStXc&feAUv6X2WybA} z@mVzjyiU?bk@IyYbBCo*G7P-fPt0XG1}23=cQMdaH)=1(glQg#!|*?tx|*x1XQV)u zs|(C~AuH&mQk7aR8DE`UFlS> z&Hx~DQu?&Pe$y(BQxwT9<>Q(s%dy!Mq&WA1IzO71HHcm)$gw{`Oy9LvDv70FpM68^ zk?1VLfD3e4OCV0MB%kb*N#HV672cSpw$>NF<|BfW8Rj-dCS^RBH*0m40+s3Z-yGv& zp_cH^zooPI-B~q7B_>SMDWVPbd15z>^htRyS%MNDQ6)HY_Zl@9jg?ZlQoZrjpp|Wq z9I_n$f{@5laSE}i$_ZvBA0uN*LOK0lULWL`owz+=bUqQeQWm**diF))C#_cq%#+UH z`#V%=#L51WF;nFKhLYhHE4rxfTU>F{Tsn{+owqEknECbg436Npzt-VQKdbSNLowi! zQ%|=BA%u7B-T}_#4OT!bG*9ZuA>Ayf4}5~mC+KGA^_g?c%Wjvd&4&S4F0qI0A$hrV zgC#jvJtD+h#$>wcpt2_KT0}>fZAjf6fDB}+xO&Y9)1?Wj`@cq13>r4S_qw zo7h1eW+WUVe_;^pKQ(Uf(Gxt3cHI=Y_yC?nE!Xomg(b0ps zDmGKL8}UqG*c^P<$-4#f&TUtg(4-5DJtsSoikD=5h`X5FFBzSFDZSxoni{`^m3(}Y zb>3kHxA)$mLSSeCI$0YrJAINMxs!rBn0O3(h&rvi7xyr@+ViT>9Xfsx;46L7=u fug6`^D)?`*ed*2>``>|IyFh1b&z`8T@xA_k#;K}R literal 0 HcmV?d00001 diff --git a/Walls/NavyslateWall.cs b/Walls/NavyslateWall.cs index 5010e31098..1437881cfb 100644 --- a/Walls/NavyslateWall.cs +++ b/Walls/NavyslateWall.cs @@ -3,7 +3,6 @@ using Terraria.ModLoader; using Terraria.ID; namespace CalamityMod.Walls { - [LegacyName("EutrophicSandWall")] public class NavyslateWall : ModWall, IVisibleThroughWater { int IVisibleThroughWater.WaterMapEntry { get; set; } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 5359115d0b..dd5b228c38 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -2,11 +2,10 @@ using System.Collections.Generic; using CalamityMod.Tiles.SunkenSea; using CalamityMod.Tiles.SunkenSea.Ambient; -using CalamityMod.Utilities; using CalamityMod.Walls; -using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -15,2410 +14,826 @@ namespace CalamityMod.World { public class SunkenSea { - - internal static class SSOffsets + private struct Hub { - public static int TimelessShoresX = 0, TimelessShoresY = 0; - public static int RadiantReefsX = 0, RadiantReefsY = 55; - public static int PolypForestX = 0, PolypForestY = 30; - public static int GleamingBurrowsX = 0, GleamingBurrowsY = 75; - public static int ClamDenX = 0, ClamDenY = 75; - public static int BasaltGullyX = 0, BasaltGullyY = 15; - public static int GlobalX = 0, GlobalY = -20; + public Vector2 Position; + + public Hub(Vector2 position) + { + Position = position; + } + + public Hub(float x, float y) + { + Position = new Vector2(x, y); + } } - static bool IsAirOrDecor(int x, int y) + + private class Cluster : List { - if (y <= 0 || y >= Main.maxTilesY - 1 || x <= 0 || x >= Main.maxTilesX - 1) - return true; // out-of-bounds above counts as clear + } + + private class ClusterGroup : List + { + public int Width; + + public int Height; + + private void SearchForCluster(bool[,] hubMap, List pointCluster, int x, int y, int level = 2) + { + pointCluster.Add(new Point(x, y)); + hubMap[x, y] = false; + level--; + if (level == -1) + { + return; + } + if (x > 0 && hubMap[x - 1, y]) + { + SearchForCluster(hubMap, pointCluster, x - 1, y, level); + } + if (x < hubMap.GetLength(0) - 1 && hubMap[x + 1, y]) + { + SearchForCluster(hubMap, pointCluster, x + 1, y, level); + } + if (y > 0 && hubMap[x, y - 1]) + { + SearchForCluster(hubMap, pointCluster, x, y - 1, level); + } + if (y < hubMap.GetLength(1) - 1 && hubMap[x, y + 1]) + { + SearchForCluster(hubMap, pointCluster, x, y + 1, level); + } + } + + private void AttemptClaim(int x, int y, int[,] clusterIndexMap, List> pointClusters, int index) //Attempts to create a cluster + { + int clusterPos = clusterIndexMap[x, y]; + if (clusterPos != -1 && clusterPos != index) + { + int clusterHeight = (WorldGen.genRand.NextBool(2)) ? -1 : index; + foreach (Point current in pointClusters[clusterPos]) + { + clusterIndexMap[current.X, current.Y] = clusterHeight; + } + } + } + + public void Generate(int width, int height) //Creates clusters for cluster group + { + Width = width; + Height = height; + Clear(); + bool[,] array = new bool[width, height]; + int clusterPos = (width >> 1) - 1; + int clusterHeight = (height >> 1) - 1; + int clusterSize = (clusterPos + 1) * (clusterPos + 1); + Point point = new Point(clusterPos, clusterHeight); + for (int i = point.Y - clusterHeight; i <= point.Y + clusterHeight; i++) + { + float num4 = (float)clusterPos / (float)clusterHeight * (float)(i - point.Y); + int num5 = Math.Min(clusterPos, (int)Math.Sqrt((float)clusterSize - num4 * num4)); + for (int j = point.X - num5; j <= point.X + num5; j++) + { + array[j, i] = WorldGen.genRand.NextBool(2); + } + } + List> list = new List>(); + for (int k = 0; k < array.GetLength(0); k++) + { + for (int l = 0; l < array.GetLength(1); l++) + { + if (array[k, l] && WorldGen.genRand.NextBool(2)) + { + List list2 = new List(); + SearchForCluster(array, list2, k, l, 2); + if (list2.Count > 2) + { + list.Add(list2); + } + } + } + } + int[,] array2 = new int[array.GetLength(0), array.GetLength(1)]; + for (int m = 0; m < array2.GetLength(0); m++) + { + for (int n = 0; n < array2.GetLength(1); n++) + { + array2[m, n] = -1; + } + } + for (int num6 = 0; num6 < list.Count; num6++) + { + foreach (Point current in list[num6]) + { + array2[current.X, current.Y] = num6; + } + } + for (int num7 = 0; num7 < list.Count; num7++) + { + foreach (Point point2 in list[num7]) + { + int x = point2.X; + int y = point2.Y; + if (array2[x, y] == -1) + { + break; + } + int index = array2[x, y]; + if (x > 0) + { + AttemptClaim(x - 1, y, array2, list, index); + } + if (x < array2.GetLength(0) - 1) + { + AttemptClaim(x + 1, y, array2, list, index); + } + if (y > 0) + { + AttemptClaim(x, y - 1, array2, list, index); + } + if (y < array2.GetLength(1) - 1) + { + AttemptClaim(x, y + 1, array2, list, index); + } + } + } + using (List>.Enumerator enumerator2 = list.GetEnumerator()) + { + while (enumerator2.MoveNext()) + { + enumerator2.Current.Clear(); + } + } + for (int num8 = 0; num8 < array2.GetLength(0); num8++) + { + for (int num9 = 0; num9 < array2.GetLength(1); num9++) + { + if (array2[num8, num9] != -1) + { + list[array2[num8, num9]].Add(new Point(num8, num9)); + } + } + } + foreach (List current2 in list) + { + if (current2.Count < 4) + { + current2.Clear(); + } + } + foreach (List current3 in list) + { + Cluster cluster = new Cluster(); + if (current3.Count > 0) + { + foreach (Point current4 in current3) + { + cluster.Add(new Hub((float)current4.X + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f, (float)current4.Y + (WorldGen.genRand.NextFloat() - 0.5f) * 0.5f)); + } + Add(cluster); + } + } + } + } + + // Generates clumps / clusters / chunks of general tiles in the Sunken Sea area + private static void PlaceClusters(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector) + { + int totalWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); + int totalHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); + Vector2 totalScale = new Vector2(totalWidth, totalHeight); + Vector2 individualScale = new Vector2(clusters.Width, clusters.Height); + + //I was a bit worried about editing anything in this loop too drastically, so i just changed all instances of placing navystone to eutrophic sand + for (int i = -20; i < totalWidth + 20; i++) + { + for (int j = -20; j < totalHeight + 20; j++) + { + float num3 = 0f; + int clusterAmt = -1; + float num5 = 0f; + int num6 = i + start.X; + int num7 = j + start.Y; + Vector2 vector = new Vector2((float)i, (float)j) / totalScale * individualScale; + float num8 = (new Vector2((float)i, (float)j) / totalScale * 2f - Vector2.One).Length(); + for (int k = 0; k < clusters.Count; k++) + { + Cluster cluster = clusters[k]; + if (Math.Abs(cluster[0].Position.X - vector.X) <= 10f && Math.Abs(cluster[0].Position.Y - vector.Y) <= 10f) + { + float num9 = 0f; + foreach (Hub current in cluster) + { + num9 += 1f / Vector2.DistanceSquared(current.Position, vector); + } + if (num9 > num3) + { + if (num3 > num5) + { + num5 = num3; + } + num3 = num9; + clusterAmt = k; + } + else if (num9 > num5) + { + num5 = num9; + } + } + } + float num10 = num3 + num5; + Tile tile = Main.tile[num6, num7]; + bool flag = num8 >= 0.8f; + if (num10 > 4.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent + { + tile.ClearEverything(); + tile.LiquidAmount = 192; + if (clusterAmt % 5 == 2) + { + tile.ResetToType((ushort)ModContent.TileType()); + tile.Get().HasTile = true; + tile.LiquidAmount = 0; + } + Tile.SmoothSlope(num6, num7, true); + } + else if (num10 > 1.8f) + { + tile.WallType = (ushort)ModContent.WallType(); + tile.LiquidAmount = 192; + if (!flag || tile.HasTile) + { + tile.ResetToType((ushort)ModContent.TileType()); + tile.Get().HasTile = true; + Tile.SmoothSlope(num6, num7, true); + tile.LiquidAmount = 0; + } + } + else if (num10 > 0.7f || !flag) + { + tile.LiquidAmount = 192; + if (!flag || tile.HasTile) + { + tile.ResetToType((ushort)ModContent.TileType()); + tile.Get().HasTile = true; + Tile.SmoothSlope(num6, num7, true); + tile.LiquidAmount = 0; + } + tile.WallType = (ushort)ModContent.WallType(); + } + else if (num10 > 0.25f) + { + float num11 = (num10 - 0.25f) / 0.45f; + if (WorldGen.genRand.NextFloat() < num11) + { + if (tile.HasTile) + { + tile.ResetToType((ushort)ModContent.TileType()); + tile.Get().HasTile = true; + Tile.SmoothSlope(num6, num7, true); + tile.WallType = (ushort)ModContent.WallType(); + tile.LiquidAmount = 0; + } + else + { + tile.WallType = (ushort)ModContent.WallType(); + tile.LiquidAmount = 192; + } + } + } + } + } + + //final cleanup loop + for (int i = -20; i < totalWidth + 20; i++) + { + for (int j = -20; j < totalHeight + 20; j++) + { + int x = i + start.X; + int y = j + start.Y; + + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + Tile tileDown = Main.tile[x, y + 1]; + Tile tileDown2 = Main.tile[x, y + 2]; + Tile tileLeft = Main.tile[x - 1, y]; + Tile tileRight = Main.tile[x + 1, y]; + + //lava BEGONE + if (tile.WallType == ModContent.WallType() || tile.WallType == ModContent.WallType()) + { + if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) + { + tile.LiquidType = LiquidID.Water; + tile.LiquidAmount = 255; + } + + //also get rid of any annoying leftover obsidian + if (tile.TileType == TileID.Obsidian) + { + WorldGen.KillTile(x, y); + } + } + + //place extra caves throughout the biome for variance + if (WorldGen.genRand.NextBool(1000) && tile != null && tile.HasTile && + (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType())) + { + TileRunner runner = new TileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(-35, 35), + new Point16(-35, 35), 15f, WorldGen.genRand.Next(25, 50), 0, false, true); + runner.Start(); + } + + //kill any random floating tiles + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + //kill any individual floating tiles + if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) + { + WorldGen.KillTile(x, y); + } + } + + //kill any random clumps of navystone without eutrophic sand around them + if (tile.TileType == ModContent.TileType() && tileUp.TileType != ModContent.TileType() && + tileDown.TileType != ModContent.TileType() && tileLeft.TileType != ModContent.TileType() && + tileRight.TileType != ModContent.TileType()) + { + WorldGen.KillTile(x, y); + } + } + } + } + + // Adds tile variation to generated tile clusters and generates open areas with sea prism ore called "Tits" + // Generates sea prism crystals on prism ore and occasionally on navystone + private static void AddGeodes(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector, float overallBiomeScale) + { + int totalClusterZoneWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); + int totalClusterZoneHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); + bool genCentalHole = true; + Rectangle rectangle = default; + + // Radius of the generated hole + int radius = (int)(WorldGen.genRand.Next(24, 28) * overallBiomeScale); + int diameter = radius * 2; + + // Where to place the giant hole? "Center of the Sunken Sea", defined as follows: + // Dead center horizontally, and 1/3 of the way down the area + Point point = new Point(start.X + totalClusterZoneWidth / 2, start.Y + (int)(totalClusterZoneHeight * 0.33f)); + + ShapeData holeShape = new ShapeData(); + float outerRadiusPercentage = WorldGen.genRand.Next(40, 56) * 0.01f; //Small radius for ore patch to fit inside holes + + // Y coordinate of the "bottom" of the Sunken Sea, 70% of the way down. + int sunkenSeaBottom = start.Y + (int)(totalClusterZoneHeight * 0.7f); + int smallHoles = 0; + + // Scale amount of holes with world size + // 4 on Small, 6 on Normal (rounds down), 8 on Large + int totalHoleCount = (int)(4f * overallBiomeScale); + + for (int i = -20; i < totalClusterZoneWidth + 20; i++) + { + for (int j = -20; j < totalClusterZoneHeight + 20; j++) + { + if (genCentalHole) + { + // Set the rectangle for the central hole + genCentalHole = false; + rectangle = new Rectangle(start.X + totalClusterZoneWidth / 2 - radius, start.Y + (int)(totalClusterZoneHeight * 0.33f) - radius, diameter, diameter); + + WorldUtils.Gen(point, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.6).Output(holeShape), //Adds uneven shape to the outer tiles + new Actions.ClearTile(true), //Clear all tiles + new Actions.SetLiquid(0, 192) //Leave some air pockets + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth the outer parts + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(4)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 6 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.SetTile((ushort)ModContent.TileType(), true) //Place outer shell + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 4 + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile((ushort)ModContent.TileType(), true) //Place prism + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radius * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 2 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearTile(true), //Clear all tiles + new Actions.SetLiquid(0, 255) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + } + + // Set the point for non-central holes + int smallHoleX = WorldGen.genRand.Next(start.X + 30, start.X + totalClusterZoneWidth - 30); + int smallHoleY = WorldGen.genRand.Next(start.Y + 20, sunkenSeaBottom); + point = new Point(smallHoleX, smallHoleY); + + if (smallHoles < totalHoleCount && WorldGen.genRand.NextBool(3) && !rectangle.Contains(point)) + { + smallHoles++; + int radiusSmall = (int)(((float)WorldGen.genRand.Next(8, 11)) * overallBiomeScale); + WorldUtils.Gen(point, new Shapes.Circle(radiusSmall), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.45).Output(holeShape), + new Actions.ClearTile(true), + new Actions.SetLiquid(0, 192) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] + { + new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + outerRadiusPercentage = (float)((double)WorldGen.genRand.Next(65, 81) * 0.01); + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * outerRadiusPercentage)), Actions.Chain(new GenAction[] //Smallest is 4 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.SetTile((ushort)ModContent.TileType(), true) //Place outer shell + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth outer shell + { + new CustomActions.DistanceFromOrigin(true, radiusSmall * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(3)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.6f))), Actions.Chain(new GenAction[] //Smallest is 2 + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile((ushort)ModContent.TileType(), true) //Place prism + })); + + WorldUtils.Gen(point, new Shapes.Circle((int)((float)radiusSmall * (outerRadiusPercentage * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearTile(true), //Clear center + new Actions.SetLiquid(0, 255) + })); + + WorldUtils.Gen(point, new ModShapes.OuterOutline(holeShape, true, true), Actions.Chain(new GenAction[] //Smooth inner shell + { + new CustomActions.DistanceFromOrigin(true, radius * 16f - 48), + new Modifiers.Conditions(new CustomConditions.RandomChance(2)), + new Actions.Smooth(), + new Actions.SetFrames(true) + })); + } + + int num3 = i + start.X; + int num4 = j + start.Y; + Tile tile = Main.tile[num3, num4]; + Tile testTile = Main.tile[num3, num4 + 1]; + Tile testTile2 = Main.tile[num3, num4 + 2]; + if (tile.TileType == ModContent.TileType() && (!WorldGen.SolidTile(testTile) || !WorldGen.SolidTile(testTile2))) //Tile variation + { + tile.TileType = (ushort)ModContent.TileType(); + } + } + } + } + + private static void AddTileVariance(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector, float overallBiomeScale) + { + int totalClusterZoneWidth = (int)(terrainApplicationScaleVector.X * clusters.Width); + int totalClusterZoneHeight = (int)(terrainApplicationScaleVector.Y * clusters.Height); + for (int k = -20; k < totalClusterZoneWidth + 20; k++) + { + for (int l = -20; l < totalClusterZoneHeight + 20; l++) + { + int num5 = k + start.X; + int num6 = l + start.Y; + Tile tile = Main.tile[num5, num6]; + if (tile.HasTile && (tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType())) + { + bool flag = true; + for (int m = -1; m >= -3; m--) + { + if (Main.tile[num5, num6 + m].HasTile) + { + flag = false; + break; + } + } + bool flag2 = true; + for (int n = 1; n <= 3; n++) + { + if (Main.tile[num5, num6 + n].HasTile) + { + flag2 = false; + break; + } + } + bool flag3 = true; + for (int o = -1; o >= -3; o--) + { + if (Main.tile[num5 + o, num6].HasTile) + { + flag3 = false; + break; + } + } + bool flag4 = true; + for (int p = 1; p <= 3; p++) + { + if (Main.tile[num5 + p, num6].HasTile) + { + flag4 = false; + break; + } + } + if (tile.TileType == ModContent.TileType() || ((tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType()) && WorldGen.genRand.NextBool(8))) + { + if (flag3 ^ flag4) + { + if (tile.Slope == 0 && !tile.IsHalfBlock) + { + Tile tile3 = Main.tile[num5 + (flag3 ? -1 : 1), num6]; + tile3.TileType = (ushort)ModContent.TileType(); + if (Main.tile[num5 - 1, num6].TileType == ModContent.TileType()) + { + Main.tile[num5 - 1, num6].TileFrameY = (short)(2 * 18); + } + else if (Main.tile[num5 + 1, num6].TileType == ModContent.TileType()) + { + Main.tile[num5 + 1, num6].TileFrameY = (short)(3 * 18); + } + tile3.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.Get().HasTile = true; + } + } + if (flag ^ flag2) + { + if (tile.Slope == 0 && !tile.IsHalfBlock) + { + Tile tile3 = Main.tile[num5, num6 + (flag ? -1 : 1)]; + tile3.TileType = (ushort)ModContent.TileType(); + if (Main.tile[num5, num6 - 1].TileType == ModContent.TileType()) + { + Main.tile[num5, num6 - 1].TileFrameY = (short)(0 * 18); + } + else if (Main.tile[num5, num6 + 1].TileType == ModContent.TileType()) + { + Main.tile[num5, num6 + 1].TileFrameY = (short)(1 * 18); + } + tile3.TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); + tile3.Get().HasTile = true; + } + } + } + } + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(8)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + //colorful corals + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + if (WorldGen.genRand.NextBool(20)) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + + //stalactites + if (WorldGen.genRand.NextBool(15)) + { + WorldGen.PlaceObject(num5, num6 + 2, ModContent.TileType()); + } + if (WorldGen.genRand.NextBool(15)) + { + WorldGen.PlaceTile(num5, num6 + 1, ModContent.TileType(), true, false, -1, 0); + } + + //stalagmites + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceObject(num5, num6 - 2, ModContent.TileType()); + } + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceTile(num5, num6 - 1, ModContent.TileType(), true, false, -1, 0); + } + } + if (!tile.HasTile) + { + if (tile.TileType == ModContent.TileType() || tile.WallType == ModContent.WallType()) + { + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + } + } + } + } + } + + //added this to 100% make sure the sunken sea places where it is supposed to be + static bool foundValidPosition = false; + + public static bool Place(Point origin) + { + for (int y = origin.Y; y >= (int)Main.worldSurface; y--) + { + //check for the desert biomes walls + if (Main.tile[origin.X, y].WallType == WallID.Sandstone || Main.tile[origin.X, y].WallType == WallID.HardenedSand) + { + origin.Y = y + 50; //offset so it doesnt generate weird + foundValidPosition = true; + break; + } + } + + while (foundValidPosition) + { + // 1 on Small, 1.52 on Medium, 2 on Large + float scale = Main.maxTilesX / 4200f; + // Clamp scale to prevent problems on extra large worlds + scale = MathHelper.Clamp(scale, 1f, 2f); + + // 80 on Small, 121.6 on Medium, 160 on Large + int sunkenSeaAreaX = (int)(80f * scale); + // 84-102 on Small, 127.68-155.04 on Medium, 168-204 on Large + float baseVerticalSize = 60f * scale; + float verticalScaleFactor = 1.4f + WorldGen.genRand.NextFloat(0.3f); + int sunkenSeaAreaY = (int)(verticalScaleFactor * baseVerticalSize); + + // What the fuck is this and why is it used everywhere + // As far as I can tell, this just scales up the entire Sunken Sea to be 4x wider and 2x taller than what is listed above + Vector2 arbitrary42GodVector = new Vector2(4f, 2f); + + // 04NOV2024: Ozzatron: Remnants mutilates the Underground Desert beyond recognition. + // The above code assumes the size of the underground desert with arbitrary hardcoded values instead of checking it. + // To ensure the Sunken Sea is centered on an Underground Desert of any size, some adjustments are made. + // This would have been easy, but the arbitrary 4-2 God vector makes the math unnecessarily complicated. + int sunkenSeaRealWidth = (int)(sunkenSeaAreaX * arbitrary42GodVector.X); + origin.X = GenVars.UndergroundDesertLocation.Center.X - sunkenSeaRealWidth / 2; + + // Place the majority of the terrain as clusters + ClusterGroup clusterGroup = new ClusterGroup(); + clusterGroup.Generate(sunkenSeaAreaX, sunkenSeaAreaY); + PlaceClusters(clusterGroup, origin, arbitrary42GodVector); + + // Place Geodes + AddGeodes(clusterGroup, origin, arbitrary42GodVector, scale); + + // Re-frame everything in some arbitrary radius + int totalWidth = (int)(arbitrary42GodVector.X * clusterGroup.Width); + int totalHeight = (int)(arbitrary42GodVector.Y * clusterGroup.Height); + int frameExcessRadius = 40; + for (int i = -frameExcessRadius; i < totalWidth + frameExcessRadius; i++) + { + for (int j = -frameExcessRadius; j < totalHeight + frameExcessRadius; j++) + { + if (i + origin.X > 0 && i + origin.X < Main.maxTilesX - 1 && j + origin.Y > 0 && j + origin.Y < Main.maxTilesY - 1) + { + WorldGen.SquareWallFrame(i + origin.X, j + origin.Y, true); + WorldUtils.TileFrame(i + origin.X, j + origin.Y, true); + Tile.SmoothSlope(i + origin.X, j + origin.Y, true); + } + } + } + + // Add Tile Variance (sand, crystals, etc.) + AddTileVariance(clusterGroup, origin, arbitrary42GodVector, scale); - Tile t = Main.tile[x, y]; - if (!t.HasTile) return true; - - int type = t.TileType; - - // blockers (full blocks / slopes / platforms) - if (WorldGen.SolidOrSlopedTile(x, y)) return false; // solid/half/sloped - if (Main.tileSolidTop[type]) return false; // platforms & similar - - // ambient stuff - if (Main.tileFrameImportant[type] && !Main.tileSolid[type]) return true; // pots, cactus, decor - if (Main.tileCut[type]) return true; // grass/vines/etc. - if (TileID.Sets.BreakableWhenPlacing[type]) return true; // tiny plants, etc. + } return false; } - static bool ColumnClearOrDecor(int x, int groundY, int tilesUp) - { - for (int k = 1; k <= tilesUp; k++) - { - if (!IsAirOrDecor(x, groundY - k)) - return false; - } - return true; - } /* - checklist: - -Make sunken sea walls produce water - cut a half oval out of the top of forest in anticipation of structure placement - */ - - public static void ParallelFor(int fromInclusive, int toExclusive, int step, Action action) + public static void PlaceTit(int x, int y, ushort type = 165) { - FasterParallel.For(fromInclusive, toExclusive, (start, end, _) => + if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].HasTile && !Main.tile[x, y + 1].HasTile) { - for (int i = start; i < end; i += step) - action.Invoke(i); - }); - } - - public static void PlaceTimelessShores(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.TimelessShoresX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.TimelessShoresY; - - int biomeSize = 250 + (Main.maxTilesX / 180); - - int XLeft = GenVars.UndergroundDesertLocation.Left; - - int XRight = GenVars.UndergroundDesertLocation.Right; - - const int totalCuveDepth = 90; - // this converts basalt to runestone directy in line to the desert to make the shape look perfect to blend well with the rest of the desert - ParallelFor(XLeft, XRight, 20, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 30, startX + biomeSize - 200, x, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 30, startX - biomeSize + 200, x, true))); - - for (int y = startY + 100; y >= startY - 175; y -= 15) + if (Main.tile[x, y - 1].TileType == (ushort)ModContent.TileType()) { - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Rectangle(20, 20), Actions.Chain(new GenAction[] + if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y + 2].HasTile) { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - } - }); - // - // Makes the bottom borders of the Timeless Shores curved downwards. - // - ParallelFor(startX - biomeSize, startX - biomeSize + 200, 10, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, x, true))); - for (int y = startY + 50; y <= startY + 70 + curveDepth; y += 5) - { - ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Slime(20), Actions.Chain(new GenAction[] + int num2 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].TileType = type; + Main.tile[x, y].Get().HasTile = true; + Main.tile[x, y].TileFrameX = (short)num2; + Main.tile[x, y].TileFrameY = 72; + } + else { - // new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle) - })); - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.PlaceWall((ushort)ModContent.WallType())); - } - }); - ParallelFor(startX + biomeSize - 200, startX + biomeSize, 5, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, x, true))); - for (int y = startY + 50; y <= startY + 70 + curveDepth; y += 5) - { - ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Slime(20), Actions.Chain(new GenAction[] - { - // new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle) - })); - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.PlaceWall((ushort)ModContent.WallType())); - } - }); - - // Clears out a curved cavity inside the timeless shores, this creates the main large open space inside the biome - ParallelFor(startX - biomeSize + 10, startX + biomeSize - 10, 1, (X) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, X, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, X, true))); - - int random = WorldGen.genRand.Next(-40, 10); - for (int Y = startY - 25 + curveDepth + curveDepth2; Y <= startY + 50; Y++) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y + random), new Shapes.Mound(WorldGen.genRand.Next(7, 10), 5), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y + random), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear() - })); - } - }); - - // - // Places slopes at the sides of the shores to actually make shores. - // - ParallelFor(startX - biomeSize - 85, startX - biomeSize + 200, 20, (moundX) => - { - int RandomX = Main.rand.Next(15, 20); - ShapeData mound = new(); - GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startY + 75; - int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize, startX - biomeSize + 200, moundX))); - - WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); - }); - ParallelFor(startX + biomeSize - 200, startX + biomeSize + 85, 20, (moundX) => - { - ShapeData mound = new(); - GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startY + 75; - int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize, startX + biomeSize - 200, moundX))); - - WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); - }); - - - // - // Makes a large platform in the middle of the Timeless Shores. - // - const int platformSize = 130; - const int platformHeight = 35; // Remember that because of Terraria's coordinate system, making it lower actually makes it higher. - const int platformDepth = 35; // How deep it goes. Like above, the higher it is, the lower it goes. - ParallelFor(startX - platformSize / 2, startX + platformSize / 2, 5, (platformX) => - { - // This makes the "stem" of the platform be thinner towards the base and then expand on the top. - int thickness = (int)(MathF.Pow(CalamityUtils.Convert01To010(Utils.GetLerpValue(startX - platformSize / 2, startX + platformSize / 2, platformX)), 3f) * platformDepth) + platformHeight; - for (int platformY = startY + platformHeight; platformY <= startY + thickness; platformY++) - { - WorldUtils.Gen(new Point(platformX, platformY), new Shapes.Circle(5), Actions.Chain(new GenAction[] - { - // Clear all tiles and place tiles. - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - } - }); - // - // Makes the platform have a curve on top - // - ParallelFor(startX - platformSize / 2, startX + platformSize / 2, 1, (x) => - { - float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startX - platformSize / 2, startX + platformSize / 2, x, true)); - int elevation = (int)MathHelper.Lerp(4f, 1f, interpolator); - WorldUtils.Gen(new Point(x, startY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); - }); - - // Plateau - ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPlateauX) => - { - int randomDisplacement = WorldGen.genRand.Next(-46, -27); - int RandomX = Main.rand.Next(7, 15); - int RandomH = Main.rand.Next(15, 25); - - for (int wallPlateauY = startY + RandomH; wallPlateauY <= startY + 60; wallPlateauY += 10) - { - // Along the height of the pillar, it becomes shorter the more closer to the center we get. - int PlateauWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPlateauY)) * 25); - - ShapeData Circle = new ShapeData(); - GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); - if (Main.tile[startX, startY].WallType == (ushort)ModContent.WallType()) - { - WorldUtils.Gen(new Point(randomDisplacement + wallPlateauX + PlateauWidth / 2, randomDisplacement + wallPlateauY), new Shapes.Circle(RandomH - PlateauWidth + 3, RandomX), Actions.Chain(new GenAction[] - { - blotchFilter.Output(Circle) - })); - - WorldUtils.Gen(new Point(randomDisplacement + wallPlateauX + PlateauWidth / 4, randomDisplacement + wallPlateauY), new ModShapes.All(Circle), Actions.Chain(new GenAction[] - { - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })) - ; + int num3 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].TileType = type; + Main.tile[x, y].Get().HasTile = true; + Main.tile[x, y].TileFrameX = (short)num3; + Main.tile[x, y].TileFrameY = 0; + Main.tile[x, y + 1].TileType = type; + Main.tile[x, y + 1].Get().HasTile = true; + Main.tile[x, y + 1].TileFrameX = (short)num3; + Main.tile[x, y + 1].TileFrameY = 18; } } - } - ); - - //Poop emote for gfb - //ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPillarX) => - //{ - // int randomDisplacement = WorldGen.genRand.Next(-46, -27); - // int RandomX = Main.rand.Next(7, 15); - // int RandomH = Main.rand.Next(15, 25); - - // for (int wallPillarY = startY + RandomH; wallPillarY <= startY + 60; wallPillarY += 10) - // { - // // Along the height of the pillar, it becomes shorter the more closer to the center we get. - // int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPillarY)) * 25); - - // ShapeData rectangle = new ShapeData(); - // GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); - // GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startY + 30, startY + 70, wallPillarY) + 0.25, 1)); - // if (Main.tile[startX, startY].WallType == (ushort)ModContent.WallType()) - // { - // WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, randomDisplacement + wallPillarY), new Shapes.Circle(RandomH - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] - // { - // // Applies a blotch filter to the rectangle. - // blotchFilter.Output(rectangle) - // })); - - // WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, randomDisplacement + wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] - // { - // new Actions.SetTile((ushort)ModContent.TileType()) - // })) - // ; - // } - // } - - //} - //); - - //place water below the clear barrier for the islands so that theres water inbetween them - ParallelFor(startX - biomeSize + 35, startX + biomeSize - 35, 1, (WaterX) => + else { - for (int WaterY = startY + 37; WaterY <= startY + 60; WaterY++) + if (WorldGen.SolidTile(x, y + 1) && !Main.tile[x, y].HasTile && !Main.tile[x, y - 1].HasTile) { - Main.tile[WaterX, WaterY].Get().LiquidType = LiquidID.Water; - Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; - } - }); - - // - // Generates pillars made out of walls at random points in the Timeless Shores. - // - const int furthestDistanceFromCenter = 100; - ParallelFor(startX - (biomeSize / 2) - furthestDistanceFromCenter, startX + (biomeSize / 2) + furthestDistanceFromCenter, 100, (wallPillarX) => - { - int randomDisplacementX = WorldGen.genRand.Next(-25, 25); - int RandomX = Main.rand.Next(3, 6); - - for (int wallPillarY = startY - 75; wallPillarY <= startY + 80; wallPillarY += 10) - { - // Along the height of the pillar, it becomes shorter the more closer to the center we get. - int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - 75, startY + 50, wallPillarY)) * 25); - - ShapeData rectangle = new ShapeData(); - GenAction blotchFilter = new Modifiers.Blotches(2, 0.4); - GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startY + 40, startY + 70, wallPillarY) + 0.25, 1)); - - WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 15), Actions.Chain(new GenAction[] + if (Main.tile[x, y + 1].TileType == (ushort)ModContent.TileType()) { - ditherFilter.Output(rectangle), // Applies a dithering filter to the rectangle. - blotchFilter.Output(rectangle), // Applies a blotch filter to the rectangle. - })); - - WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] - { - new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. - })) - ; - } - }); - - // places wall flowers in the curved cavity inside the timeless shores. This is done here to prevent them from appearing in the transiton area - ParallelFor(startX - biomeSize + 10, startX + biomeSize - 10, 1, (X) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, X, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, X, true))); - - for (int Y = startY - 60 + curveDepth + curveDepth2; Y <= startY + 30; Y++) - { - int Rand3() => WorldGen.genRand.Next(3); - int ShoresFlowerVariants = Rand3(); - - if (Main.tile[X, Y].WallType == ModContent.WallType() && WorldGen.EmptyTileCheck(X - 1, Y - 1, 3, 3)) - { - if (WorldGen.genRand.NextBool(60)) + if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y - 2].HasTile) { - WorldGen.PlaceObject(X - 1, Y - 1, ModContent.TileType(), mute: true, style: ShoresFlowerVariants); - } - } - - if (Main.tile[X, Y].WallType == ModContent.WallType() && WorldGen.EmptyTileCheck(X - 1, Y - 1, 2, 2)) - { - if (WorldGen.genRand.NextBool(60)) - WorldGen.PlaceObject(X - 1, Y - 1, ModContent.TileType(), mute: true, style: ShoresFlowerVariants); - } - } - }); - - // - // Makes the transition area to the Timeless Shores. - // Replaces tiles, walls, and places some water spots. - // - ParallelFor(startX - biomeSize - 15, startX + biomeSize + 30, 20, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 30, startX + biomeSize - 200, x, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 30, startX - biomeSize + 200, x, true))); - - for (int y = startY - 5; y >= startY - 149; y -= 15) - { - float interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - - //WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - //{ - // new Modifiers.OnlyTiles(TileID.Sand), - // new Actions.ClearTile(), - // new Actions.PlaceTile((ushort)ModContent.TileType()), - // new Actions.PlaceWall((ushort)ModContent.WallType()) - //})); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.HardenedSand, TileID.Sand,TileID.Copper,TileID.Tin, TileID.Iron, TileID.Lead), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.DesertFossil,TileID.Tungsten,TileID.Silver,TileID.Gold,TileID.Platinum,TileID.Demonite,TileID.Crimtane), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.RollingCactus), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - interpolator = Utils.GetLerpValue(startY - 90, startY - 200, y, true); - - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), - new Actions.ClearWall(), - new Actions.PlaceWall((ushort)ModContent.WallType()), - })); - - interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles(TileID.Sandstone), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); - WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyWalls((ushort)ModContent.WallType()), - new Actions.ClearWall(), - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) - WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); - - if (WorldGen.genRand.NextBool(5) && y < startY - 100) - { - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new GenAction[] - { - new Modifiers.IsNotSolid().Output(new()), - new Actions.SetLiquid(), - })); - } - } - - // Place layer of sand on valid runestone blocks. - for (int X = startX - biomeSize; X < startX + biomeSize; X += 1) - { - for (int Y = startY - 100; Y <= startY + 100; Y++) - { - bool canPlaceSand = Main.tile[X, Y].TileType == ModContent.TileType() && ColumnClearOrDecor(X, Y, 5); - - if (canPlaceSand) - { - if (Main.tile[X, Y - 1].WallType == WallID.None) - { - WorldGen.KillWall(X, Y); - } - PlaceSand(X, Y, 5, ModContent.TileType()); - } - - // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - WorldGen.KillTile(X, Y); - - // Kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - WorldGen.KillTile(X, Y); - - } - } - - // Slope tiles - for (int X = startX - biomeSize; X < startX + biomeSize; X += 1) - { - for (int Y = startY - 300; Y <= startY + 200; Y++) - { - Tile.SmoothSlope(X, Y); - } - } - }); - } - - // Sides of the sunken sea (radiant reefs) - public static void PlaceRadiantReefs(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.RadiantReefsX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.RadiantReefsY; - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - Point origin = new Point(startX, startY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 280 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 50f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - ushort Shellstone = (ushort)ModContent.TileType(); - ushort ShellstoneWall = (ushort)ModContent.WallType(); - - // Generate the actual caverns - bool runOnce = false; // This is used to make the wall on the left side go boom on the second run - for (int X = origin.X - biomeSize - 170; X <= origin.X + biomeSize + 170; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - Tile t = Main.tile[X, Y]; - float percent = dist / constant; - float blurPercent = 0.99f; - if (percent > blurPercent) - { - // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - if (!runOnce) - { - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), Shellstone, true, 0f, 0f, true, true); - t.WallType = ShellstoneWall; - runOnce = true; - } - - // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - if (runOnce) - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), Shellstone, false, 0f, 0f, true, true); - t.WallType = ShellstoneWall; + int num13 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].TileType = type; + Main.tile[x, y].Get().HasTile = true; + Main.tile[x, y].TileFrameX = (short)num13; + Main.tile[x, y].TileFrameY = 90; } else { - // Clear absolutely everything before generating the caverns - t.ClearEverything(); - - // Generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 90f, Y / 90f, 3, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 150f, Y / 90f, 3, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.380f; - - // Kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - WorldGen.KillTile(X, Y); - } - else - { - t.TileType = Shellstone; - t.HasTile = true; - } - - // Place walls in the biome using a different "seed" so it differs from the cave generation - // This creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 2, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 200f, Y / 160f, 4, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.280f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - t.WallType = ShellstoneWall; - } - - if (caveNoiseMapWalls * caveNoiseMapWalls < (caveCreationThresholdWalls - (caveNoiseMapWalls * 0.2f))) - WorldGen.KillTile(X, Y); - - t.Get().LiquidType = LiquidID.Water; - t.LiquidAmount = byte.MaxValue; - } - } - } - } - - // Cleanup - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - WorldGen.KillTile(X, Y); - - // Kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - WorldGen.KillTile(X, Y); - } - } - } - - // Place layer of sand blocks on valid surfaces - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - bool canPlaceSand = - Main.tile[X, Y].TileType == ModContent.TileType() && - !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && - !Main.tile[X, Y - 5].HasTile; - - // Place sand clumps on top of exposed shellstone - if (canPlaceSand) - PlaceSand(X, Y, 5, ModContent.TileType()); - } - } - } - - // Cleanup again - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - WorldGen.KillTile(X, Y); - - // Kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - WorldGen.KillTile(X, Y); - - // If any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - - Tile.SmoothSlope(X, Y); - } - } - } - } - - // Middle of the sunken sea (polyp forest) - public static void PlacePolypForest(int startPosX, int startPosY) - { - - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.PolypForestX; - - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.PolypForestY; - - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - Point origin = new Point(startX, startY - 200); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 150 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - ushort Limestone = (ushort)ModContent.TileType(); - ushort LimestoneWall = (ushort)ModContent.WallType(); - - // Place the polyp forest caverns - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y + verticalRadius * 0.4f) + 3; Y >= origin.Y - verticalRadius - 3; Y--) - { - Tile t = Main.tile[X, Y]; - // Modify this part so that the generation happens from bottom to top - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) - { - float percent = dist / constant; - float blurPercent = 0.98f; - - // Biome "blending" on the edges (disabled for now) - if (percent > blurPercent) - { - - if (Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) - { - //ShapeData circle = new ShapeData(); - //GenAction blotchMod = new Modifiers.Blotches(4, 0.7); - //WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - //{ - // blotchMod.Output(circle) - //})); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else - { - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); - - //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 800f, Y / 450f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 800f, Y / 450f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; - - //kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - WorldGen.KillTile(X, Y); - } - else - { - t.TileType = Limestone; - t.HasTile = true; - } - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80f, Y / 80f, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 600f, Y / 350f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.3f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - t.WallType = LimestoneWall; - } - - if ((caveNoiseMapWalls + 0.085f) * (caveNoiseMapWalls + 0.085f) > caveCreationThresholdWalls) - { - if (t.WallType == WallID.None) - t.WallType = (ushort)ModContent.WallType(); - } - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; - } - } - } - } - - //cleanup - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - } - } - } - - //place extra tiles - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed limestone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); - } - - } - } - } - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 20; Y <= origin.Y + verticalRadius + 20; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) - { - bool canPlaceGrass = false; - - //place grass on top of exposed sand - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) - { - canPlaceGrass = true; - } - - if (canPlaceGrass) - { - PlaceSand(X, Y, 0, ModContent.TileType()); - } - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - if (WorldGen.genRand.NextBool(25) && !Main.tile[X - 1, Y].HasTile) - { - ushort[] Soil = new ushort[] { (ushort)ModContent.TileType() }; - - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 7)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Soil)) - })); - - } - } - } - } - - - //cleanup again - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - - Tile.SmoothSlope(X, Y); - } - } - } - } - //bottom of the biome (gleaming burrows) - public static void PlaceGleamingBurrowsGeodes(int startPosX, int startPosY) - - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.GleamingBurrowsX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.GleamingBurrowsY; - - Point origin = new Point(startX, startY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 220 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - ushort Navystone = (ushort)ModContent.TileType(); - ushort NavystoneWall = (ushort)ModContent.WallType(); - - - - //cleanup again, also place geodes - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //place geodes - if (WorldGen.genRand.NextBool(800) && Main.tile[X, Y].TileType == ModContent.TileType()) - { - PlaceGeode(X, Y, WorldGen.genRand.Next(10, 17)); - } - - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - - Tile.SmoothSlope(X, Y); - } - } - } - } - public static void PlaceGleamingBurrows(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.GleamingBurrowsX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.GleamingBurrowsY; - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - Point origin = new Point(startX, startY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 220 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - ushort Navystone = (ushort)ModContent.TileType(); - ushort NavystoneWall = (ushort)ModContent.WallType(); - - int XStart = origin.X - biomeSize - 3; - int XEnd = origin.X + biomeSize + 3; - - int YStart = (int)(origin.Y - verticalRadius * 0.4f) - 3; - int YEnd = origin.Y + verticalRadius + 3; - - int newTunnelXLeft = (startX - 300); - int newTunnelYLeft = (startY - 10); - - int newTunnelXRight = (startX + 300); - int newTunnelYRight = (startY - 10); - - - //place another barrier so the gleaming burrows doesnt just burst into the gully - - var basaltcircle = new Shapes.Circle(30); - GenAction paintBasalt = Actions.Chain( - new Actions.Clear(), - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()), - new Actions.SetFrames(true) - ); - - for (int X = XStart; X < XEnd; X += 14) - { - for (int Y = YStart; Y <= YEnd; Y += 12) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) - && Y > origin.Y - 10) - { - WorldUtils.Gen(new Point(X - 5, Y + 5), basaltcircle, paintBasalt); - } - } - } - - var Obsidiancircle = new Shapes.Circle(13); - GenAction paintObsidian = Actions.Chain( - new Actions.Clear(), - new Actions.SetTile((ushort)ModContent.TileType()), - new Actions.PlaceWall((ushort)ModContent.WallType()), - new Actions.SetFrames(true) - ); - - for (int X = XStart; X < XEnd; X += 5) - { - for (int Y = YStart; Y <= YEnd; Y += 5) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) - && Y > origin.Y - 10) - { - WorldUtils.Gen(new Point(X - 2, Y + 7), Obsidiancircle, paintObsidian); - } - } - } - - - //place the gleaming burrows caverns - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - Tile t = Main.tile[X, Y]; - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 15) - { - //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); - t.WallType = (ushort)ModContent.WallType(); - } - - //place clean transition between the burrows and the other biomes - if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - } - } - else - { - - - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); - - //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; - - //kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - WorldGen.KillTile(X, Y); - } - else - { - t.TileType = Navystone; - t.HasTile = true; - } - - float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; - float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; - float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; - - if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) - { - t.WallType = (ushort)ModContent.WallType(); - } - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - if (t.WallType == WallID.None) - t.WallType = NavystoneWall; - } - - - - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; - } - } - } - } - - //Tunnels - MiscWorldgenRoutines.ClearTunnel(startX - 200, startY + 40, newTunnelXLeft, newTunnelYLeft, 3, (ushort)ModContent.WallType(), 2, false, false); - MiscWorldgenRoutines.ClearTunnel(startX + 200, startY + 40, newTunnelXRight, newTunnelYRight, 3, (ushort)ModContent.WallType(), 2, false, false); - - //cleanup the perlin caves - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - } - } - } - - //place extra tiles - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); - } - } - } - } - - - } - - //Very bottom of the biome (Clam Den) - public static void PlaceClamDen(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.ClamDenX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.ClamDenY; - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - Point origin = new Point(startX, startY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.70f; - float otherAngle = MathHelper.PiOver2 - angle; - - int biomeSize = 80 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 10f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - //place the Clam Den caverns - for (int X = origin.X - biomeSize - 190; X <= origin.X + biomeSize + 190; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - Tile t = Main.tile[X, Y]; - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 50) - { - //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); - t.WallType = (ushort)ModContent.WallType(); - } - //place clean transition between the burrows and the other biomes - if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) - { - WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else - { - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - t.WallType = (ushort)ModContent.WallType(); - } - - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; - } - } - } - } - - - //cleanup the perlin caves - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - } - } - } - - - //place extra tiles - for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); - } - } - } - } - - //cleanup again - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - - Tile.SmoothSlope(X, Y); - } - } - } - } - - //public static void PlaceBasaltGullyBorderBlend(int startPosX, int startPosY) - //{ - // int startX = (startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX); - - // int startY = (startPosY + SSOffsets.GlobalY + SSOffsets.BasaltGullyY) - 90; - - // int biomeSize = 250 + (Main.maxTilesX / 180); - - // ushort Basalt = (ushort)ModContent.TileType(); - // ushort BasaltWall = (ushort)ModContent.WallType(); - - // //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - // for (int X = startX - biomeSize - 80; X < startX + biomeSize + 80; X += 1) - // { - // const int totalCurveDepth = -320; - // const int totalCurveDepthTop = 70; - - // var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); - // var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); - - - // int curveDepth = (int)MathHelper.Lerp( - // totalCurveDepth, - // 0f, squrt); - // int curveDepth2 = (int)MathHelper.Lerp( - // totalCurveDepth, 0f, squrt2); - // int curveDepthtop = (int)MathHelper.Lerp( - // totalCurveDepthTop, - // 0f, squrt); - // int curveDepth2top = (int)MathHelper.Lerp( - // totalCurveDepthTop, - // 0f, squrt2); - - // int Height = Main.maxTilesY - 270 + curveDepth + curveDepth2; - // int StartHeight = startY - (625) + curveDepthtop + curveDepth2top; - - // for (int Y = StartHeight; Y <= Height; Y++) - // { - // Tile t = Main.tile[X, Y]; - // if (Main.tile[X, Y].HasTile) - // { - // t.TileType = Basalt; - // t.HasTile = true; - // } - - // t.WallType = BasaltWall; - // } - // } - - // //cleanup - // for (int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) - // { - // for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) - // { - // //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - // bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - // bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - // bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - // bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - // if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - // { - // WorldGen.KillTile(X, Y); - // } - - // //kill random single floating tiles - // if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - // { - // WorldGen.KillTile(X, Y); - // } - // Tile.SmoothSlope(X, Y); - // } - // } - //} - public static void PlaceBasaltGully(int startPosX, int startPosY) - { - int startX = startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX; - - int startY = startPosY + SSOffsets.GlobalY + SSOffsets.BasaltGullyY; - - int biomeSize = 270 + (Main.maxTilesX / 180); - - ushort Basalt = (ushort)ModContent.TileType(); - ushort BasaltWall = (ushort)ModContent.WallType(); - - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); - - //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - for (int X = startX - biomeSize - 80; X < startX + biomeSize + 80; X += 1) - { - int leftEdge = startX - biomeSize - 60; - int rightEdge = startX + biomeSize + 60; - int basaltbordernoise = 270 + Main.rand.Next(0, 4); - int basaltbordernoisetop = 625 + Main.rand.Next(0, 4); - const int totalCurveDepth = -475; - const int totalCurveDepthTop = -100; - - var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); - var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); - - - int curveDepth = (int)MathHelper.Lerp( - totalCurveDepth, - 0f, squrt); - int curveDepth2 = (int)MathHelper.Lerp( - totalCurveDepth, 0f, squrt2); - int curveDepthtop = (int)MathHelper.Lerp( - totalCurveDepthTop, - 0f, squrt); - int curveDepth2top = (int)MathHelper.Lerp( - totalCurveDepthTop, - 0f, squrt2); - - int Height = Main.maxTilesY - basaltbordernoise + curveDepth + curveDepth2; - int StartHeight = startY - (basaltbordernoisetop) + curveDepthtop + curveDepth2top; - - for (int Y = StartHeight; Y <= Height; Y++) - { - int leftIndent = Main.rand.Next(0, 12); - int rightIndent = Main.rand.Next(0, 12); - if (X < leftEdge + leftIndent || X > rightEdge - rightIndent) - continue; - - Tile t = Main.tile[X, Y]; - t.ClearEverything(); - t.TileType = Basalt; - t.WallType = BasaltWall; - t.HasTile = true; - } - } - - //place caverns and lava - for (int X = startX - biomeSize - (Main.maxTilesX / 25); X <= startX + biomeSize + (Main.maxTilesX / 25); X++) - { - for (int Y = startY; Y <= Main.maxTilesY - 190; Y++) - { - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - Tile t = Main.tile[X, Y]; - //place caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 130, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 5.5f + 0.235f; - - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - t.HasTile = false; - t.LiquidType = LiquidID.Lava; - } - - float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; - float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; - float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; - - if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) - { - if (t.WallType == BasaltWall) - { - WorldGen.KillWall(X, Y); - } - } - - //place lava - if (WorldGen.genRand.NextBool(2000)) - { - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new Modifiers.Blotches( - WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Actions.SetLiquid(LiquidID.Lava, 255))); - } - } - } - } - - //place sand blocks - for (int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) - { - for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed basalt - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 3, ModContent.TileType()); - } - } - } - - //cleanup - for(int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) - { - for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - - //if any sand is floating, put tiles below it - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); - } - Tile.SmoothSlope(X, Y); - - Tile t = Main.tile[X, Y]; - if (Main.tile[X, Y].WallType == BasaltWall) - { - //get rid of water - if (Main.tile[X, Y].LiquidType == LiquidID.Water) - { - t.LiquidType = LiquidID.Lava; - } - - //get rid of obsidian blocks - if (Main.tile[X, Y].TileType == TileID.Obsidian) - { - WorldGen.KillTile(X, Y); + int num14 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y - 1].TileType = type; + Main.tile[x, y - 1].Get().HasTile = true; + Main.tile[x, y - 1].TileFrameX = (short)num14; + Main.tile[x, y - 1].TileFrameY = 36; + Main.tile[x, y].TileType = type; + Main.tile[x, y].Get().HasTile = true; + Main.tile[x, y].TileFrameX = (short)num14; + Main.tile[x, y].TileFrameY = 54; } } } } } - - - //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it - //public static void BasaltGullyLavaCleanup(int startPosX, int startPosY) - //{ - // ushort BasaltWall = (ushort)ModContent.WallType(); - // int biomeSize = 230 + (Main.maxTilesX / 180); - - // for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) - // { - // for (int Y = startPosY + 50; Y <= Main.maxTilesY - 200; Y++) - // { - - // } - // } - //} - - - //place all the ambient tiles in the sunken sea - public static void PlaceSunkenSeaAmbience() - { - bool shipPlaced = false; - //first clean up unnecessary chunks of tiles - CleanOutSmallClumps(); - - // Loop through the area around the Sunken Sea and check for the specific tiles - int minX = Math.Max(20, GenVars.UndergroundDesertLocation.Left - 20); - int maxX = Math.Min(GenVars.UndergroundDesertLocation.Right + 20, Main.maxTilesX - 20); - for (int X = minX; X <= maxX; X++) - { - for (int Y = (int)Main.worldSurface; Y <= Main.UnderworldLayer; Y++) - { - if (WorldGen.genRand.NextBool(200)) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - if (WorldGen.genRand.NextBool(200)) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - - - //Timeless Shores ambiant tiles - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int MediumShorePileVariants = WorldGen.genRand.Next(3); - int DriftwoodVariants = WorldGen.genRand.Next(6); - int ShorePileVariants = WorldGen.genRand.Next(9); - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(100)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(100)) - {; - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(100)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - //Shore piles - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: ShorePileVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: MediumShorePileVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: MediumShorePileVariants); - } - } - - - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - // stay in-bounds - if (Y > 0) - { - Tile above = Main.tile[X, Y - 1]; - - // only if it's open air (no solid tile), and we don't overwrite other special liquids other than lava (just incase) - if (!above.HasTile && - above.Get().LiquidType != LiquidID.Honey && - above.Get().LiquidType != LiquidID.Shimmer) - { - above.Get().LiquidType = LiquidID.Water; - above.LiquidAmount = byte.MaxValue; // 255 - } - } - } - - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int DriftwoodVariants = WorldGen.genRand.Next(6); - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(80)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(60)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(60)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - } - - //gleaming burrows ambient tiles - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int NavystonePileVariants = WorldGen.genRand.Next(6); - //brain coral - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - //small brain coral - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - - //tube coral - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - //small tube coral - if (WorldGen.genRand.NextBool(12)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - - //anemonies - if (WorldGen.genRand.NextBool(18)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - - //giant navystone piles - if (WorldGen.genRand.NextBool(20)) - { - ushort[] GiantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(GiantPiles)); - } - - //navystone piles - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); - } - - //small navystone piles - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); - } - - //misc piles - if (WorldGen.genRand.NextBool(6)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 6)); - } - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 6)); - } - - //kelp bushes - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WorldGen.genRand.Next(0, 3)); - } - - //Pearls - if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - - if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int Rand8() => WorldGen.genRand.Next(8); - int MediumSeaPrismCrystalVariants = Rand8(); - //Medium Sea Prism down - if (WorldGen.genRand.NextBool(9)) - { - ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); - } - if (WorldGen.genRand.NextBool(9)) - { - ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); - } - if (WorldGen.genRand.NextBool(9)) - { - ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); - } - if (WorldGen.genRand.NextBool(9)) - { - ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); - } - } - //grow depth vines on navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int TableCoralVariants = WorldGen.genRand.Next(3); - int SpeleothemsVariants = WorldGen.genRand.Next(3); - int NavystonePileVariants = WorldGen.genRand.Next(6); - - if (WorldGen.genRand.NextBool(30) && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.PlaceTile(X + 2, Y, ModContent.TileType(), true, false, -1, TableCoralVariants); - } - - if (WorldGen.genRand.NextBool(30) && !Main.tile[X - 1, Y].HasTile) - { - WorldGen.PlaceTile(X - 2, Y, ModContent.TileType(), true, false, -1, TableCoralVariants); - } - - //Speleothems below - //stalactites - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y + 2, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); - } - //small stalactites - if (WorldGen.genRand.NextBool(8)) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); - } - //stalagmites - if (WorldGen.genRand.NextBool(12)) - { - WorldGen.PlaceTile(X, Y - 2, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); - } - //small stalagmites - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); - } - - //giant navystone piles - if (WorldGen.genRand.NextBool()) - { - ushort[] GiantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(GiantPiles)); - } - - //navystone piles - if (WorldGen.genRand.NextBool()) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); - } - - //small navystone piles - if (WorldGen.genRand.NextBool(5)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); - } - } - //Mossy Stone - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - if (WorldGen.genRand.NextBool(5)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WorldGen.genRand.Next(0, 5)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WorldGen.genRand.Next(0, 3)); - } - } - //Polyp Forest Ambient tiles - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int RandStyle() => WorldGen.genRand.Next(8); - int style = RandStyle(); - //BranchCoralsOnLimestone - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, style); - } - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, style); - } - } - //GilHerb Vines - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int BranchCoralVariants = WorldGen.genRand.Next(8); - int WideScarletSeagrassVariants = WorldGen.genRand.Next(4); - int DriftwoodVariants = WorldGen.genRand.Next(6); - - //BranchCoralsOnSand - if (WorldGen.genRand.NextBool(25)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, BranchCoralVariants); - } - if (WorldGen.genRand.NextBool(25)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, BranchCoralVariants); - } - if (WorldGen.genRand.NextBool(25)) - { - ushort[] DigitateCorals = new ushort[] { (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DigitateCorals)); - } - if (WorldGen.genRand.NextBool(12)) - { - ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(FryCorals)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WideScarletSeagrassVariants); - } - if (WorldGen.genRand.NextBool(12)) - { - ushort[] StalkCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(StalkCorals)); - } - if (WorldGen.genRand.NextBool(16)) - { - ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(FryCorals)); - } - if (WorldGen.genRand.NextBool(18)) - { - ushort[] TallDigitateCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(TallDigitateCorals)); - } - if (WorldGen.genRand.NextBool(6)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 11)); - } - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(),true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (!shipPlaced) - { - if (WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), mute: true)) - shipPlaced = true; - } - //small limestone piles - if (WorldGen.genRand.NextBool(25)) - { - WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: DriftwoodVariants); - } - } - - //radiant reefs ambient tiles - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - //Coral Blocks (to be removed when we have real gen for them - if (WorldGen.genRand.NextBool(400) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || - (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile))) - { - ushort[] Corals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Corals)) - })); - } - - int DriftwoodVariants = WorldGen.genRand.Next(6); - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - if (WorldGen.genRand.NextBool(30)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); - } - //multi-colored corals - if (WorldGen.genRand.NextBool(3)) - { - ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(ColoredCorals)); - } - - //blue coral trees - if (WorldGen.genRand.NextBool(8)) - { - ushort[] BlueCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BlueCorals)); - } - - //brown coral trees - if (WorldGen.genRand.NextBool(8)) - { - ushort[] BrownCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BrownCorals)); - } - - //fan coral - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); - } - - //misc piles - if (WorldGen.genRand.NextBool(6)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 9)); - } - if (WorldGen.genRand.NextBool(16)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - if (WorldGen.genRand.NextBool(20)) - { - WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, style: WorldGen.genRand.Next(0, 3)); - } - - //misc corals - if (WorldGen.genRand.NextBool()) - { - ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(MiscCorals)); - } - } - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - if (WorldGen.genRand.NextBool()) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } - - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - int Rand4() => WorldGen.genRand.Next(4); - int WallCoralVariants = Rand4(); - - if (WorldGen.genRand.NextBool(5) && - Main.tile[X, Y].HasTile && - Main.tile[X, Y + 1].HasTile && - Main.tile[X, Y + 2].HasTile && - - !Main.tile[X + 1, Y].HasTile && - !Main.tile[X + 1, Y + 1].HasTile && - !Main.tile[X + 1, Y + 2].HasTile && - - !Main.tile[X + 2, Y].HasTile && - !Main.tile[X + 2, Y + 1].HasTile && - !Main.tile[X + 2, Y + 2].HasTile && - - !Main.tile[X + 3, Y].HasTile && - !Main.tile[X + 3, Y + 1].HasTile && - !Main.tile[X + 3, Y + 2].HasTile && - - !Main.tile[X + 4, Y].HasTile && - !Main.tile[X + 4, Y + 1].HasTile && - !Main.tile[X + 4, Y + 2].HasTile) - { - WorldGen.PlaceTile(X + 2, Y, ModContent.TileType(), true, false, -1, WallCoralVariants); - } - - if (WorldGen.genRand.NextBool(5) && - Main.tile[X, Y].HasTile && - Main.tile[X, Y + 1].HasTile && - Main.tile[X, Y + 2].HasTile && - - !Main.tile[X - 1, Y].HasTile && - !Main.tile[X - 1, Y + 1].HasTile && - !Main.tile[X - 1, Y + 2].HasTile && - - !Main.tile[X - 2, Y].HasTile && - !Main.tile[X - 2, Y + 1].HasTile && - !Main.tile[X - 2, Y + 2].HasTile && - - !Main.tile[X - 3, Y].HasTile && - !Main.tile[X - 3, Y + 1].HasTile && - !Main.tile[X - 3, Y + 2].HasTile && - - !Main.tile[X - 4, Y].HasTile && - !Main.tile[X - 4, Y + 1].HasTile && - !Main.tile[X - 4, Y + 2].HasTile) - { - WorldGen.PlaceTile(X - 2, Y, ModContent.TileType(), true, false, -1, WallCoralVariants); - } - } - } - } - } - - //check if theres enough tiles to place sand below - public static bool PlaceSand(int X, int Y, int height, int tileType) - { - for (int j = Y; j <= Y + height; j++) - { - if (Main.tile[X, j].HasTile && Main.tile[X, j + 1].HasTile && Main.tile[X, j + 2].HasTile && Main.tile[X, j + 3].HasTile && - Main.tile[X - 1, j + 3].HasTile && Main.tile[X + 1, j + 3].HasTile) - { - Main.tile[X, j].TileType = (ushort)tileType; - } - else - { - return false; - } - } - - return true; - } - - //placing sea prism geodes - public static bool PlaceGeode(int X, int Y, int radius) - { - int crystalNearby = 0; - - //check a 20 by 20 square for other geodes before placing - for (int i = X - 20; i < X + 20; i++) - { - for (int j = Y - 20; j < Y + 20; j++) - { - //dont allow geodes to place if another one is too close - if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == ModContent.TileType()) - { - crystalNearby++; - if (crystalNearby > 0) - { - return false; - } - } - } - } - - ShapeData circle1 = new ShapeData(); - ShapeData circle2 = new ShapeData(); - ShapeData circle3 = new ShapeData(); - - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - GenAction blotchMod2 = new Modifiers.Blotches(1, 0.1); - - //first circle of navystone - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle1) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle1), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - - //second circle of prisms - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle2) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle2), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - - //clear out the middle of the circle - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 9), Actions.Chain(new GenAction[] - { - blotchMod2.Output(circle3) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle3), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), - new Actions.SetLiquid(), - })); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] - { - new Actions.PlaceWall((ushort)ModContent.WallType()) - })); - - return true; - } - - //method to clean up small clumps of tiles (taken from the sulphur sea generation) - public static void CleanOutSmallClumps() - { - List blockTileTypes = new() - { - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - }; - - void getAttachedPoints(int x, int y, List points) - { - Tile t = CalamityUtils.ParanoidTileRetrieval(x, y); - Point p = new(x, y); - - if (!blockTileTypes.Contains(t.TileType) || !t.HasTile || points.Count > 75 || points.Contains(p)) - { - return; - } - - points.Add(p); - - getAttachedPoints(x + 1, y, points); - getAttachedPoints(x - 1, y, points); - getAttachedPoints(x, y + 1, points); - getAttachedPoints(x, y - 1, points); - } - - for (int x = 20; x < Main.maxTilesX - 20; x += 1) - { - for (int y = 20; y < Main.maxTilesY - 20; y++) - { - List chunkPoints = new(); - getAttachedPoints(x, y, chunkPoints); - - int cutoffLimit = 75; - if (chunkPoints.Count >= 1 && chunkPoints.Count < cutoffLimit) - { - foreach (Point p in chunkPoints) - { - WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(true), - new Actions.ClearWall(true) - })); - } - } - } - } - } - - - //method to make sure things only generate in each biome circle - public static bool CheckInBiomeArea(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false, bool collapseBottom = false) - { - Vector2 point = tile.ToWorldCoordinates(); - - if (collapse) - { - float distY = center.Y - point.Y; - point.Y -= distY * 4f; - } - if (collapseBottom) - { - float distY = center.Y - point.Y; - point.Y += distY * 4f; - } - float distance1 = Vector2.Distance(point, focus1); - float distance2 = Vector2.Distance(point, focus2); - distance = distance1 + distance2; - - return distance <= distanceConstant; - } + */ } }