Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ PlaceCannon()

static void Terraria.WorldGen.PlaceCannon ( int x,
int y,
ushort type,
int style = 0 )
inlinestatic

Definition at line 42250 of file WorldGen.cs.

42251 {
42252 if (x < 5 || x > Main.maxTilesX - 5 || y < 5 || y > Main.maxTilesY - 5)
42253 {
42254 return;
42255 }
42256 bool flag = true;
42257 for (int i = x - 1; i < x + 3; i++)
42258 {
42259 for (int j = y - 2; j < y + 1; j++)
42260 {
42261 if (Main.tile[i, j] == null)
42262 {
42263 Main.tile[i, j] = new Tile();
42264 }
42265 if (Main.tile[i, j].active())
42266 {
42267 flag = false;
42268 }
42269 }
42270 if (Main.tile[i, y + 1] == null)
42271 {
42272 Main.tile[i, y + 1] = new Tile();
42273 }
42274 if (!SolidTile2(i, y + 1) && i != x - 1 && i != x + 2)
42275 {
42276 flag = false;
42277 }
42278 }
42279 int num = 72 * style;
42280 int num2 = 0;
42281 if (flag)
42282 {
42283 Main.tile[x - 1, y - 2].active(active: true);
42284 Main.tile[x - 1, y - 2].frameY = (short)num2;
42285 Main.tile[x - 1, y - 2].frameX = (short)num;
42286 Main.tile[x - 1, y - 2].type = type;
42287 Main.tile[x, y - 2].active(active: true);
42288 Main.tile[x, y - 2].frameY = (short)num2;
42289 Main.tile[x, y - 2].frameX = (short)(18 + num);
42290 Main.tile[x, y - 2].type = type;
42291 Main.tile[x + 1, y - 2].active(active: true);
42292 Main.tile[x + 1, y - 2].frameY = (short)num2;
42293 Main.tile[x + 1, y - 2].frameX = (short)(36 + num);
42294 Main.tile[x + 1, y - 2].type = type;
42295 Main.tile[x + 2, y - 2].active(active: true);
42296 Main.tile[x + 2, y - 2].frameY = (short)num2;
42297 Main.tile[x + 2, y - 2].frameX = (short)(54 + num);
42298 Main.tile[x + 2, y - 2].type = type;
42299 Main.tile[x - 1, y - 1].active(active: true);
42300 Main.tile[x - 1, y - 1].frameY = (short)(num2 + 18);
42301 Main.tile[x - 1, y - 1].frameX = (short)num;
42302 Main.tile[x - 1, y - 1].type = type;
42303 Main.tile[x, y - 1].active(active: true);
42304 Main.tile[x, y - 1].frameY = (short)(num2 + 18);
42305 Main.tile[x, y - 1].frameX = (short)(18 + num);
42306 Main.tile[x, y - 1].type = type;
42307 Main.tile[x + 1, y - 1].active(active: true);
42308 Main.tile[x + 1, y - 1].frameY = (short)(num2 + 18);
42309 Main.tile[x + 1, y - 1].frameX = (short)(36 + num);
42310 Main.tile[x + 1, y - 1].type = type;
42311 Main.tile[x + 2, y - 1].active(active: true);
42312 Main.tile[x + 2, y - 1].frameY = (short)(num2 + 18);
42313 Main.tile[x + 2, y - 1].frameX = (short)(54 + num);
42314 Main.tile[x + 2, y - 1].type = type;
42315 Main.tile[x - 1, y].active(active: true);
42316 Main.tile[x - 1, y].frameY = (short)(num2 + 36);
42317 Main.tile[x - 1, y].frameX = (short)num;
42318 Main.tile[x - 1, y].type = type;
42319 Main.tile[x, y].active(active: true);
42320 Main.tile[x, y].frameY = (short)(num2 + 36);
42321 Main.tile[x, y].frameX = (short)(18 + num);
42322 Main.tile[x, y].type = type;
42323 Main.tile[x + 1, y].active(active: true);
42324 Main.tile[x + 1, y].frameY = (short)(num2 + 36);
42325 Main.tile[x + 1, y].frameX = (short)(36 + num);
42326 Main.tile[x + 1, y].type = type;
42327 Main.tile[x + 2, y].active(active: true);
42328 Main.tile[x + 2, y].frameY = (short)(num2 + 36);
42329 Main.tile[x + 2, y].frameX = (short)(54 + num);
42330 Main.tile[x + 2, y].type = type;
42331 }
42332 }
static bool SolidTile2(Tile testTile)

References Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.DataStructures.Tile, Terraria.Main.tile, and System.type.