本文整理汇总了C#中ISandbox类的典型用法代码示例。如果您正苦于以下问题:C# ISandbox类的具体用法?C# ISandbox怎么用?C# ISandbox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISandbox类属于命名空间,在下文中一共展示了ISandbox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ComponentViewModel
public ComponentViewModel(ISandbox _sandbox, IFrameworkFacade _frameworkFacade)
{
#region Pre-conditions
Contract.Requires(_sandbox != null);
Contract.Requires(_frameworkFacade != null);
#endregion
this.sandbox = _sandbox;
this.frameworkFacade = _frameworkFacade;
}
开发者ID:backlash,项目名称:Backlash,代码行数:10,代码来源:ComponentViewModel.cs
示例2: AddWater
public static void AddWater(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int x, int y)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (TileRefs(x, y).CheckingLiquid || (x >= Main.maxTilesX - 5 || y >= Main.maxTilesY - 5) || (x < 5 || y < 5) || TileRefs(x, y).Liquid == 0)
return;
if (Liquid.numLiquid >= Liquid.maxLiquid - 1)
{
LiquidBuffer.AddBuffer(TileRefs, x, y);
return;
}
TileRefs(x, y).SetCheckingLiquid(true);
Main.liquid[Liquid.numLiquid].kill = 0;
Main.liquid[Liquid.numLiquid].x = x;
Main.liquid[Liquid.numLiquid].y = y;
Main.liquid[Liquid.numLiquid].delay = 0;
TileRefs(x, y).SetSkipLiquid(false);
Liquid.numLiquid++;
if (Liquid.numLiquid < Liquid.maxLiquid / 3)
{
NetMessage.SendWater(x, y);
}
if (TileRefs(x, y).Active && (Main.tileWaterDeath[(int)TileRefs(x, y).Type] || (TileRefs(x, y).Lava && Main.tileLavaDeath[(int)TileRefs(x, y).Type])))
{
if (TileRefs(x, y).Type == 4 && TileRefs(x, y).FrameY == 176)
return;
if (WorldModify.gen)
{
TileRefs(x, y).SetActive(false);
return;
}
WorldModify.KillTile(TileRefs, sandbox, x, y);
NetMessage.SendData(17, -1, -1, "", 0, (float)x, (float)y);
}
}
开发者ID:emreuyls,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:41,代码来源:Liquid.cs
示例3: Update
/// <summary>
/// Updates the projectile's position, damage variables, etc.
/// </summary>
/// <param name="TileRefs">Reference to the ITile method, For usage between Sandbox and Realtime</param>
/// <param name="sandbox">Sandbox instance if needed</param>
/// <param name="i">Projectile index</param>
public void Update(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int i)
{
if (this.Active)
{
Vector2 value = this.Velocity;
if (this.Position.X <= Main.leftWorld || this.Position.X + (float)this.Width >= Main.rightWorld || this.Position.Y <= Main.topWorld || this.Position.Y + (float)this.Height >= Main.bottomWorld)
{
this.Active = false;
Reset(i);
return;
}
this.whoAmI = i;
if (this.soundDelay > 0)
{
this.soundDelay--;
}
this.netUpdate = false;
for (int j = 0; j < 255; j++)
{
if (this.playerImmune[j] > 0)
{
this.playerImmune[j]--;
}
}
this.AI(TileRefs, sandbox);
if (this.Owner < 255 && !Main.players[this.Owner].Active)
{
this.Kill(TileRefs, sandbox); // FIXME!
}
if (!this.ignoreWater)
{
bool flag;
bool flag2;
try
{
flag = Collision.LavaCollision(this.Position, this.Width, this.Height);
flag2 = Collision.WetCollision(this.Position, this.Width, this.Height);
if (flag)
{
this.lavaWet = true;
}
}
catch
{
this.Active = false;
Reset(i);
return;
}
if (this.wet && !this.lavaWet)
{
if (this.type == ProjectileType.N85_FLAMES ||
this.type == ProjectileType.N15_BALL_OF_FIRE ||
this.type == ProjectileType.N34_FLAMELASH)
{
this.Kill(TileRefs, sandbox);
}
if (this.type == ProjectileType.N2_FIRE_ARROW)
{
this.type = ProjectileType.N1_WOODEN_ARROW;
this.light = 0f;
}
}
if (this.type == ProjectileType.N80_ICE_BLOCK)
{
flag2 = false;
this.wet = false;
if (flag && this.ai[0] >= 0f)
{
this.Kill(TileRefs, sandbox);
}
}
if (flag2)
{
if (this.wetCount == 0)
{
this.wetCount = 10;
this.wet = true;
}
}
else
{
if (this.wet)
{
this.wet = false;
if (this.wetCount == 0)
{
this.wetCount = 10;
}
}
}
if (!this.wet)
{
this.lavaWet = false;
}
//.........这里部分代码省略.........
开发者ID:His-name-is-Joof,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:101,代码来源:Projectile.cs
示例4: Damage
/// <summary>
/// Runs damage calculation on hostile mobs and players
/// </summary>
public void Damage(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (this.type == ProjectileType.N18_ORB_OF_LIGHT || this.type == ProjectileType.N72_BLUE_FAIRY ||
this.type == ProjectileType.N86_PINK_FAIRY || this.type == ProjectileType.N87_PINK_FAIRY ||
this.type == ProjectileType.N111_BUNNY)
{
return;
}
int playerIndex = Main.myPlayer;
Player player = Main.players[playerIndex];
Rectangle rectangle = new Rectangle((int)this.Position.X, (int)this.Position.Y, this.Width, this.Height);
if (this.type == ProjectileType.N85_FLAMES || this.type == ProjectileType.N101_EYE_FIRE)
{
int num = 30;
rectangle.X -= num;
rectangle.Y -= num;
rectangle.Width += num * 2;
rectangle.Height += num * 2;
}
if (this.friendly && this.type != ProjectileType.N18_ORB_OF_LIGHT)
{
var creat = Creator as Player;
if (this.Owner == playerIndex)// || (Owner == 255 && creat != null && creat.whoAmi == playerIndex))
{
if (creat != null) player = creat;
if ((this.aiStyle == 16 || this.type == ProjectileType.N41_HELLFIRE_ARROW) && (this.timeLeft <= 1 || this.type == ProjectileType.N108_EXPLOSIVES))
{
if (player.Active && !player.dead && !player.immune && (!this.ownerHitCheck || Collision.CanHit(Main.players[this.Owner].Position, Main.players[this.Owner].Width, Main.players[this.Owner].Height, player.Position, player.Width, player.Height)))
{
if (player.Intersects(rectangle))
{
if (player.Position.X + (float)(player.Width / 2) < this.Position.X + (float)(this.Width / 2))
{
this.direction = -1;
}
else
{
this.direction = 1;
}
int dmg = Main.DamageVar((float)this.damage);
this.StatusPlayer(player);
player.Hurt(this, dmg, this.direction, true, false, Player.getDeathMessage(this.Owner, -1, this.whoAmI, -1));
NetMessage.SendData(26, -1, -1, Player.getDeathMessage(this.Owner, -1, this.whoAmI, -1), playerIndex, (float)this.direction, (float)dmg, 1f);
}
}
}
if (this.type != ProjectileType.N69_HOLY_WATER && this.type != ProjectileType.N70_UNHOLY_WATER &&
this.type != ProjectileType.N10_PURIFICATION_POWDER && this.type != ProjectileType.N11_VILE_POWDER)
{
int num = (int)(this.Position.X / 16f);
int num2 = (int)((this.Position.X + (float)this.Width) / 16f) + 1;
int num3 = (int)(this.Position.Y / 16f);
int num4 = (int)((this.Position.Y + (float)this.Height) / 16f) + 1;
if (num < 0)
{
num = 0;
}
if (num2 > Main.maxTilesX)
{
num2 = Main.maxTilesX;
}
if (num3 < 0)
{
num3 = 0;
}
if (num4 > Main.maxTilesY)
{
num4 = Main.maxTilesY;
}
for (int i = num; i < num2; i++)
{
for (int j = num3; j < num4; j++)
{
if (Main.tileCut[(int)TileRefs(i, j).Type] && TileRefs(i, j + 1).Type != 78)
{
var plr = Creator as Player;
if (plr == null || WorldModify.InvokeAlterationHook(this, plr, i, j, 0))
{
WorldModify.KillTile(TileRefs, sandbox, i, j);
NetMessage.SendData(17, -1, -1, "", 0, (float)i, (float)j);
}
}
}
}
}
if (this.damage > 0)
{
NPC npc;
for (int i = 0; i < NPC.MAX_NPCS; i++)
{
npc = Main.npcs[i];
if (npc.Active && !npc.dontTakeDamage && (!npc.friendly || (npc.type == NPCType.N22_GUIDE && this.Owner < 255 && Main.players[this.Owner].killGuide)) && (this.Owner < 0 || npc.immune[this.Owner] == 0))
//.........这里部分代码省略.........
开发者ID:His-name-is-Joof,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:101,代码来源:Projectile.cs
示例5: Check3x2
public static void Check3x2(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int i, int j, int type)
{
if (destroyObject)
return;
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
bool flag = false;
int num = i + (int)(TileRefs(i, j).FrameX / 18 * -1);
int num2 = j + (int)(TileRefs(i, j).FrameY / 18 * -1);
for (int k = num; k < num + 3; k++)
{
for (int l = num2; l < num2 + 2; l++)
{
if (!TileRefs(k, l).Active || (int)TileRefs(k, l).Type != type || (int)TileRefs(k, l).FrameX != (k - num) * 18 ||
(int)TileRefs(k, l).FrameY != (l - num2) * 18)
{
flag = true;
}
}
if (!TileRefs(k, num2 + 2).Active || !Main.tileSolid[(int)TileRefs(k, num2 + 2).Type])
{
flag = true;
}
}
if (flag)
{
destroyObject = true;
for (int m = num; m < num + 3; m++)
{
for (int n = num2; n < num2 + 3; n++)
{
if ((int)TileRefs(m, n).Type == type && TileRefs(m, n).Active)
KillTile(TileRefs, sandbox, m, n);
}
}
if (type == 14)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 32, 1, false, 0);
}
else if (type == 114)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 398, 1, false, 0);
}
else if (type == 26)
{
if (!noTileActions)
{
SmashAltar(TileRefs, sandbox, i, j);
}
}
else if (type == 17)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 33, 1, false, 0);
}
else if (type == 77)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 221, 1, false, 0);
}
else if (type == 86)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 332, 1, false, 0);
}
else if (type == 87)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 333, 1, false, 0);
}
else if (type == 88)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 334, 1, false, 0);
}
else if (type == 89)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 335, 1, false, 0);
}
else if (type == 133)
{
StorePlayerItem(sandbox, i * 16, j * 16, 32, 32, 524, 1, false, 0);
}
destroyObject = false;
for (int num3 = num - 1; num3 < num + 4; num3++)
{
for (int num4 = num2 - 1; num4 < num2 + 4; num4++)
TileFrame(TileRefs, sandbox, num3, num4);
}
}
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:89,代码来源:WorldModify.cs
示例6: StorePlayerItem
public static int StorePlayerItem(ISandbox sandbox, int X, int Y, int Width, int Height, int type, int stack = 1, bool noBroadcast = false, int pfix = 0, int NetID = 255)
{
if (sandbox != null)
sandbox.NewItem(X, Y, Width, Height, type, stack, noBroadcast, pfix, NetID);
else
return Item.NewItem(X, Y, Width, Height, type, stack, noBroadcast, pfix, NetID);
return 0;
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:9,代码来源:WorldModify.cs
示例7: SmashAltar
public static void SmashAltar(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int i, int j)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (!Main.hardMode || noTileActions || gen)
return;
int num = altarCount % 3;
int num2 = altarCount / 3 + 1;
float num3 = (float)(Main.maxTilesX / 4200);
int num4 = 1 - num;
num3 = num3 * 310f - (float)(85 * num);
num3 *= 0.85f;
num3 /= (float)num2;
if (num == 0)
{
NetMessage.SendData(25, -1, -1, "Your world has been blessed with Cobalt!", 255, 50f, 255f, 130f, 0);
num = 107;
num3 *= 1.05f;
}
else if (num == 1)
{
NetMessage.SendData(25, -1, -1, "Your world has been blessed with Mythril!", 255, 50f, 255f, 130f, 0);
num = 108;
}
else
{
NetMessage.SendData(25, -1, -1, "Your world has been blessed with Adamantite!", 255, 50f, 255f, 130f, 0);
num = 111;
}
int num5 = 0;
while ((float)num5 < num3)
{
int i2 = genRand.Next(100, Main.maxTilesX - 100);
double num6 = Main.worldSurface;
if (num == 108)
{
num6 = Main.rockLayer;
}
if (num == 111)
{
num6 = (Main.rockLayer + Main.rockLayer + (double)Main.maxTilesY) / 3.0;
}
int j2 = genRand.Next((int)num6, Main.maxTilesY - 150);
OreRunner(TileRefs, sandbox, i2, j2, (double)genRand.Next(5, 9 + num4), genRand.Next(5, 9 + num4), num);
num5++;
}
int num7 = genRand.Next(3);
while (num7 != 2)
{
int num8 = genRand.Next(100, Main.maxTilesX - 100);
int num9 = genRand.Next((int)Main.rockLayer + 50, Main.maxTilesY - 300);
if (TileRefs(num8, num9).Active && TileRefs(num8, num9).Type == 1)
{
if (num7 == 0)
{
TileRefs(num8, num9).SetType(25);
}
else
{
TileRefs(num8, num9).SetType(117);
}
NetMessage.SendTileSquare(-1, num8, num9, 1);
break;
}
}
int num10 = Main.rand.Next(2) + 1;
for (int k = 0; k < num10; k++)
{
var playerId = (int)Player.FindClosest(new Vector2((float)(i * 16), (float)(j * 16)), 16, 16);
var player = Main.players[playerId];
NPC.SpawnOnPlayer(playerId, (int)NPCType.N82_WRAITH);
}
altarCount++;
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:82,代码来源:WorldModify.cs
示例8: OpenDoor
public static bool OpenDoor(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int x, int y, int direction, ISender sender)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (sender == null)
sender = new ConsoleSender();
if (Program.properties.NPCDoorOpenCancel && sender is NPC)
return false;
var ctx = new HookContext
{
Sender = sender,
};
var args = new HookArgs.DoorStateChanged
{
X = x,
Y = y,
Direction = direction,
Open = true,
};
HookPoints.DoorStateChanged.Invoke(ref ctx, ref args);
if (ctx.CheckForKick())
return false;
if (ctx.Result == HookResult.IGNORE)
return false;
if (ctx.Result == HookResult.RECTIFY)
{
NetMessage.SendData(19, -1, -1, "", 1, (float)x, (float)y, 0); //Inform the client of the update
return false;
}
int num = 0;
if (TileRefs(x, y - 1).FrameY == 0 && TileRefs(x, y - 1).Type == TileRefs(x, y).Type)
{
num = y - 1;
}
else if (TileRefs(x, y - 2).FrameY == 0 && TileRefs(x, y - 2).Type == TileRefs(x, y).Type)
{
num = y - 2;
}
else if (TileRefs(x, y + 1).FrameY == 0 && TileRefs(x, y + 1).Type == TileRefs(x, y).Type)
{
num = y + 1;
}
else
{
num = y;
}
int num2 = x;
short num3 = 0;
int num4;
if (direction == -1)
{
num2 = x - 1;
num3 = 36;
num4 = x - 1;
}
else
{
num2 = x;
num4 = x + 1;
}
bool flag = true;
for (int k = num; k < num + 3; k++)
{
if (TileRefs(num4, k).Active)
{
if (!Main.tileCut[(int)TileRefs(num4, k).Type] && TileRefs(num4, k).Type != 3 && TileRefs(num4, k).Type != 24 && TileRefs(num4, k).Type != 52 && TileRefs(num4, k).Type != 61 && TileRefs(num4, k).Type != 62 && TileRefs(num4, k).Type != 69 && TileRefs(num4, k).Type != 71 && TileRefs(num4, k).Type != 73 && TileRefs(num4, k).Type != 74)
{
flag = false;
break;
}
KillTile(TileRefs, sandbox, num4, k);
}
}
if (flag)
{
for (int l = num2; l <= num2 + 1; l++)
for (int m = num; m <= num + 2; m++)
if (numNoWire < MAX_WIRE - 1)
{
noWireX[numNoWire] = l;
noWireY[numNoWire] = m;
numNoWire++;
}
TileRefs(num2, num).SetActive(true);
TileRefs(num2, num).SetType(11);
TileRefs(num2, num).SetFrameY(0);
TileRefs(num2, num).SetFrameX(num3);
TileRefs(num2 + 1, num).SetActive(true);
TileRefs(num2 + 1, num).SetType(11);
TileRefs(num2 + 1, num).SetFrameY(0);
//.........这里部分代码省略.........
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:101,代码来源:WorldModify.cs
示例9: Check2x1
public static void Check2x1(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int x, int y, byte type)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (destroyObject)
return;
bool flag = true;
if (TileRefs(x, y).FrameX == 18)
x--;
if (TileRefs(x, y).FrameX == 0
&& TileRefs(x + 1, y).FrameX == 18
&& TileRefs(x, y).Type == type
&& TileRefs(x + 1, y).Type == type)
{
flag = false;
}
if (type == 29 || type == 103)
{
if (!TileRefs(x, y + 1).Active || !Main.tileTable[(int)TileRefs(x, y + 1).Type])
{
flag = true;
}
if (!TileRefs(x + 1, y + 1).Active || !Main.tileTable[(int)TileRefs(x + 1, y + 1).Type])
{
flag = true;
}
}
else
{
if (!TileRefs(x, y + 1).Active || !Main.tileSolid[(int)TileRefs(x, y + 1).Type])
{
flag = true;
}
if (!TileRefs(x + 1, y + 1).Active || !Main.tileSolid[(int)TileRefs(x + 1, y + 1).Type])
{
flag = true;
}
}
if (flag)
{
destroyObject = true;
if (TileRefs(x, y).Type == type)
{
KillTile(TileRefs, sandbox, x, y);
}
if (TileRefs(x + 1, y).Type == type)
{
KillTile(TileRefs, sandbox, x + 1, y);
}
if (type == 16)
{
StorePlayerItem(sandbox, x * TILE_OFFSET_3, y * TILE_OFFSET_3, 32, 32, 35, 1, false);
}
if (type == 18)
{
StorePlayerItem(sandbox, x * TILE_OFFSET_3, y * TILE_OFFSET_3, 32, 32, 36, 1, false);
}
if (type == 29)
{
StorePlayerItem(sandbox, x * TILE_OFFSET_3, y * TILE_OFFSET_3, 32, 32, 87, 1, false);
}
if (type == 103)
{
StorePlayerItem(sandbox, x * TILE_OFFSET_3, y * TILE_OFFSET_3, 32, 32, 356, 1, false);
}
destroyObject = false;
SquareTileFrame(TileRefs, sandbox, x, y, true);
SquareTileFrame(TileRefs, sandbox, x + 1, y, true);
}
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:76,代码来源:WorldModify.cs
示例10: meteor
public static bool meteor(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int x, int y)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (x < 50 || x > Main.maxTilesX - 50)
return false;
if (y < 50 || y > Main.maxTilesY - 50)
return false;
Rectangle rectangle = new Rectangle((x - RECTANGLE_OFFSET) * TILE_SCALE, (y - RECTANGLE_OFFSET) * TILE_SCALE,
RECTANGLE_OFFSET * 2 * TILE_SCALE, RECTANGLE_OFFSET * 2 * TILE_SCALE);
BaseEntity entity;
for (int i = 0; i < Main.MAX_PLAYERS; i++)
{
entity = Main.players[i];
if (entity.Active && entity.Intersects(rectangle))
return false;
}
for (int i = 0; i < NPC.MAX_NPCS; i++)
{
entity = Main.npcs[i];
if (entity.Active && entity.Intersects(rectangle))
return false;
}
for (int modX = x - RECTANGLE_OFFSET; modX < x + RECTANGLE_OFFSET; modX++)
{
for (int modY = y - RECTANGLE_OFFSET; modY < y + RECTANGLE_OFFSET; modY++)
{
if (TileRefs(modX, modY).Active && TileRefs(modX, modY).Type == 21)
return false;
}
}
stopDrops = true;
for (int num2 = x - TILE_OFFSET; num2 < x + TILE_OFFSET; num2++)
{
for (int num3 = y - TILE_OFFSET; num3 < y + TILE_OFFSET; num3++)
{
if (num3 > y + Main.rand.Next(-2, 3) - 5 && (double)(Math.Abs(x - num2) + Math.Abs(y - num3)) < (double)TILE_OFFSET * 1.5 + (double)Main.rand.Next(-5, 5))
{
if (!Main.tileSolid[(int)TileRefs(num2, num3).Type])
TileRefs(num2, num3).SetActive(false);
TileRefs(num2, num3).SetType(37);
}
}
}
for (int num4 = x - TILES_OFFSET_2; num4 < x + TILES_OFFSET_2; num4++)
{
for (int num5 = y - TILES_OFFSET_2; num5 < y + TILES_OFFSET_2; num5++)
{
if (num5 > y + Main.rand.Next(-2, 3) - 5 && Math.Abs(x - num4) + Math.Abs(y - num5) < TILES_OFFSET_2 + Main.rand.Next(-3, 4))
TileRefs(num4, num5).SetActive(false);
}
}
for (int num6 = x - TILE_OFFSET_3; num6 < x + TILE_OFFSET_3; num6++)
{
for (int num7 = y - TILE_OFFSET_3; num7 < y + TILE_OFFSET_3; num7++)
{
if (TileRefs(num6, num7).Type == 5 || TileRefs(num6, num7).Type == 32)
KillTile(TileRefs, sandbox, num6, num7);
SquareTileFrame(TileRefs, sandbox, num6, num7, true);
SquareWallFrame(TileRefs, num6, num7, true);
}
}
for (int num8 = x - TILE_OFFSET_4; num8 < x + TILE_OFFSET_4; num8++)
{
for (int num9 = y - TILE_OFFSET_4; num9 < y + TILE_OFFSET_4; num9++)
{
if (TileRefs(num8, num9).Active && Main.rand.Next(10) == 0 && (double)(Math.Abs(x - num8) + Math.Abs(y - num9)) < (double)TILE_OFFSET_4 * 1.3)
{
if (TileRefs(num8, num9).Type == 5 || TileRefs(num8, num9).Type == 32)
KillTile(TileRefs, sandbox, num8, num9);
TileRefs(num8, num9).SetType(37);
SquareTileFrame(TileRefs, sandbox, num8, num9, true);
}
}
}
stopDrops = false;
NetMessage.SendData(25, -1, -1, "A meteorite has landed!", 255, 50f, 255f, 130f);
NetMessage.SendTileSquare(-1, x, y, 30);
return true;
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:94,代码来源:WorldModify.cs
示例11: KillWire
public static bool KillWire(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int i, int j)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (TileRefs(i, j).Wire)
{
TileRefs(i, j).SetWire(false);
StorePlayerItem(sandbox, i * 16, j * 16, 16, 16, 530, 1, false, 0);
return true;
}
return false;
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:13,代码来源:WorldModify.cs
示例12: KillWall
public static void KillWall(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int i, int j, bool fail = false)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (i >= 0 && j >= 0 && i < Main.maxTilesX && j < Main.maxTilesY)
{
if (TileRefs(i, j).Wall > 0)
{
if (fail)
{
SquareWallFrame(TileRefs, i, j, true);
return;
}
int num2 = 0;
if (TileRefs(i, j).Wall == 1)
{
num2 = 26;
}
if (TileRefs(i, j).Wall == 4)
{
num2 = 93;
}
if (TileRefs(i, j).Wall == 5)
{
num2 = 130;
}
if (TileRefs(i, j).Wall == 6)
{
num2 = 132;
}
if (TileRefs(i, j).Wall == 7)
{
num2 = 135;
}
if (TileRefs(i, j).Wall == 8)
{
num2 = 138;
}
if (TileRefs(i, j).Wall == 9)
{
num2 = 140;
}
if (TileRefs(i, j).Wall == 10)
{
num2 = 142;
}
if (TileRefs(i, j).Wall == 11)
{
num2 = 144;
}
if (TileRefs(i, j).Wall == 12)
{
num2 = 146;
}
if (TileRefs(i, j).Wall == 14)
{
num2 = 330;
}
if (TileRefs(i, j).Wall == 16)
{
num2 = 30;
}
if (TileRefs(i, j).Wall == 17)
{
num2 = 135;
}
if (TileRefs(i, j).Wall == 18)
{
num2 = 138;
}
if (TileRefs(i, j).Wall == 19)
{
num2 = 140;
}
if (TileRefs(i, j).Wall == 20)
{
num2 = 330;
}
if (TileRefs(i, j).Wall == 21)
{
num2 = 392;
}
if (TileRefs(i, j).Wall == 22)
{
num2 = 417;
}
if (TileRefs(i, j).Wall == 23)
{
num2 = 418;
}
if (TileRefs(i, j).Wall == 24)
{
num2 = 419;
}
if (TileRefs(i, j).Wall == 25)
{
num2 = 420;
}
//.........这里部分代码省略.........
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:101,代码来源:WorldModify.cs
示例13: Check1xX
public static void Check1xX(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int x, int j, byte type)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (destroyObject)
return;
int num = j - (int)(TileRefs(x, j).FrameY / 18);
int frameX = (int)TileRefs(x, j).FrameX;
int num2 = 3;
if (type == 92)
num2 = 6;
bool flag = false;
for (int i = 0; i < num2; i++)
{
if (!TileRefs(x, num + i).Active)
{
flag = true;
}
else if (TileRefs(x, num + i).Type != type)
{
flag = true;
}
else if ((int)TileRefs(x, num + i).FrameY != i * 18)
{
flag = true;
}
else if ((int)TileRefs(x, num + i).FrameX != frameX)
{
flag = true;
}
}
if (!TileRefs(x, num + num2).Active)
{
flag = true;
}
if (!Main.tileSolid[(int)TileRefs(x, num + num2).Type])
{
flag = true;
}
if (flag)
{
destroyObject = true;
for (int k = 0; k < num2; k++)
{
if (TileRefs(x, num + k).Type == type)
{
KillTile(TileRefs, sandbox, x, num + k);
}
}
if (type == 92)
StorePlayerItem(sandbox, x * 16, j * 16, 32, 32, 341);
else if (type == 93)
StorePlayerItem(sandbox, x * 16, j * 16, 32, 32, 342);
destroyObject = false;
}
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:60,代码来源:WorldModify.cs
示例14: Check1x2Top
public static void Check1x2Top(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int x, int y, byte type)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
if (destroyObject)
return;
bool flag = true;
if (TileRefs(x, y).FrameY == 18)
y--;
if (TileRefs(x, y).FrameY == 0
&& TileRefs(x, y + 1).FrameY == 18
&& TileRefs(x, y).Type == type
&& TileRefs(x, y + 1).Type == type)
{
flag = false;
}
if (!TileRefs(x, y - 1).Active
|| !Main.tileSolid[(int)TileRefs(x, y - 1).Type]
|| Main.tileSolidTop[(int)TileRefs(x, y - 1).Type])
{
flag = true;
}
if (flag)
{
destroyObject = true;
if (TileRefs(x, y).Type == type)
KillTile(TileRefs, sandbox, x, y);
if (TileRefs(x, y + 1).Type == type)
KillTile(TileRefs, sandbox, x, y + 1);
if (type == 42)
StorePlayerItem(sandbox, x * 16, y * 16, 32, 32, 136);
destroyObject = false;
}
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:43,代码来源:WorldModify.cs
示例15: RangeFrame
public static void RangeFrame(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int startX, int startY, int endX, int endY)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
int num = endX + 1;
int num2 = endY + 1;
for (int i = startX - 1; i < num + 1; i++)
{
for (int j = startY - 1; j < num2 + 1; j++)
{
TileFrame(TileRefs, sandbox, i, j);
WallFrame(TileRefs, i, j);
}
}
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:16,代码来源:WorldModify.cs
示例16: SectionTileFrame
public static void SectionTileFrame(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int startX, int startY, int endX, int endY)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
int num = startX * 200;
int num2 = (endX + 1) * 200;
int num3 = startY * 150;
int num4 = (endY + 1) * 150;
if (num < 1)
{
num = 1;
}
if (num3 < 1)
{
num3 = 1;
}
if (num > Main.maxTilesX - 2)
{
num = Main.maxTilesX - 2;
}
if (num3 > Main.maxTilesY - 2)
{
num3 = Main.maxTilesY - 2;
}
for (int i = num - 1; i < num2 + 1; i++)
{
for (int j = num3 - 1; j < num4 + 1; j++)
{
TileFrame(TileRefs, sandbox, i, j, true, true);
}
}
}
开发者ID:jason14747,项目名称:Terraria-s-Dedicated-Server-Mod,代码行数:33,代码来源:WorldModify.cs
示例17: OreRunner
public static void OreRunner(Func<Int32, Int32, ITile> TileRefs, ISandbox sandbox, int i, int j, double strength, int steps, int type)
{
if (TileRefs == null)
TileRefs = TileCollection.ITileAt;
double num = strength;
float num2 = (float)steps;
Vector2 value;
value.X = (float)i;
value.Y = (float)j;
Vector2 value2;
value2.X = (float)genRand.Next(-10, 11) * 0.1f;
value2.Y = (float)genRand.Next(-10, 11) * 0.1f;
while (num > 0.0 && num2 > 0f)
{
if (value.Y < 0f && num2 > 0f && type == 59)
{
num2 = 0f;
}
num = strength * (double)(num2 / (float)steps);
num2 -= 1f;
int num3 = (int)((double)value.X - num * 0.5);
int num4 = (int)((double)value.X + num * 0.5);
int num5 = (int)((double)value.Y - num * 0.5);
int num6 = (int)((double)value.Y + num * 0.5);
if (num3 < 0)
{
num3 = 0;
}
if (num4 > Main.maxTilesX)
{
num4 = Main.maxTilesX;
}
if (num5 < 0)
{
num5 = 0;
}
if (num6 > Main.maxTilesY)
{
num6 = Main.maxTilesY;
}
for (int k = num3; k < num4; k++)
{
for (int l = num5; l < num6; l++)
{
if ((double)(Math.Abs((float)k - value.X) + Math.Abs((float)l - value.Y)) < strength * 0.5 * (1.0 + (double)genRand.Next(-10, 11) * 0.015) &&
TileRefs(k, l).Active && (TileRefs(k, l).Type == 0 || TileRefs(k, l).Type == 1 || TileRefs(k, l).Type == 23 || TileRefs(k, l).Type == 25 ||
TileRefs(k, l).Type == 40 || TileRefs(k, l).Type == 53 || TileRefs(k, l).Type == 57 || TileRefs(k, l).Type == 59 ||
TileRefs(k, l).Type == 60 || TileRefs(k, l).Type == 70 || TileRefs(k, l).Type == 109 || TileRefs(k, l).Type == 112 ||
TileRefs(k, l).Type == 116 || TileRefs(k, l).Type == 117))
{
TileRefs(k, l).SetType((byte)type);
SquareTileFrame(TileRefs, sandbox, k, l, true);
NetMessage.SendTileSquare(-1, k, l, 1);
}
}
}
value += value2;
value2.X += (float)genRand.Next(-10, 11) * 0.05f;
if (value2.X > 1f)
{
value2.X =
|
请发表评论