@@ -12,7 +12,7 @@ public class Plugin : TerrariaPlugin
1212 #region 插件信息
1313 public override string Name => "生成基础建设" ;
1414 public override string Author => "羽学" ;
15- public override Version Version => new Version ( 1 , 5 , 0 ) ;
15+ public override Version Version => new Version ( 1 , 5 , 1 ) ;
1616 public override string Description => "给新世界创建NPC住房、仓库、洞穴刷怪场、地狱/微光直通车、地表和地狱世界级平台(轨道)" ;
1717 #endregion
1818
@@ -28,6 +28,7 @@ public override void Initialize()
2828 HelpText = "生成基础建设"
2929 } ) ;
3030 }
31+
3132 protected override void Dispose ( bool disposing )
3233 {
3334 if ( disposing )
@@ -68,37 +69,44 @@ private static void OnGamePostInitialize(EventArgs args)
6869 //地狱直通车与刷怪场
6970 foreach ( var item in Config . HellTunnel )
7071 {
71- if ( ! Main . zenithWorld || ! Main . remixWorld ) //不是颠倒种子
72- {
73- if ( Config . HellTunnel [ 0 ] . Enabled7 ) //直通车是否贯穿刷怪场
74- {
75- RockTrialField ( Main . rockLayer , item . Height , item . Width3 , item . Center ) ;
76- HellTunnel ( Main . spawnTileX + item . SpawnTileX , Main . spawnTileY + item . SpawnTileY , item . Width ) ;
77- }
78- else //换个顺序就能避免直通车覆盖刷怪场
79- HellTunnel ( Main . spawnTileX + item . SpawnTileX , Main . spawnTileY + item . SpawnTileY , item . Width ) ;
80- RockTrialField ( Main . rockLayer , item . Height , item . Width3 , item . Center ) ;
81- }
82-
83- else //颠倒
72+ if ( Main . zenithWorld || Main . remixWorld ) //不是颠倒种子
8473 {
8574 if ( Config . HellTunnel [ 0 ] . Enabled7 ) //直通车是否贯穿刷怪场
8675 {
8776 //刷怪场 = 地狱层 除一半 补上自定义高度
8877 RockTrialField ( Main . rockLayer / 2 + item . Height , item . Height , item . Width3 , item . Center ) ;
8978 //直通车 = 地狱 - 地表 - 世界平台高度
90- HellTunnel ( Main . spawnTileX + item . SpawnTileX , ( int ) Main . rockLayer - ( int ) Main . worldSurface - ( ( int ) sky - Config . WorldPlatform [ 0 ] . SkyY ) , item . Width ) ;
79+ HellTunnel ( Main . spawnTileX + item . SpawnTileX , ( int ) Main . rockLayer - ( int ) Main . worldSurface - ( ( int ) sky - Config . WorldPlatform [ 0 ] . SkyY * 2 ) , item . Width ) ;
9180 }
9281 else //没啥不同就换个先后顺序
9382 {
94- HellTunnel ( Main . spawnTileX + item . SpawnTileX , ( int ) Main . rockLayer - ( int ) Main . worldSurface - ( ( int ) sky - Config . WorldPlatform [ 0 ] . SkyY ) , item . Width ) ;
83+ HellTunnel ( Main . spawnTileX + item . SpawnTileX , ( int ) Main . rockLayer - ( int ) Main . worldSurface - ( ( int ) sky - Config . WorldPlatform [ 0 ] . SkyY * 2 ) , item . Width ) ;
9584 RockTrialField ( Main . rockLayer / 2 + item . Height , item . Height , item . Width3 , item . Center ) ;
9685 }
9786 }
87+ else
88+ {
89+ if ( Config . HellTunnel [ 0 ] . Enabled7 )
90+ {
91+ RockTrialField ( Main . rockLayer , item . Height , item . Width3 , item . Center ) ;
92+ HellTunnel ( Main . spawnTileX + item . SpawnTileX , Main . spawnTileY + item . SpawnTileY , item . Width ) ;
93+ }
94+ else
95+ {
96+ HellTunnel ( Main . spawnTileX + item . SpawnTileX , Main . spawnTileY + item . SpawnTileY , item . Width ) ;
97+ RockTrialField ( Main . rockLayer , item . Height , item . Width3 , item . Center ) ;
98+ }
99+ }
98100
99101 //微光湖直通车
100- if ( ! Main . zenithWorld || ! Main . remixWorld || ! Main . tenthAnniversaryWorld ) ShimmerBiome ( item . Width2 ) ;
101- else ZenithShimmerBiome ( item . Width2 ) ;
102+ if ( Main . zenithWorld || Main . tenthAnniversaryWorld )
103+ {
104+ ZenithShimmerBiome ( item . Width2 ) ;
105+ }
106+ else
107+ {
108+ ShimmerBiome ( item . Width2 ) ;
109+ }
102110
103111 //地狱平台不用改判断 天顶可以继续用 考虑活动范围不够大 可以往上升一点
104112 UnderworldPlatform ( Main . UnderworldLayer + item . PlatformY , item . PlatformY ) ;
@@ -123,6 +131,7 @@ private static void OnGamePostInitialize(EventArgs args)
123131 Commands . HandleCommand ( TSPlayer . Server , "/save" ) ;
124132 Commands . HandleCommand ( TSPlayer . Server , "/clear i 9999" ) ;
125133
134+ Configuration . Read ( ) ;
126135 Config . Enabled = false ;
127136 Config . Write ( ) ;
128137 }
@@ -161,24 +170,29 @@ private static void RockTrialField(double posY, int Height, int Width, int Cente
161170
162171 WorldGen . PlaceTile ( x , middle + 8 + CenterVal , Config . HellTunnel [ 0 ] . PlatformID , false , true , - 1 , Config . HellTunnel [ 0 ] . PlatformStyle ) ; //中间下8格放一层方便站人
163172
164-
165- for ( int wallY = middle + 1 ; wallY <= middle + 7 + CenterVal ; wallY ++ )
173+ for ( int wallY = middle + 3 ; wallY <= middle + 7 + CenterVal ; wallY ++ )
166174 {
167175 Main . tile [ x , wallY ] . wall = 155 ; // 放置墙壁
168176 }
169177
178+ //定刷怪区
179+ for ( int i = 1 ; i <= 3 ; i ++ )
180+ {
181+ for ( int j = 61 ; j <= 83 ; j ++ )
182+ {
183+ WorldGen . PlaceWall ( CenterLeft - j + 8 + CenterVal , middle + i , 164 , false ) ; // 左 62 - 84格刷怪区 放红玉晶莹墙警示
184+ WorldGen . PlaceWall ( CenterRight + j - 8 - CenterVal , middle + i , 164 , false ) ; // 右 62 - 84格刷怪区 放红玉晶莹墙警示
185+ }
186+ }
187+
170188 WorldGen . PlaceTile ( x , middle + 11 + CenterVal , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ; //中间下11格放箱子的实体块
171189
172190 WorldGen . PlaceTile ( x , middle + 10 + CenterVal , Config . Chests [ 0 ] . ChestID , false , true , - 1 , Config . Chests [ 0 ] . ChestStyle ) ; //中间下10格放箱子
173191
174192 WorldGen . PlaceTile ( x , middle + 2 , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ; //放计时器的平台
175193
176- Main . tile [ x , middle + 3 ] . liquid = 60 ; //设置1格液体
177- Main . tile [ x , middle + 3 ] . liquidType ( 1 ) ; // 设置为岩浆
178- WorldGen . SquareTileFrame ( x , middle + 3 , false ) ;
179194 WorldGen . PlaceTile ( x , middle + 4 , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ; //防掉怪下来
180195
181-
182196 // 如果x值在中心范围内,放置10格高的方块
183197 if ( x >= CenterLeft && x <= CenterRight )
184198 {
@@ -218,15 +232,6 @@ private static void RockTrialField(double posY, int Height, int Width, int Cente
218232 }
219233 }
220234 }
221-
222- //定刷怪区
223- for ( int i = 0 ; i <= 3 ; i ++ )
224- {
225- WorldGen . PlaceTile ( CenterLeft - 61 , middle + i , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ;
226- WorldGen . PlaceTile ( CenterRight + 61 , middle + i , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ;
227- WorldGen . PlaceTile ( CenterLeft - 85 , middle + i , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ;
228- WorldGen . PlaceTile ( CenterRight + 85 , middle + i , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ;
229- }
230235 }
231236 else //不在中心 左右生成半砖推怪平台
232237 {
@@ -266,13 +271,37 @@ private static void RockTrialField(double posY, int Height, int Width, int Cente
266271 WorldGen . PlaceTile ( CenterRight + 1 , middle + 5 , 136 , false , true , - 1 , 0 ) ;
267272 }
268273
269- //放个花园侏儒
270- WorldGen . PlaceGnome ( CenterLeft - 5 , middle + 7 , 0 ) ;
274+ //左边 放篝火、影烛、水蜡烛、花园侏儒、心灯、巴斯特雕像
275+ WorldGen . PlaceObject ( CenterLeft - 2 , middle + 7 + CenterVal , 215 , false , 0 , 0 , - 1 , - 1 ) ;
276+ WorldGen . PlaceObject ( CenterLeft - 4 , middle + 7 + CenterVal , 646 , false , 0 , 0 , - 1 , - 1 ) ;
277+ WorldGen . PlaceObject ( CenterLeft - 5 , middle + 7 + CenterVal , 49 , false , 0 , 0 , - 1 , - 1 ) ;
278+ WorldGen . PlaceGnome ( CenterLeft - 6 , middle + 7 + CenterVal , 0 ) ;
279+ WorldGen . PlaceObject ( CenterLeft - 6 , middle + 3 + CenterVal , 42 , false , 9 , 0 , - 1 , - 1 ) ;
280+ WorldGen . PlaceObject ( CenterLeft - 8 , middle + 7 + CenterVal , 506 , false , 0 , 0 , - 1 , - 1 ) ;
281+
282+ //右边 放环境火把
283+ for ( int j = 5 ; j <= 23 ; j ++ )
284+ WorldGen . PlaceObject ( CenterRight + j , middle + 3 + CenterVal , 4 , false , j , - 1 , - 1 ) ;
285+
286+ //右边 无限飞镖
287+ for ( int k = 1 ; k <= 6 ; k ++ )
288+ {
289+ for ( int l = 0 ; l <= 3 ; l ++ )
290+ {
291+ //飞镖机关每30格放1个 一共6个 冷却时间为5秒 刚好无限飞镖
292+ WorldGen . PlaceTile ( CenterRight + 30 * k , middle + 1 , 137 , false , true , - 1 , 1 ) ;
293+ WorldGen . PlaceTile ( CenterRight + 30 * k , middle + 3 , 137 , false , true , - 1 , 1 ) ;
294+ WorldGen . PlaceWire ( CenterRight + 30 * k , middle + l ) ;
295+ //把飞镖机关虚化
296+ Main . tile [ CenterRight + 30 * k , middle + 1 ] . inActive ( true ) ;
297+ Main . tile [ CenterRight + 30 * k , middle + 3 ] . inActive ( true ) ;
298+ }
299+ }
271300 }
272301 }
273302 }
274303 }
275- //只清不建
304+ //只清场地不建刷怪场 帮定中心点与刷怪范围
276305 else if ( Config . HellTunnel [ 0 ] . Enabled6 )
277306 {
278307 for ( int y = ( int ) posY ; y > clear ; y -- )
@@ -282,7 +311,25 @@ private static void RockTrialField(double posY, int Height, int Width, int Cente
282311 Main . tile [ x , y + Height * 2 ] . ClearEverything ( ) ; // 清除方块
283312 WorldGen . PlaceTile ( x , top , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ; // 在清理顶部放1层(防液体流进刷怪场)
284313 WorldGen . PlaceTile ( x , bottom , Config . HellTunnel [ 0 ] . ID , false , true , - 1 , 0 ) ; //刷怪场底部放1层
285- WorldGen . PlaceTile ( CenterLeft , middle , 267 , false , true , - 1 , 0 ) ; //定中心
314+
315+ //定中心
316+ WorldGen . PlaceTile ( CenterLeft , middle , 267 , false , true , - 1 , 0 ) ;
317+ WorldGen . PlaceTile ( CenterRight , middle , 267 , false , true , - 1 , 0 ) ;
318+
319+ //定刷怪区
320+ for ( int i = 1 ; i <= 3 ; i ++ )
321+ {
322+ for ( int j = 61 ; j <= 83 ; j ++ )
323+ {
324+ WorldGen . PlaceWall ( CenterLeft - 60 + 8 + CenterVal , middle + i , 155 , false ) ; // 左 61格 放钻石晶莹墙
325+ WorldGen . PlaceWall ( CenterLeft - j + 8 + CenterVal , middle + i , 164 , false ) ; // 左 62 - 84格刷怪区 放红玉晶莹墙警示
326+ WorldGen . PlaceWall ( CenterLeft - 84 + 8 + CenterVal , middle + i , 155 , false ) ; // 左 85格 放钻石晶莹墙
327+
328+ WorldGen . PlaceWall ( CenterRight + 60 - 8 - CenterVal , middle + i , 155 , false ) ; // 右 61格 放钻石晶莹墙
329+ WorldGen . PlaceWall ( CenterRight + j - 8 - CenterVal , middle + i , 164 , false ) ; // 右 62 - 84格刷怪区 放红玉晶莹墙警示
330+ WorldGen . PlaceWall ( CenterRight + 84 - 8 - CenterVal , middle + i , 155 , false ) ; // 右 85格 放钻石晶莹墙
331+ }
332+ }
286333 }
287334 }
288335 }
@@ -688,6 +735,8 @@ private static void ZenithShimmerBiome(int Width)
688735 }
689736 }
690737
738+
739+
691740 //大量填充,根据邻近点合并,统计连通区域的大小(主打一个扫雷)
692741 private static void FloodFill ( int x , int y , int label , ref int [ ] labelMap , ref bool [ , ] skipTile )
693742 {
0 commit comments