Added IceTile system.
This commit is contained in:
parent
efee7caed2
commit
11802f2a13
3 changed files with 163 additions and 49 deletions
90
Build/TerrariaServer.XML
Normal file
90
Build/TerrariaServer.XML
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>TerrariaServer</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:TShock.Hooks.IHooks">
|
||||
<summary>
|
||||
Hooks interface
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TShock.IGame.Players">
|
||||
<summary>
|
||||
List of players
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:TShock.HandlerList">
|
||||
<summary>
|
||||
See generic HandlerList
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:TShock.HandlerList`1">
|
||||
<summary>
|
||||
Works like an event. Allows for registering delegates with a higher or lower priority.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
</member>
|
||||
<member name="M:TShock.HandlerList`1.Register(System.EventHandler{`0},TShock.HandlerPriority,System.Boolean)">
|
||||
<summary>
|
||||
Register a handler
|
||||
</summary>
|
||||
<param name="handler">Delegate to be called</param>
|
||||
<param name="priority">Priority of the delegate</param>
|
||||
<param name="gethandled">Should the handler receive a call even if it has been handled</param>
|
||||
</member>
|
||||
<member name="M:TShock.IPlayer.Damage(System.Int32)">
|
||||
<summary>
|
||||
Attempts to damage the player.
|
||||
</summary>
|
||||
<param name="amt">int - how much damage to give</param>
|
||||
</member>
|
||||
<member name="M:TShock.IPlayer.SendMessage(System.String,Color)">
|
||||
<summary>
|
||||
Sends message to specified player
|
||||
</summary>
|
||||
<param name="msg">string - text to send</param>
|
||||
<param name="color">Color - color for the text</param>
|
||||
</member>
|
||||
<member name="P:TShock.IPlayer.Id">
|
||||
<summary>
|
||||
Meant to only be used by TServer.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TShock.IPlayer.Name">
|
||||
<summary>
|
||||
The character name of the player.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:TShock.Plugin.CreateInterfaces">
|
||||
<summary>
|
||||
Return a list of interfaces this plugin exposes.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:TShock.Plugin.SetInterfaces(System.Collections.Generic.IEnumerable{System.Object})">
|
||||
<summary>
|
||||
Called before initialize passing all the interfaces gathered from plugins
|
||||
</summary>
|
||||
<param name="interfaces"></param>
|
||||
</member>
|
||||
<member name="M:TShock.Plugin.GetInterface``1(System.Collections.Generic.IEnumerable{System.Object})">
|
||||
<summary>
|
||||
Gets the T interface from the collection. Returns null if its not found.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="interfaces"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:TShock.Hooks.Player.PlayerHooks.Join">
|
||||
<summary>
|
||||
Called when the player first connects. They are not fully in the game yet, for that see Greet.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:TShock.Hooks.Player.PlayerHooks.Greet">
|
||||
<summary>
|
||||
Called when the player is actually loaded into the game.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
|
@ -75,6 +75,8 @@ namespace TShockAPI
|
|||
public PlayerData PlayerData;
|
||||
public bool RequiresPassword;
|
||||
public bool SilentKickInProgress;
|
||||
public List<Point> IceTiles { get; set; }
|
||||
|
||||
|
||||
public bool RealPlayer
|
||||
{
|
||||
|
|
@ -86,7 +88,7 @@ namespace TShockAPI
|
|||
get
|
||||
{
|
||||
return RealPlayer &&
|
||||
(Netplay.serverSock[Index] != null && Netplay.serverSock[Index].active && !Netplay.serverSock[Index].kill);
|
||||
(Netplay.serverSock[Index] != null && Netplay.serverSock[Index].active && !Netplay.serverSock[Index].kill);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,8 +107,8 @@ namespace TShockAPI
|
|||
CacheIP =
|
||||
RealPlayer
|
||||
? (Netplay.serverSock[Index].tcpClient.Connected
|
||||
? TShock.Utils.GetRealIP(Netplay.serverSock[Index].tcpClient.Client.RemoteEndPoint.ToString())
|
||||
: "")
|
||||
? TShock.Utils.GetRealIP(Netplay.serverSock[Index].tcpClient.Client.RemoteEndPoint.ToString())
|
||||
: "")
|
||||
: "";
|
||||
else
|
||||
return CacheIP;
|
||||
|
|
@ -213,28 +215,28 @@ namespace TShockAPI
|
|||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var msg = new WorldInfoMsg
|
||||
{
|
||||
Time = (int) Main.time,
|
||||
DayTime = Main.dayTime,
|
||||
MoonPhase = (byte) Main.moonPhase,
|
||||
BloodMoon = Main.bloodMoon,
|
||||
MaxTilesX = Main.maxTilesX,
|
||||
MaxTilesY = Main.maxTilesY,
|
||||
SpawnX = tilex,
|
||||
SpawnY = tiley,
|
||||
WorldSurface = (int) Main.worldSurface,
|
||||
RockLayer = (int) Main.rockLayer,
|
||||
//Sending a fake world id causes the client to not be able to find a stored spawnx/y.
|
||||
//This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn.
|
||||
WorldID = !fakeid ? Main.worldID : -1,
|
||||
WorldFlags = (WorldGen.shadowOrbSmashed ? WorldInfoFlag.OrbSmashed : WorldInfoFlag.None) |
|
||||
(NPC.downedBoss1 ? WorldInfoFlag.DownedBoss1 : WorldInfoFlag.None) |
|
||||
(NPC.downedBoss2 ? WorldInfoFlag.DownedBoss2 : WorldInfoFlag.None) |
|
||||
(NPC.downedBoss3 ? WorldInfoFlag.DownedBoss3 : WorldInfoFlag.None) |
|
||||
(Main.hardMode ? WorldInfoFlag.HardMode : WorldInfoFlag.None) |
|
||||
(NPC.downedClown ? WorldInfoFlag.DownedClown : WorldInfoFlag.None),
|
||||
WorldName = Main.worldName
|
||||
};
|
||||
{
|
||||
Time = (int) Main.time,
|
||||
DayTime = Main.dayTime,
|
||||
MoonPhase = (byte) Main.moonPhase,
|
||||
BloodMoon = Main.bloodMoon,
|
||||
MaxTilesX = Main.maxTilesX,
|
||||
MaxTilesY = Main.maxTilesY,
|
||||
SpawnX = tilex,
|
||||
SpawnY = tiley,
|
||||
WorldSurface = (int) Main.worldSurface,
|
||||
RockLayer = (int) Main.rockLayer,
|
||||
//Sending a fake world id causes the client to not be able to find a stored spawnx/y.
|
||||
//This fixes the bed spawn point bug. With a fake world id it wont be able to find the bed spawn.
|
||||
WorldID = !fakeid ? Main.worldID : -1,
|
||||
WorldFlags = (WorldGen.shadowOrbSmashed ? WorldInfoFlag.OrbSmashed : WorldInfoFlag.None) |
|
||||
(NPC.downedBoss1 ? WorldInfoFlag.DownedBoss1 : WorldInfoFlag.None) |
|
||||
(NPC.downedBoss2 ? WorldInfoFlag.DownedBoss2 : WorldInfoFlag.None) |
|
||||
(NPC.downedBoss3 ? WorldInfoFlag.DownedBoss3 : WorldInfoFlag.None) |
|
||||
(Main.hardMode ? WorldInfoFlag.HardMode : WorldInfoFlag.None) |
|
||||
(NPC.downedClown ? WorldInfoFlag.DownedClown : WorldInfoFlag.None),
|
||||
WorldName = Main.worldName
|
||||
};
|
||||
msg.PackFull(ms);
|
||||
SendRawData(ms.ToArray());
|
||||
}
|
||||
|
|
@ -277,11 +279,11 @@ namespace TShockAPI
|
|||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var msg = new SpawnMsg
|
||||
{
|
||||
PlayerIndex = (byte) Index,
|
||||
TileX = tilex,
|
||||
TileY = tiley
|
||||
};
|
||||
{
|
||||
PlayerIndex = (byte) Index,
|
||||
TileX = tilex,
|
||||
TileY = tiley
|
||||
};
|
||||
msg.PackFull(ms);
|
||||
SendRawData(ms.ToArray());
|
||||
}
|
||||
|
|
@ -292,10 +294,10 @@ namespace TShockAPI
|
|||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var msg = new ProjectileRemoveMsg
|
||||
{
|
||||
Index = (short) index,
|
||||
Owner = (byte) owner
|
||||
};
|
||||
{
|
||||
Index = (short) index,
|
||||
Owner = (byte) owner
|
||||
};
|
||||
msg.PackFull(ms);
|
||||
SendRawData(ms.ToArray());
|
||||
}
|
||||
|
|
@ -323,7 +325,7 @@ namespace TShockAPI
|
|||
Main.item[itemid].SetDefaults(name);
|
||||
// The set default overrides the wet and stack set by NewItem
|
||||
Main.item[itemid].wet = Collision.WetCollision(Main.item[itemid].position, Main.item[itemid].width,
|
||||
Main.item[itemid].height);
|
||||
Main.item[itemid].height);
|
||||
Main.item[itemid].stack = stack;
|
||||
Main.item[itemid].owner = Index;
|
||||
Main.item[itemid].prefix = (byte) prefix;
|
||||
|
|
@ -349,7 +351,7 @@ namespace TShockAPI
|
|||
public virtual void DamagePlayer(int damage)
|
||||
{
|
||||
NetMessage.SendData((int) PacketTypes.PlayerDamage, -1, -1, "", Index, ((new Random()).Next(-1, 1)), damage,
|
||||
(float) 0);
|
||||
(float) 0);
|
||||
}
|
||||
|
||||
public virtual void SetTeam(int team)
|
||||
|
|
@ -364,14 +366,14 @@ namespace TShockAPI
|
|||
SetBuff(33, 330, true); //Weak
|
||||
SetBuff(32, 330, true); //Slow
|
||||
SetBuff(23, 330, true); //Cursed
|
||||
if (!string.IsNullOrEmpty(reason))
|
||||
Log.ConsoleInfo(string.Format("Player {0} has been disabled for {1}", Name, reason));
|
||||
if (!string.IsNullOrEmpty(reason))
|
||||
Log.ConsoleInfo(string.Format("Player {0} has been disabled for {1}", Name, reason));
|
||||
|
||||
var trace = new StackTrace();
|
||||
StackFrame frame = null;
|
||||
frame = trace.GetFrame(1);
|
||||
if (frame != null && frame.GetMethod().DeclaringType != null)
|
||||
Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable()");
|
||||
var trace = new StackTrace();
|
||||
StackFrame frame = null;
|
||||
frame = trace.GetFrame(1);
|
||||
if (frame != null && frame.GetMethod().DeclaringType != null)
|
||||
Log.Debug(frame.GetMethod().DeclaringType.Name + " called Disable()");
|
||||
}
|
||||
|
||||
public virtual void Whoopie(object time)
|
||||
|
|
@ -397,7 +399,7 @@ namespace TShockAPI
|
|||
|
||||
//Todo: Separate this into a few functions. SendTo, SendToAll, etc
|
||||
public virtual void SendData(PacketTypes msgType, string text = "", int number = 0, float number2 = 0f,
|
||||
float number3 = 0f, float number4 = 0f, int number5 = 0)
|
||||
float number3 = 0f, float number4 = 0f, int number5 = 0)
|
||||
{
|
||||
if (RealPlayer && !ConnectionAlive)
|
||||
return;
|
||||
|
|
@ -489,14 +491,14 @@ namespace TShockAPI
|
|||
}
|
||||
|
||||
public void SpawnNPC(int type, string name, int amount, int startTileX, int startTileY, int tileXRange = 100,
|
||||
int tileYRange = 50)
|
||||
int tileYRange = 50)
|
||||
{
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
int spawnTileX;
|
||||
int spawnTileY;
|
||||
TShock.Utils.GetRandomClearTileWithInRange(startTileX, startTileY, tileXRange, tileYRange, out spawnTileX,
|
||||
out spawnTileY);
|
||||
out spawnTileY);
|
||||
int npcid = NPC.NewNPC(spawnTileX*16, spawnTileY*16, type, 0);
|
||||
// This is for special slimes
|
||||
Main.npc[npcid].SetDefaults(name);
|
||||
|
|
|
|||
|
|
@ -1088,10 +1088,32 @@ namespace TShockAPI
|
|||
|
||||
public static bool CheckTilePermission( TSPlayer player, int tileX, int tileY, byte tileType )
|
||||
{
|
||||
if (!player.Group.HasPermission(Permissions.canbuild) && !(TShock.Config.AllowIce && tileType == 127) )
|
||||
if (!player.Group.HasPermission(Permissions.canbuild))
|
||||
{
|
||||
player.SendMessage("You do not have permission to build!", Color.Red);
|
||||
return true;
|
||||
if (TShock.Config.AllowIce && tileType == 0)
|
||||
{
|
||||
foreach (Point p in player.IceTiles)
|
||||
{
|
||||
if (p.X == tileX)
|
||||
{
|
||||
if (p.Y == tileY)
|
||||
{
|
||||
player.IceTiles.Remove(p);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (TShock.Config.AllowIce && tileType == 127)
|
||||
{
|
||||
player.IceTiles.Add(new Point(tileX, tileY));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendMessage("You do not have permission to build!", Color.Red);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!player.Group.HasPermission(Permissions.editspawn) && !Regions.CanBuild(tileX, tileY, player) &&
|
||||
Regions.InArea(tileX, tileY))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue