static bool DoCopy(Player p, Level lvl, bool global, string cmd, bool keepOrder, BlockDefinition srcDef, BlockID src, BlockID dst) { if (srcDef == null && src < Block.CpeCount) { srcDef = DefaultSet.MakeCustomBlock(src); } if (srcDef == null) { MessageNoBlock(p, src, global, cmd); return(false); } BlockDefinition[] defs = global ? BlockDefinition.GlobalDefs : lvl.CustomBlockDefs; BlockDefinition dstDef = defs[dst]; if (ExistsInScope(dstDef, dst, global)) { MessageAlreadyBlock(p, dst, global, cmd); return(false); } dstDef = srcDef.Copy(); dstDef.SetBlock(dst); if (!keepOrder) { dstDef.InventoryOrder = -1; } UpdateBlock(p, lvl, dstDef, global); return(true); }
public static void SetCollide(BlockID block, byte collide) { // necessary for cases where servers redefined core blocks before extended types were introduced collide = DefaultSet.MapOldCollide(block, collide); ExtendedCollide[block] = collide; // Reduce extended collision types to their simpler forms if (collide == CollideType.Ice) { collide = CollideType.Solid; } if (collide == CollideType.SlipperyIce) { collide = CollideType.Solid; } if (collide == CollideType.LiquidWater) { collide = CollideType.Liquid; } if (collide == CollideType.LiquidLava) { collide = CollideType.Liquid; } Collide[block] = collide; }
static void CopyBlockDefs(string src, string dst) { string path = null; path = Path.Combine(oldServer, BlockDefinition.GlobalPath); BlockDefinition[] defs = BlockDefinition.Load(path); path = Path.Combine(oldServer, Paths.MapBlockDefs(src)); // Local/Level custom blocks override global ones if (File.Exists(path)) { BlockDefinition[] localDefs = BlockDefinition.Load(path); for (int i = 0; i < localDefs.Length; i++) { if (localDefs[i] == null || string.IsNullOrEmpty(localDefs[i].Name)) { continue; } defs[i] = localDefs[i]; } } // If block was original classic/CPE block on old server, but is now a custom block on new server // then make a block definition to prevent textures looking wrong (e.g. for Glass) for (int i = 0; i < Block.CpeCount; i++) { if (defs[i] == null && BlockDefinition.GlobalDefs[i] != null) { defs[i] = DefaultSet.MakeCustomBlock((BlockID)i); } } defs[0] = null; BlockDefinition.Save(false, defs, Paths.MapBlockDefs(dst)); }
/// <summary> /// Returns the markers that have annotated a given vertex /// </summary> /// <param name="vertex">The vertex in question</param> /// <returns>The set of markers that have annotated this vertex</returns> public virtual Set GetAnnotationMarkers(object vertex) { DefaultSet set = new DefaultSet(); foreach (Pair <int, object> p in annotations.GetValues(vertex)) { set.Add(p.Object1); } return(set); }
public byte CollideType(ExtBlock block) { BlockDefinition def = GetBlockDef(block); byte collide = def != null ? def.CollideType : MCGalaxy.Blocks.CollideType.Solid; if (def == null && !block.IsCustomType) { return(DefaultSet.Collide(Block.Convert(block.BlockID))); } return(collide); }
public byte CollideType(BlockID block) { BlockDefinition def = GetBlockDef(block); byte collide = def != null ? def.CollideType : MCGalaxy.Blocks.CollideType.Solid; if (def == null && block < Block.Extended) { return(DefaultSet.Collide(Block.Convert(block))); } return(collide); }
/// <summary> /// Initializes the state instance /// </summary> /// <param name="parentGraph">The graph being operated upon</param> public State(Graph parentGraph) { Pre = new Dictionary <object, int>(); Post = new Dictionary <object, int>(); Visited = new DefaultSet(); ParentGraph = parentGraph; SubGraph = ParentGraph.CreateGraph(); preNumber = 1; postNumber = 1; }
public static void ResetBlockProps(BlockID block) { BlocksLight[block] = DefaultSet.BlocksLight(block); FullBright[block] = DefaultSet.FullBright(block); FogColour[block] = DefaultSet.FogColour(block); FogDensity[block] = DefaultSet.FogDensity(block); SetCollide(block, DefaultSet.Collide(block)); DigSounds[block] = DefaultSet.DigSound(block); StepSounds[block] = DefaultSet.StepSound(block); SpeedMultiplier[block] = 1; Name[block] = DefaultName(block); Tinted[block] = false; SpriteOffset[block] = 0; Draw[block] = DefaultSet.Draw(block); if (Draw[block] == DrawType.Sprite) { MinBB[block] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[block] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[block] = Vector3.Zero; MaxBB[block] = Vector3.One; MaxBB[block].Y = DefaultSet.Height(block); } SetBlockDraw(block, Draw[block]); CalcRenderBounds(block); LightOffset[block] = CalcLightOffset(block); if (block >= Block.CpeCount) { #if USE16_BIT // give some random texture ids SetTex((block * 10 + (block % 7) + 20) % 80, Side.Top, block); SetTex((block * 8 + (block & 5) + 5) % 80, Side.Bottom, block); SetSide((block * 4 + (block / 4) + 4) % 80, block); #else SetTex(0, Side.Top, block); SetTex(0, Side.Bottom, block); SetSide(0, block); #endif } else { SetTex(topTex[block], Side.Top, block); SetTex(bottomTex[block], Side.Bottom, block); SetSide(sideTex[block], block); } }
/// <summary> /// 默认回复设置 /// </summary> /// <param name="entity"></param> /// <returns></returns> public IActionResult DefaultReply(DefaultSet entity = null) { if (NHttpContext.Current.Request.IsAjaxRequest()) { StateCode state = ServiceIoc.Get <DefaultSetService>().SaveDefaultSets(entity); return(Json(GetResult(state))); } else { //获取账号默认回复设置 DefaultSet defaultSet = ServiceIoc.Get <DefaultSetService>().GetDefaultSet(); if (defaultSet != null) { //关注回复类型 if (!string.IsNullOrEmpty(defaultSet.a_reply_value)) { string a_type = defaultSet.a_reply_value.Split('#')[1]; //关注回复业务ID int a_bizid = int.Parse(defaultSet.a_reply_value.Split('#')[0].ToString()); //对应关键词 List <KeyWord> keyWord = ServiceIoc.Get <KeyWordService>().GetKeywordGroup(a_bizid, a_type); if (keyWord != null && keyWord.Count > 0) { ViewBag.attention_content = string.Join(" ", keyWord.Select(k => k.keyword).ToArray()); } } //无匹配回复设置 if (!string.IsNullOrEmpty(defaultSet.d_reply_value)) { string d_type = defaultSet.d_reply_value.Split('#')[1]; //关注回复业务ID int d_bizid = int.Parse(defaultSet.d_reply_value.Split('#')[0].ToString()); //对应关键词 List <KeyWord> keyWord = ServiceIoc.Get <KeyWordService>().GetKeywordGroup(d_bizid, d_type); if (keyWord != null && keyWord.Count > 0) { ViewBag.nomatch_content = string.Join(" ", keyWord.Select(k => k.keyword).ToArray()); } } ViewBag.entity = JsonConvert.SerializeObject(defaultSet); } } return(View()); }
/// <summary> Resets the properties for the given block to their defaults. </summary> public void ResetBlockProps(BlockID id) { BlocksLight[id] = DefaultSet.BlocksLight(id); FullBright[id] = DefaultSet.FullBright(id); FogColour[id] = DefaultSet.FogColour(id); FogDensity[id] = DefaultSet.FogDensity(id); Collide[id] = DefaultSet.Collide(id); DigSounds[id] = DefaultSet.DigSound(id); StepSounds[id] = DefaultSet.StepSound(id); SpeedMultiplier[id] = 1; Name[id] = DefaultName(id); Tinted[id] = false; Draw[id] = DefaultSet.Draw(id); if (Draw[id] == DrawType.Sprite) { MinBB[id] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[id] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[id] = Vector3.Zero; MaxBB[id] = Vector3.One; MaxBB[id].Y = DefaultSet.Height(id); } SetBlockDraw(id, Draw[id]); CalcRenderBounds(id); LightOffset[id] = CalcLightOffset(id); if (id >= Block.CpeCount) { #if USE16_BIT // give some random texture ids SetTex((id * 10 + (id % 7) + 20) % 80, Side.Top, id); SetTex((id * 8 + (id & 5) + 5) % 80, Side.Bottom, id); SetSide((id * 4 + (id / 4) + 4) % 80, id); #else SetTex(0, Side.Top, id); SetTex(0, Side.Bottom, id); SetSide(0, id); #endif } else { SetTex(topTex[id], Side.Top, id); SetTex(bottomTex[id], Side.Bottom, id); SetSide(sideTex[id], id); } }
public static AABB BlockAABB(BlockID block, Level lvl) { BlockDefinition def = lvl.GetBlockDef(block); if (def != null) { return(new AABB(def.MinX * 2, def.MinZ * 2, def.MinY * 2, def.MaxX * 2, def.MaxZ * 2, def.MaxY * 2)); } if (block >= Block.Extended) { return(new AABB(0, 0, 0, 32, 32, 32)); } BlockID core = Convert(block); return(new AABB(0, 0, 0, 32, DefaultSet.Height(core) * 2, 32)); }
static void CopyHandler(Player p, string[] parts, bool global, string cmd) { if (parts.Length <= 2) { Help(p, cmd); return; } ExtBlock src, dst; if (!CheckBlock(p, parts[1], out src, true)) { return; } if (!CheckBlock(p, parts[2], out dst)) { return; } BlockDefinition[] defs = global ? BlockDefinition.GlobalDefs : p.level.CustomBlockDefs; BlockDefinition srcDef = defs[src.RawID], dstDef = defs[dst.RawID]; if (srcDef == null && src.BlockID < Block.CpeCount) { srcDef = DefaultSet.MakeCustomBlock(src.BlockID); } if (srcDef == null) { MessageNoBlock(p, src, global, cmd); return; } if (ExistsInScope(dstDef, dst, global)) { MessageAlreadyBlock(p, dst, global, cmd); return; } BlockProps props = global ? BlockDefinition.GlobalProps[src.RawID] : p.level.Props[src.Index]; dstDef = srcDef.Copy(); dstDef.BlockID = (byte)dst.RawID; dstDef.InventoryOrder = -1; AddBlock(p, dstDef, global, cmd, props); string scope = global ? "global" : "level"; Player.Message(p, "Duplicated the {0} custom block with id \"{1}\" to \"{2}\".", scope, src.RawID, dst.RawID); }
public static void ResetBlockProps(BlockID block) { BlocksLight[block] = DefaultSet.BlocksLight(block); FullBright[block] = DefaultSet.FullBright(block); FogCol[block] = DefaultSet.FogColour(block); FogDensity[block] = DefaultSet.FogDensity(block); SetCollide(block, DefaultSet.Collide(block)); DigSounds[block] = DefaultSet.DigSound(block); StepSounds[block] = DefaultSet.StepSound(block); SpeedMultiplier[block] = 1; Name[block] = DefaultName(block); Tinted[block] = false; SpriteOffset[block] = 0; Draw[block] = DefaultSet.Draw(block); if (Draw[block] == DrawType.Sprite) { MinBB[block] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[block] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[block] = Vector3.Zero; MaxBB[block] = Vector3.One; MaxBB[block].Y = DefaultSet.Height(block); } SetBlockDraw(block, Draw[block]); CalcRenderBounds(block); CalcLightOffset(block); if (block >= Block.CpeCount) { SetTex(0, Side.Top, block); SetTex(0, Side.Bottom, block); SetSide(0, block); } else { SetTex(topTex[block], Side.Top, block); SetTex(bottomTex[block], Side.Bottom, block); SetSide(sideTex[block], block); } }
public static AABB BlockAABB(ExtBlock block, Level lvl) { BlockDefinition def = lvl.GetBlockDef(block); if (def != null) { return(new AABB(def.MinX * 2, def.MinZ * 2, def.MinY * 2, def.MaxX * 2, def.MaxZ * 2, def.MaxY * 2)); } if (block.BlockID == Block.custom_block) { return(new AABB(0, 0, 0, 32, 32, 32)); } byte core = Block.Convert(block.BlockID); return(new AABB(0, 0, 0, 32, DefaultSet.Height(core) * 2, 32)); }
public void ResetBlockProps(byte id) { BlocksLight[id] = DefaultSet.BlocksLight(id); FullBright[id] = DefaultSet.FullBright(id); CullWithNeighbours[id] = id != Block.Leaves; FogColour[id] = DefaultSet.FogColour(id); FogDensity[id] = DefaultSet.FogDensity(id); Collide[id] = DefaultSet.Collide(id); DigSounds[id] = DefaultSet.DigSound(id); StepSounds[id] = DefaultSet.StepSound(id); SetBlockDraw(id, DefaultSet.Draw(id)); SpeedMultiplier[id] = 1; Name[id] = DefaultName(id); if (IsSprite[id]) { MinBB[id] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[id] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[id] = Vector3.Zero; MaxBB[id] = Vector3.One; MaxBB[id].Y = DefaultSet.Height(id); } LightOffset[id] = CalcLightOffset(id); if (id >= Block.CpeCount) { SetTex(0, Side.Top, id); SetTex(0, Side.Bottom, id); SetSide(0, id); } else { SetTex(topTex[id], Side.Top, id); SetTex(bottomTex[id], Side.Bottom, id); SetSide(sideTex[id], id); } }
static bool DoEdit(Player p, Level lvl, BlockID block, string[] parts, bool global, string cmd) { BlockDefinition[] defs = global ? BlockDefinition.GlobalDefs : lvl.CustomBlockDefs; BlockDefinition def = defs[block], globalDef = BlockDefinition.GlobalDefs[block]; if (def == null && block < Block.CpeCount) { def = DefaultSet.MakeCustomBlock(block); UpdateBlock(p, lvl, def, global); } if (def != null && !global && def == globalDef) { def = globalDef.Copy(); UpdateBlock(p, lvl, def, global); } if (!ExistsInScope(def, block, global)) { MessageNoBlock(p, block, global, cmd); return(false); } string value = parts[3], blockName = def.Name; bool temp = false, changedFallback = false; string arg = MapPropertyName(parts[2].ToLower()); switch (arg) { case "name": def.Name = value; break; case "collide": if (!EditByte(p, value, "Collide type", ref def.CollideType, arg)) { return(false); } break; case "speed": if (!CommandParser.GetReal(p, value, "Movement speed", ref def.Speed, 0.25f, 3.96f)) { SendEditHelp(p, arg); return(false); } break; case "toptex": if (!EditUShort(p, value, "Top texture", ref def.TopTex, arg)) { return(false); } break; case "alltex": if (!EditUShort(p, value, "All textures", ref def.RightTex, arg)) { return(false); } def.SetAllTex(def.RightTex); break; case "sidetex": if (!EditUShort(p, value, "Side texture", ref def.RightTex, arg)) { return(false); } def.SetSideTex(def.RightTex); break; case "lefttex": if (!EditUShort(p, value, "Left texture", ref def.LeftTex, arg)) { return(false); } break; case "righttex": if (!EditUShort(p, value, "Right texture", ref def.RightTex, arg)) { return(false); } break; case "fronttex": if (!EditUShort(p, value, "Front texture", ref def.FrontTex, arg)) { return(false); } break; case "backtex": if (!EditUShort(p, value, "Back texture", ref def.BackTex, arg)) { return(false); } break; case "bottomtex": if (!EditUShort(p, value, "Bottom texture", ref def.BottomTex, arg)) { return(false); } break; case "blockslight": if (!CommandParser.GetBool(p, value, ref temp)) { SendEditHelp(p, arg); return(false); } def.BlocksLight = temp; break; case "sound": if (!EditByte(p, value, "Walk sound", ref def.WalkSound, arg)) { return(false); } break; case "fullbright": if (!CommandParser.GetBool(p, value, ref temp)) { SendEditHelp(p, arg); return(false); } def.FullBright = temp; break; case "shape": if (!CommandParser.GetBool(p, value, ref temp)) { SendEditHelp(p, arg); return(false); } def.Shape = temp ? (byte)0 : def.MaxZ; break; case "blockdraw": if (!EditByte(p, value, "Block draw", ref def.BlockDraw, arg)) { return(false); } break; case "min": if (!ParseCoords(p, value, ref def.MinX, ref def.MinY, ref def.MinZ)) { SendEditHelp(p, arg); return(false); } break; case "max": if (!ParseCoords(p, value, ref def.MaxX, ref def.MaxY, ref def.MaxZ)) { SendEditHelp(p, arg); return(false); } break; case "fogdensity": if (!EditByte(p, value, "Fog density", ref def.FogDensity, arg)) { return(false); } break; case "fogcolor": ColorDesc rgb = default(ColorDesc); if (!CommandParser.GetHex(p, value, ref rgb)) { return(false); } def.FogR = rgb.R; def.FogG = rgb.G; def.FogB = rgb.B; break; case "fallback": byte fallback = GetFallback(p, value); if (fallback == Block.Invalid) { return(false); } changedFallback = true; value = Block.GetName(p, fallback); def.FallBack = fallback; break; case "order": int order = 0; if (!CommandParser.GetInt(p, value, "Inventory order", ref order, 0, Block.MaxRaw)) { SendEditHelp(p, arg); return(false); } // Don't let multiple blocks be assigned to same order if (order != def.RawID && order != 0) { for (int i = 0; i < defs.Length; i++) { if (defs[i] == null || defs[i].InventoryOrder != order) { continue; } p.Message("Block {0} already had order {1}", defs[i].Name, order); return(false); } } def.InventoryOrder = order == def.RawID ? -1 : order; BlockDefinition.UpdateOrder(def, global, lvl); p.Message("Set inventory order for {0} to {1}", blockName, order == def.RawID ? "default" : order.ToString()); return(true); default: p.Message("Unrecognised property: " + arg); return(false); } p.Message("Set {0} for {1} to {2}", arg, blockName, value); BlockDefinition.Add(def, defs, lvl); if (changedFallback) { BlockDefinition.UpdateFallback(global, def.GetBlock(), lvl); } return(true); }
public static void ResetBlockProps(BlockID block) { BlocksLight[block] = DefaultSet.BlocksLight(block); FullBright[block] = DefaultSet.FullBright(block); FogColour[block] = DefaultSet.FogColour(block); FogDensity[block] = DefaultSet.FogDensity(block); SetCollide(block, DefaultSet.Collide(block)); DigSounds[block] = DefaultSet.DigSound(block); StepSounds[block] = DefaultSet.StepSound(block); SpeedMultiplier[block] = 1; Name[block] = DefaultName(block); Tinted[block] = false; SpriteOffset[block] = 0; Draw[block] = DefaultSet.Draw(block); if (Draw[block] == DrawType.Sprite) { MinBB[block] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[block] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[block] = Vector3.Zero; MaxBB[block] = Vector3.One; MaxBB[block].Y = DefaultSet.Height(block); } #if ALPHA if (block == Block.SugarCane) { MinBB[block] = Vector3.Zero; MaxBB[block] = Vector3.One; } else if (block == Block.Torch || block == Block.RedstoneTorchOff || block == Block.RedstoneTorchOn) { MinBB[block] = new Vector3(7f / 16f, 0, 7f / 16f); MaxBB[block] = new Vector3(9f / 16f, 10f / 16f, 9f / 16f); } else if (block == Block.Ladder) { MinBB[block] = new Vector3(0, 0, 0); MaxBB[block] = new Vector3(1, 1, 2 / 16f); } else if (block == Block.StonePressurePlate || block == Block.WoodPressurePlate) { MinBB[block] = new Vector3(1 / 16f, 0, 1 / 16f); MaxBB[block] = new Vector3(15 / 16f, 1 / 16f, 15 / 16f); } else if (block == Block.Cactus) { MinBB[block] = new Vector3(1 / 16f, 0, 1 / 16f); MaxBB[block] = new Vector3(15 / 16f, 1, 15 / 16f); } else if (block == Block.Fence) { MinBB[block] = new Vector3(6 / 16f, 0, 6 / 16f); MaxBB[block] = new Vector3(10 / 16f, 1, 10 / 16f); } CanStretch[Block.Redstone] = 0; #endif SetBlockDraw(block, Draw[block]); CalcRenderBounds(block); LightOffset[block] = CalcLightOffset(block); if (block >= Block.CpeCount) { #if USE16_BIT // give some random texture ids SetTex((block * 10 + (block % 7) + 20) % 80, Side.Top, block); SetTex((block * 8 + (block & 5) + 5) % 80, Side.Bottom, block); SetSide((block * 4 + (block / 4) + 4) % 80, block); #else SetTex(0, Side.Top, block); SetTex(0, Side.Bottom, block); SetSide(0, block); #endif } else { SetTex(topTex[block], Side.Top, block); SetTex(bottomTex[block], Side.Bottom, block); SetSide(sideTex[block], block); #if ALPHA if (block == Block.Chest) { SetTex(27, Side.Back, block); } else if (block == Block.CraftingTable) { SetTex(59, Side.Back, block); SetTex(59, Side.Right, block); } #endif } }
/// <summary> /// Initializes the constraint instance /// </summary> public AlreadyVisistedConstraint() { visited = new DefaultSet(); }
static void EditHandler(Player p, string[] parts, bool global, string cmd) { if (parts.Length <= 3) { if (parts.Length == 1) { Player.Message(p, "Valid properties: " + helpSections.Keys.Join()); } else if (parts.Length == 3) { Help(p, cmd, "edit " + parts[2]); } else { Help(p, cmd); } return; } ExtBlock block; if (!CheckBlock(p, parts[1], out block)) { return; } BlockDefinition[] defs = global ? BlockDefinition.GlobalDefs : p.level.CustomBlockDefs; BlockDefinition def = defs[block.RawID], globalDef = BlockDefinition.GlobalDefs[block.RawID]; if (def == null && block.BlockID < Block.CpeCount) { def = DefaultSet.MakeCustomBlock(block.BlockID); AddBlock(p, def, global, cmd, BlockDefinition.DefaultProps(block)); } if (def != null && !global && def == globalDef) { def = globalDef.Copy(); AddBlock(p, def, global, cmd, BlockDefinition.DefaultProps(block)); } if (!ExistsInScope(def, block, global)) { MessageNoBlock(p, block, global, cmd); return; } string value = parts[3], blockName = def.Name; float fTemp; bool temp = false, changedFallback = false; Level level = p == null ? null : p.level; string arg = MapPropertyName(parts[2].ToLower()); switch (arg) { case "name": def.Name = value; break; case "collide": if (!EditByte(p, value, "Collide type", ref def.CollideType, arg)) { return; } break; case "speed": if (!Utils.TryParseDecimal(value, out fTemp) || fTemp < 0.25f || fTemp > 3.96f) { SendEditHelp(p, arg); return; } def.Speed = fTemp; break; case "toptex": if (!EditByte(p, value, "Top texture", ref def.TopTex, arg)) { return; } break; case "alltex": if (!EditByte(p, value, "All textures", ref def.SideTex, arg)) { return; } def.SetAllTex(def.SideTex); break; case "sidetex": if (!EditByte(p, value, "Side texture", ref def.SideTex, arg)) { return; } def.SetSideTex(def.SideTex); break; case "lefttex": if (!EditByte(p, value, "Left texture", ref def.LeftTex, arg)) { return; } break; case "righttex": if (!EditByte(p, value, "Right texture", ref def.RightTex, arg)) { return; } break; case "fronttex": if (!EditByte(p, value, "Front texture", ref def.FrontTex, arg)) { return; } break; case "backtex": if (!EditByte(p, value, "Back texture", ref def.BackTex, arg)) { return; } break; case "bottomtex": if (!EditByte(p, value, "Bottom texture", ref def.BottomTex, arg)) { return; } break; case "blockslight": if (!CommandParser.GetBool(p, value, ref temp)) { SendEditHelp(p, arg); return; } def.BlocksLight = temp; break; case "sound": if (!EditByte(p, value, "Walk sound", ref def.WalkSound, arg)) { return; } break; case "fullbright": if (!CommandParser.GetBool(p, value, ref temp)) { SendEditHelp(p, arg); return; } def.FullBright = temp; break; case "shape": if (!CommandParser.GetBool(p, value, ref temp)) { SendEditHelp(p, arg); return; } def.Shape = temp ? (byte)0 : def.MaxZ; break; case "blockdraw": if (!EditByte(p, value, "Block draw", ref def.BlockDraw, arg)) { return; } break; case "min": if (!ParseCoords(p, value, ref def.MinX, ref def.MinY, ref def.MinZ)) { SendEditHelp(p, arg); return; } break; case "max": if (!ParseCoords(p, value, ref def.MaxX, ref def.MaxY, ref def.MaxZ)) { SendEditHelp(p, arg); return; } break; case "fogdensity": if (!EditByte(p, value, "Fog density", ref def.FogDensity, arg)) { return; } break; case "fogcolor": ColorDesc rgb = default(ColorDesc); if (!CommandParser.GetHex(p, value, ref rgb)) { return; } def.FogR = rgb.R; def.FogG = rgb.G; def.FogB = rgb.B; break; case "fallback": byte fallback = GetFallback(p, value); if (fallback == Block.Invalid) { return; } changedFallback = true; value = Block.Name(fallback); def.FallBack = fallback; break; case "order": int order = 0; if (!CommandParser.GetInt(p, value, "Inventory order", ref order, 1, 255)) { SendEditHelp(p, arg); return; } def.InventoryOrder = order == def.BlockID ? -1 : order; BlockDefinition.UpdateOrder(def, global, level); BlockDefinition.Save(global, level); Player.Message(p, "Set inventory order for {0} to {1}", blockName, order == def.BlockID ? "default" : order.ToString()); return; default: Player.Message(p, "Unrecognised property: " + arg); return; } Player.Message(p, "Set {0} for {1} to {2}", arg, blockName, value); BlockDefinition.Add(def, defs, level); if (changedFallback) { BlockDefinition.UpdateFallback(global, def.BlockID, level); } }
void Awake() { instance = SingletonManger.GetSingleton <DefaultSet> (); }
/// <summary> /// Initializes the undirected graph /// </summary> public UndirectedGraph() { vertices = new DefaultSet(); edges = new DefaultSet(); succs = new MultiValueDictionary(); }