mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-25 06:04:46 -04:00
Core: Add actual help to /blockprops
This commit is contained in:
parent
b86944f59d
commit
abdcca14aa
@ -189,29 +189,29 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
static void SetupDefaultDeaths() {
|
||||
SetDeath(Block.tntexplosion, "{0} %S&cblew into pieces.");
|
||||
SetDeath(Block.deathair, "{0} %Swalked into &cnerve gas and suffocated.");
|
||||
SetDeath(Block.deathwater, "{0} %Sstepped in &dcold water and froze.");
|
||||
SetDeath(Block.tntexplosion, "@p %S&cblew into pieces.");
|
||||
SetDeath(Block.deathair, "@p %Swalked into &cnerve gas and suffocated.");
|
||||
SetDeath(Block.deathwater, "@p %Sstepped in &dcold water and froze.");
|
||||
SetDeath(Block.activedeathwater, Props[Block.deathwater].DeathMessage);
|
||||
SetDeath(Block.deathlava, "{0} %Sstood in &cmagma and melted.");
|
||||
SetDeath(Block.deathlava, "@p %Sstood in &cmagma and melted.");
|
||||
SetDeath(Block.activedeathlava, Props[Block.deathlava].DeathMessage);
|
||||
SetDeath(Block.fastdeathlava, Props[Block.deathlava].DeathMessage);
|
||||
|
||||
SetDeath(Block.magma, "{0} %Swas hit by &cflowing magma and melted.");
|
||||
SetDeath(Block.geyser, "{0} %Swas hit by &cboiling water and melted.");
|
||||
SetDeath(Block.birdkill, "{0} %Swas hit by a &cphoenix and burnt.");
|
||||
SetDeath(Block.train, "{0} %Swas hit by a &ctrain.");
|
||||
SetDeath(Block.fishshark, "{0} %Swas eaten by a &cshark.");
|
||||
SetDeath(Block.lava_fire, "{0} %Sburnt to a &ccrisp.");
|
||||
SetDeath(Block.rockethead, "{0} %Swas &cin a fiery explosion.");
|
||||
SetDeath(Block.zombiebody, "{0} %Sdied due to lack of &5brain.");
|
||||
SetDeath(Block.creeper, "{0} %Swas killed &cb-SSSSSSSSSSSSSS");
|
||||
SetDeath(Block.fishlavashark, "{0} %Swas eaten by a ... LAVA SHARK?!");
|
||||
SetDeath(Block.snake, "{0} %Swas bit by a deadly snake.");
|
||||
SetDeath(Block.magma, "@p %Swas hit by &cflowing magma and melted.");
|
||||
SetDeath(Block.geyser, "@p %Swas hit by &cboiling water and melted.");
|
||||
SetDeath(Block.birdkill, "@p %Swas hit by a &cphoenix and burnt.");
|
||||
SetDeath(Block.train, "@p %Swas hit by a &ctrain.");
|
||||
SetDeath(Block.fishshark, "@p %Swas eaten by a &cshark.");
|
||||
SetDeath(Block.lava_fire, "@p %Sburnt to a &ccrisp.");
|
||||
SetDeath(Block.rockethead, "@p %Swas &cin a fiery explosion.");
|
||||
SetDeath(Block.zombiebody, "@p %Sdied due to lack of &5brain.");
|
||||
SetDeath(Block.creeper, "@p %Swas killed &cb-SSSSSSSSSSSSSS");
|
||||
SetDeath(Block.fishlavashark, "@p %Swas eaten by a ... LAVA SHARK?!");
|
||||
SetDeath(Block.snake, "@p %Swas bit by a deadly snake.");
|
||||
|
||||
SetDeath(Block.air, "{0} %Shit the floor &chard.", false);
|
||||
SetDeath(Block.water, "{0} %S&cdrowned.", false);
|
||||
SetDeath(Block.Invalid, "{0} %Swas &cterminated.", false);
|
||||
SetDeath(Block.air, "@p %Shit the floor &chard.", false);
|
||||
SetDeath(Block.water, "@p %S&cdrowned.", false);
|
||||
SetDeath(Block.Invalid, "@p %Swas &cterminated.", false);
|
||||
}
|
||||
|
||||
static void SetDeath(byte block, string message, bool collideKill = true) {
|
||||
|
@ -89,14 +89,14 @@ namespace MCGalaxy.Commands.World {
|
||||
Toggle(p, scope, id, "a portal",
|
||||
(ref BlockProps props) => props.IsPortal = !props.IsPortal,
|
||||
(BlockProps props) => props.IsPortal);
|
||||
} else if (prop == "rails") {
|
||||
Toggle(p, scope, id, "train rails",
|
||||
(ref BlockProps props) => props.IsRails = !props.IsRails,
|
||||
(BlockProps props) => props.IsRails);
|
||||
} else if (prop == "mb" || prop == "messageblock") {
|
||||
Toggle(p, scope, id, "a message block",
|
||||
(ref BlockProps props) => props.IsMessageBlock = !props.IsMessageBlock,
|
||||
(BlockProps props) => props.IsMessageBlock);
|
||||
} else if (prop == "rails") {
|
||||
Toggle(p, scope, id, "train rails",
|
||||
(ref BlockProps props) => props.IsRails = !props.IsRails,
|
||||
(BlockProps props) => props.IsRails);
|
||||
} else if (prop == "waterkills") {
|
||||
Toggle(p, scope, id, "killed by water",
|
||||
(ref BlockProps props) => props.WaterKills = !props.WaterKills,
|
||||
@ -105,18 +105,18 @@ namespace MCGalaxy.Commands.World {
|
||||
Toggle(p, scope, id, "killed by lava",
|
||||
(ref BlockProps props) => props.LavaKills = !props.LavaKills,
|
||||
(BlockProps props) => props.LavaKills);
|
||||
} else if (prop == "door") {
|
||||
Toggle(p, scope, id, "is a door",
|
||||
(ref BlockProps props) => props.IsDoor = !props.IsDoor,
|
||||
(BlockProps props) => props.IsDoor);
|
||||
} else if (prop == "tdoor") {
|
||||
Toggle(p, scope, id, "is a tdoor",
|
||||
(ref BlockProps props) => props.IsTDoor = !props.IsTDoor,
|
||||
(BlockProps props) => props.IsTDoor);
|
||||
} else if (prop == "killer" || prop == "death") {
|
||||
Toggle(p, scope, id, "a killer block",
|
||||
(ref BlockProps props) => props.KillerBlock = !props.KillerBlock,
|
||||
(BlockProps props) => props.KillerBlock);
|
||||
} else if (prop == "door") {
|
||||
Toggle(p, scope, id, "is a door",
|
||||
(ref BlockProps props) => props.IsDoor = !props.IsDoor,
|
||||
(BlockProps props) => props.IsDoor);
|
||||
} else if (prop == "tdoor") {
|
||||
Toggle(p, scope, id, "is a tdoor",
|
||||
(ref BlockProps props) => props.IsTDoor = !props.IsTDoor,
|
||||
(BlockProps props) => props.IsTDoor);
|
||||
} else if (prop == "deathmsg" || prop == "deathmessage") {
|
||||
string msg = args.Length > 3 ? args[3] : null;
|
||||
SetDeathMessage(p, scope, id, msg);
|
||||
@ -147,6 +147,7 @@ namespace MCGalaxy.Commands.World {
|
||||
Player.Message(p, "Death message for {0} removed.",
|
||||
BlockName(scope, lvl, id));
|
||||
} else {
|
||||
msg = msg.Replace("@p", "{0}");
|
||||
Player.Message(p, "Death message for {0} set to: {1}",
|
||||
BlockName(scope, lvl, id), msg);
|
||||
}
|
||||
@ -154,8 +155,8 @@ namespace MCGalaxy.Commands.World {
|
||||
}
|
||||
|
||||
static void OnPropsChanged(BlockProps[] scope, Level level, byte id) {
|
||||
scope[id].Changed = true;
|
||||
|
||||
scope[id].Changed = true;
|
||||
|
||||
if (scope == Block.Props) {
|
||||
BlockBehaviour.SetupCoreHandlers();
|
||||
BlockProps.Save("core", scope);
|
||||
@ -175,17 +176,48 @@ namespace MCGalaxy.Commands.World {
|
||||
if (scope == Block.Props) return Block.Name(raw);
|
||||
BlockDefinition def = null;
|
||||
|
||||
if (scope == BlockDefinition.GlobalProps)
|
||||
if (scope == BlockDefinition.GlobalProps) {
|
||||
def = BlockDefinition.GlobalDefs[raw];
|
||||
else
|
||||
} else {
|
||||
def = lvl.CustomBlockDefs[raw];
|
||||
}
|
||||
return def == null ? raw.ToString() : def.Name.Replace(" ", "");
|
||||
}
|
||||
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/blockprops [scope] [id] [property] <value>");
|
||||
Player.Message(p, "%HSets various properties for blocks.");
|
||||
Player.Message(p, "%H[scope] can be \"core\", \"global\", or \"level\"");
|
||||
Player.Message(p, "%H[scope] can be: %Score, global, level");
|
||||
|
||||
Player.Message(p, "%Hproperties: %Sportal, messageblock, rails, waterkills, " +
|
||||
"lavakills, door, tdoor, killer, deathmessage");
|
||||
Player.Message(p, "%HType %T/help blockprops [property] %Hfor more details");
|
||||
}
|
||||
|
||||
public override void Help(Player p, string message) {
|
||||
if (message.CaselessEq("portal")) {
|
||||
Player.Message(p, "%HToggles whether the block is a %T/portal");
|
||||
} else if (message.CaselessEq("messageblock")) {
|
||||
Player.Message(p, "%HToggles whether the block is a %T/messageblock");
|
||||
} else if (message.CaselessEq("rails")) {
|
||||
Player.Message(p, "%HToggles whether %Strain %Hblocks can run over this block");
|
||||
} else if (message.CaselessEq("waterkills")) {
|
||||
Player.Message(p, "%HToggles whether flooding water kills this block");
|
||||
} else if (message.CaselessEq("lavakills")) {
|
||||
Player.Message(p, "%HToggles whether flooding lava kills this block");
|
||||
} else if (message.CaselessEq("door")) {
|
||||
Player.Message(p, "%HToggles whether this block is a Door block");
|
||||
} else if (message.CaselessEq("tdoor")) {
|
||||
Player.Message(p, "%HToggles whether this block is a TDoor block");
|
||||
} else if (message.CaselessEq("killer")) {
|
||||
Player.Message(p, "%HToggles whether this block kills players who collide with it");
|
||||
} else if (message.CaselessEq("deathmessage")) {
|
||||
Player.Message(p, "%HSets or removes the death message for this block");
|
||||
Player.Message(p, "%H Note: %S@p %His a placeholder for the player's name");
|
||||
} else {
|
||||
Player.Message(p, "&cUnrecognised property \"{0}\"", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ namespace MCGalaxy {
|
||||
if (PlayerBlockChange != null)
|
||||
PlayerBlockChange(this, x, y, z, block, extBlock);
|
||||
OnBlockChangeEvent.Call(this, x, y, z, block, extBlock);
|
||||
if (cancelBlock) { cancelBlock = false; return; }
|
||||
if (cancelBlock) { cancelBlock = false; return; }
|
||||
|
||||
if (old >= Block.air_flood && old <= Block.air_door_air) {
|
||||
SendMessage("Block is active, you cannot disturb it.");
|
||||
@ -196,8 +196,8 @@ namespace MCGalaxy {
|
||||
|
||||
int PacketSize(byte[] buffer) {
|
||||
switch (buffer[0]) {
|
||||
case (byte)'G': return -2; //For wom
|
||||
case Opcode.Handshake: return 131;
|
||||
case (byte)'G': return -2; //For wom
|
||||
case Opcode.Handshake: return 131;
|
||||
case Opcode.SetBlockClient:
|
||||
if (!loggedIn) goto default;
|
||||
return 9;
|
||||
@ -207,9 +207,9 @@ namespace MCGalaxy {
|
||||
case Opcode.Message:
|
||||
if (!loggedIn) goto default;
|
||||
return 66;
|
||||
case Opcode.CpeExtInfo: return 67;
|
||||
case Opcode.CpeExtEntry: return 69;
|
||||
case Opcode.CpeCustomBlockSupportLevel: return 2;
|
||||
case Opcode.CpeExtInfo: return 67;
|
||||
case Opcode.CpeExtEntry: return 69;
|
||||
case Opcode.CpeCustomBlockSupportLevel: return 2;
|
||||
default:
|
||||
if (!dontmindme) {
|
||||
Leave("Unhandled message id \"" + buffer[0] + "\"!", true);
|
||||
@ -307,7 +307,7 @@ namespace MCGalaxy {
|
||||
rot = new byte[2] { rotx, roty };
|
||||
if (!Moved() || Loading) return;
|
||||
if (DateTime.UtcNow < AFKCooldown) return;
|
||||
|
||||
|
||||
LastAction = DateTime.UtcNow;
|
||||
if (IsAfk) CmdAfk.ToggleAfk(this, "");
|
||||
/*if (!CheckIfInsideBlock()) { clippos = pos; cliprot = rot; }*/
|
||||
@ -392,7 +392,7 @@ namespace MCGalaxy {
|
||||
HandleDeath(b, 0, customMessage, explode, immediate);
|
||||
}
|
||||
|
||||
public void HandleDeath(byte block, byte extBlock, string customMessage = "",
|
||||
public void HandleDeath(byte block, byte extBlock, string customMessage = "",
|
||||
bool explode = false, bool immediate = false) {
|
||||
if (OnDeath != null) OnDeath(this, block);
|
||||
if (PlayerDeath != null) PlayerDeath(this, block);
|
||||
@ -411,7 +411,9 @@ namespace MCGalaxy {
|
||||
} else {
|
||||
deathMsg = level.CustomBlockProps[extBlock].DeathMessage;
|
||||
}
|
||||
if (deathMsg != null) Chat.GlobalChatLevel(this, String.Format(deathMsg, ColoredName), false);
|
||||
if (deathMsg != null) {
|
||||
Chat.GlobalChatLevel(this, deathMsg.Replace("@p", ColoredName), false);
|
||||
}
|
||||
|
||||
if (block == Block.rockethead) level.MakeExplosion(x, y, z, 0);
|
||||
if (block == Block.creeper) level.MakeExplosion(x, y, z, 1);
|
||||
@ -697,7 +699,7 @@ namespace MCGalaxy {
|
||||
int secs = (int)Math.Ceiling(delta.TotalSeconds);
|
||||
SendMessage("Blocked from using commands for " +
|
||||
"another " + secs + " seconds"); return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user