diff --git a/Blocks/Block.CoreProps.cs b/Blocks/Block.CoreProps.cs new file mode 100644 index 000000000..09f7e12ae --- /dev/null +++ b/Blocks/Block.CoreProps.cs @@ -0,0 +1,34 @@ +/* + Copyright 2015 MCGalaxy + + Dual-licensed under the Educational Community License, Version 2.0 and + the GNU General Public License, Version 3 (the "Licenses"); you may + not use this file except in compliance with the Licenses. You may + obtain a copy of the Licenses at + + http://www.opensource.org/licenses/ecl2.php + http://www.gnu.org/licenses/gpl-3.0.html + + Unless required by applicable law or agreed to in writing, + software distributed under the Licenses are distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the Licenses for the specific language governing + permissions and limitations under the Licenses. + */ +using System; +using MCGalaxy.Blocks; + +namespace MCGalaxy { + public sealed partial class Block { + public static BlockProps[] Properties = new BlockProps[256]; + + static void SetDefaultProperties() { + for (int i = 0; i < 256; i++) { + Properties[i] = new BlockProps((byte)i); + // Fallback for unrecognised physics blocks + if (i >= Block.CpeCount) + Properties[i].ConvertId = Block.orange; + } + } + } +} diff --git a/Blocks/BlockProps.cs b/Blocks/BlockProps.cs index c50130b61..f875823a8 100644 --- a/Blocks/BlockProps.cs +++ b/Blocks/BlockProps.cs @@ -1,39 +1,56 @@ -/* - Copyright 2015 MCGalaxy - - Dual-licensed under the Educational Community License, Version 2.0 and - the GNU General Public License, Version 3 (the "Licenses"); you may - not use this file except in compliance with the Licenses. You may - obtain a copy of the Licenses at - - http://www.opensource.org/licenses/ecl2.php - http://www.gnu.org/licenses/gpl-3.0.html - - Unless required by applicable law or agreed to in writing, - software distributed under the Licenses are distributed on an "AS IS" - BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the Licenses for the specific language governing - permissions and limitations under the Licenses. - */ -using System; - -namespace MCGalaxy.Blocks { - - public struct BlockProps { - - /// Standard block id sent to clients in map and block update packets. - public byte ConvertId; - - /// Block id converted to when the map is saved to a .lvl file. - public byte SaveConvertId; - - /// Block name used for in commands. - public string Name; - - public BlockProps(byte type) { - ConvertId = type; - SaveConvertId = type; - Name = "unknown"; - } - } -} +/* + Copyright 2015 MCGalaxy + + Dual-licensed under the Educational Community License, Version 2.0 and + the GNU General Public License, Version 3 (the "Licenses"); you may + not use this file except in compliance with the Licenses. You may + obtain a copy of the Licenses at + + http://www.opensource.org/licenses/ecl2.php + http://www.gnu.org/licenses/gpl-3.0.html + + Unless required by applicable law or agreed to in writing, + software distributed under the Licenses are distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the Licenses for the specific language governing + permissions and limitations under the Licenses. + */ +using System; + +namespace MCGalaxy.Blocks { + + public struct BlockProps { + + /// Standard block id sent to clients in map and block update packets. + public byte ConvertId; + + /// Block id converted to when the map is saved to a .lvl file. + public byte SaveConvertId; + + /// Block name used for in commands. + public string Name; + + /// Whether this block is considered a tdoor. + public bool IsTDoor; + /// Whether this block is considered a message block. + public bool IsMessageBlock; + /// Whether this block is considered a portal. + public bool IsPortal; + + /// Whether walkinhg through this block causes the death of that player. + public bool CausesDeath; + + /// Whether light passes through this block. + public bool LightPasses; + + /// Whether this block is an OP block (cannot be replaced by physics changes). + public bool OPBlock; + + public BlockProps(byte type) { + this = default(BlockProps); + ConvertId = type; + SaveConvertId = type; + Name = "unknown"; + } + } +} diff --git a/Commands/CmdOverseer.cs b/Commands/CmdOverseer.cs index 3c1a9b3e5..9232d1a26 100644 --- a/Commands/CmdOverseer.cs +++ b/Commands/CmdOverseer.cs @@ -103,11 +103,11 @@ namespace MCGalaxy.Commands string col = value == "" ? "normal" : value; Command.all.Find("env").Use(p, "l " + type.ToLower() + " " + col); } else if (type == "WEATHER") { - if (value == "SUN" || value == "NORMAL") { + if (value.CaselessEq("SUN") || value.CaselessEq("NORMAL")) { Command.all.Find("env").Use(p, "weather 0"); - } else if (value == "RAIN") { + } else if (value.CaselessEq("RAIN")) { Command.all.Find("env").Use(p, "weather 1"); - } else if (value == "SNOW") { + } else if (value.CaselessEq("SNOW")) { Command.all.Find("env").Use(p, "weather 2"); } else { Player.SendMessage(p, "/os env weather [sun/rain/snow/normal] -- Changes the weather of your map."); @@ -116,7 +116,7 @@ namespace MCGalaxy.Commands Player.SendMessage(p, "/os env [fog/cloud/sky/shadow/sun] [hex color code] -- Changes env colors of your map"); Player.SendMessage(p, "/os env level -- Sets the water height of your map"); Player.SendMessage(p, "/os env cloudheight -- Sets the cloud height of your map"); - Player.SendMessage(p, "/os env maxcfog -- Sets the max fog distance in your map"); + Player.SendMessage(p, "/os env maxfog -- Sets the max fog distance in your map"); Player.SendMessage(p, "/os env horizon -- Sets what block the \"ocean\" shows outside your map"); Player.SendMessage(p, "/os env border -- Sets what block replaces the \"bedrock\" below sea level in your map"); Player.SendMessage(p, "/os env weather [sun/rain/snow/normal] -- Changes the weather of your map.");