mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
cleanup
This commit is contained in:
parent
4f9f09b4e9
commit
02f14cd50f
@ -42,7 +42,8 @@ namespace MCGalaxy.Blocks {
|
||||
internal static HandlePhysics[] physicsHandlers = new HandlePhysics[Block.Count];
|
||||
internal static HandlePhysics[] physicsDoorsHandlers = new HandlePhysics[Block.Count];
|
||||
|
||||
internal static void SetupCoreHandlers() {
|
||||
/// <summary> Initalises deleting, placing, and walkthrough handling behaviour for the core blocks. </summary>
|
||||
internal static void InitCoreHandlers() {
|
||||
for (int i = 0; i < Block.Count; i++) {
|
||||
deleteHandlers[i] = null;
|
||||
placeHandlers[i] = null;
|
||||
@ -94,7 +95,8 @@ namespace MCGalaxy.Blocks {
|
||||
deleteHandlers[Block.door_green_air] = DeleteBehaviour.RevertDoor;
|
||||
}
|
||||
|
||||
internal static void SetupCorePhysicsHandlers() {
|
||||
/// <summary> Initalise physics handling behaviour for the core blocks. </summary>
|
||||
internal static void InitCorePhysicsHandlers() {
|
||||
physicsHandlers[Block.birdblack] = BirdPhysics.Do;
|
||||
physicsHandlers[Block.birdwhite] = BirdPhysics.Do;
|
||||
physicsHandlers[Block.birdlava] = BirdPhysics.Do;
|
||||
|
@ -97,15 +97,15 @@ namespace MCGalaxy
|
||||
public const byte crate = 64;
|
||||
public const byte stonebrick = 65;
|
||||
|
||||
public const byte door_darkpink_air = 66; // unused in core
|
||||
public const byte door_darkgrey_air = 67; // unused in core
|
||||
public const byte door_lightgrey_air = 68; // unused in core
|
||||
public const byte door_white_air = 69; // unused in core
|
||||
public const byte door_darkpink_air = 66; // unused in core
|
||||
public const byte door_darkgrey_air = 67; // unused in core
|
||||
public const byte door_lightgrey_air = 68; // unused in core
|
||||
public const byte door_white_air = 69; // unused in core
|
||||
public const byte flagbase = 70;
|
||||
|
||||
//Seasons
|
||||
//public const byte fallsnow = 71; // unused in core
|
||||
//public const byte snow = 72; // unused in core
|
||||
//public const byte fallsnow = 71; // unused in core
|
||||
//public const byte snow = 72; // unused in core
|
||||
|
||||
public const byte fastdeathlava = 73;
|
||||
|
||||
@ -116,7 +116,7 @@ namespace MCGalaxy
|
||||
public const byte door_cobblestone = 80;
|
||||
public const byte door_cobblestone_air = 81; // unused in core
|
||||
public const byte door_red = 83;
|
||||
public const byte door_red_air = 84; // unused in core
|
||||
public const byte door_red_air = 84; // unused in core
|
||||
|
||||
public const byte door_orange = 85;
|
||||
public const byte door_yellow = 86;
|
||||
@ -269,19 +269,19 @@ namespace MCGalaxy
|
||||
public const byte air_flood_layer = 202;
|
||||
public const byte air_flood_down = 203;
|
||||
public const byte air_flood_up = 204;
|
||||
public const byte door_obsidian_air = 205; // unused in core
|
||||
public const byte door_glass_air = 206; // unused in core
|
||||
public const byte door_stone_air = 207; // unused in core
|
||||
public const byte door_leaves_air = 208; // unused in core
|
||||
public const byte door_sand_air = 209; // unused in core
|
||||
public const byte door_wood_air = 210; // unused in core
|
||||
public const byte door_obsidian_air = 205; // unused in core
|
||||
public const byte door_glass_air = 206; // unused in core
|
||||
public const byte door_stone_air = 207; // unused in core
|
||||
public const byte door_leaves_air = 208; // unused in core
|
||||
public const byte door_sand_air = 209; // unused in core
|
||||
public const byte door_wood_air = 210; // unused in core
|
||||
public const byte door_green_air = 211;
|
||||
public const byte door_tnt_air = 212;
|
||||
public const byte door_stair_air = 213; // unused in core
|
||||
public const byte air_switch_air = 214; // unused in core
|
||||
public const byte water_door_air = 215; // unused in core
|
||||
public const byte lava_door_air = 216; // unused in core
|
||||
public const byte air_door_air = 217; // unused in core
|
||||
public const byte door_stair_air = 213; // unused in core
|
||||
public const byte air_switch_air = 214; // unused in core
|
||||
public const byte water_door_air = 215; // unused in core
|
||||
public const byte lava_door_air = 216; // unused in core
|
||||
public const byte air_door_air = 217; // unused in core
|
||||
// 218, 219 free
|
||||
|
||||
public const byte door_iron = 220;
|
||||
@ -289,11 +289,11 @@ namespace MCGalaxy
|
||||
public const byte door_grass = 222;
|
||||
public const byte door_blue = 223;
|
||||
public const byte door_book = 224;
|
||||
public const byte door_iron_air = 225; // unused in core
|
||||
public const byte door_dirt_air = 226; // unused in core
|
||||
public const byte door_grass_air = 227; // unused in core
|
||||
public const byte door_blue_air = 228; // unused in core
|
||||
public const byte door_book_air = 229; // unused in core
|
||||
public const byte door_iron_air = 225; // unused in core
|
||||
public const byte door_dirt_air = 226; // unused in core
|
||||
public const byte door_grass_air = 227; // unused in core
|
||||
public const byte door_blue_air = 228; // unused in core
|
||||
public const byte door_book_air = 229; // unused in core
|
||||
|
||||
public const byte train = 230;
|
||||
|
||||
@ -324,7 +324,7 @@ namespace MCGalaxy
|
||||
public const byte snaketail = 252;
|
||||
|
||||
public const byte door_gold = 253;
|
||||
public const byte door_gold_air = 254; // unused in core
|
||||
public const byte door_gold_air = 254; // unused in core
|
||||
|
||||
public const byte Zero = 0xff; // backwards compatibility
|
||||
public const byte Invalid = 0xff;
|
||||
|
@ -34,19 +34,19 @@ namespace MCGalaxy
|
||||
|
||||
public static void SetBlocks() {
|
||||
SetCoreProperties();
|
||||
BlockBehaviour.SetupCorePhysicsHandlers();
|
||||
InitDefaults();
|
||||
BlockBehaviour.InitCorePhysicsHandlers();
|
||||
SetDefaultPerms();
|
||||
|
||||
BlockProps.Load("core", Block.Props);
|
||||
BlockBehaviour.SetupCoreHandlers();
|
||||
BlockBehaviour.InitCoreHandlers();
|
||||
|
||||
// Custom permissions set by the user.
|
||||
if (File.Exists(Paths.BlockPermsFile)) {
|
||||
string[] lines = File.ReadAllLines(Paths.BlockPermsFile);
|
||||
if (lines.Length > 0 && lines[0] == "#Version 2") {
|
||||
LoadVersion2(lines);
|
||||
LoadPermsVersion2(lines);
|
||||
} else {
|
||||
LoadVersion1(lines);
|
||||
LoadPermsVersion1(lines);
|
||||
}
|
||||
}
|
||||
SaveBlocks(BlockList);
|
||||
@ -87,7 +87,7 @@ namespace MCGalaxy
|
||||
}
|
||||
|
||||
|
||||
static void LoadVersion2(string[] lines) {
|
||||
static void LoadPermsVersion2(string[] lines) {
|
||||
string[] colon = new string[] { " : " };
|
||||
foreach (string line in lines) {
|
||||
if (line == "" || line[0] == '#') continue;
|
||||
@ -121,7 +121,7 @@ namespace MCGalaxy
|
||||
}
|
||||
}
|
||||
|
||||
static void LoadVersion1(string[] lines) {
|
||||
static void LoadPermsVersion1(string[] lines) {
|
||||
foreach (string line in lines) {
|
||||
if (line == "" || line[0] == '#') continue;
|
||||
|
||||
@ -141,13 +141,13 @@ namespace MCGalaxy
|
||||
public static void SaveBlocks(IEnumerable<Blocks> givenList) {
|
||||
try {
|
||||
lock (saveLock)
|
||||
SaveBlocksCore(givenList);
|
||||
SaveBlocksPermsCore(givenList);
|
||||
} catch (Exception e) {
|
||||
Server.ErrorLog(e);
|
||||
}
|
||||
}
|
||||
|
||||
static void SaveBlocksCore(IEnumerable<Blocks> givenList) {
|
||||
static void SaveBlocksPermsCore(IEnumerable<Blocks> givenList) {
|
||||
using (StreamWriter w = new StreamWriter(Paths.BlockPermsFile)) {
|
||||
w.WriteLine("#Version 2");
|
||||
w.WriteLine("# This file dictates which ranks may use what blocks");
|
||||
@ -170,7 +170,7 @@ namespace MCGalaxy
|
||||
}
|
||||
|
||||
|
||||
static void InitDefaults() {
|
||||
static void SetDefaultPerms() {
|
||||
for (int i = 0; i < Block.Count; i++) {
|
||||
Blocks b = new Blocks();
|
||||
b.type = (byte)i;
|
||||
@ -228,31 +228,8 @@ namespace MCGalaxy
|
||||
case lava_sponge:
|
||||
|
||||
case door_tree_air:
|
||||
case door_obsidian_air:
|
||||
case door_glass_air:
|
||||
case door_stone_air:
|
||||
case door_leaves_air:
|
||||
case door_sand_air:
|
||||
case door_wood_air:
|
||||
case door_green_air:
|
||||
case door_tnt_air:
|
||||
case door_stair_air:
|
||||
case air_switch_air:
|
||||
case water_door_air:
|
||||
case lava_door_air:
|
||||
case air_door_air:
|
||||
case door_iron_air:
|
||||
case door_gold_air:
|
||||
case door_cobblestone_air:
|
||||
case door_grass_air:
|
||||
case door_dirt_air:
|
||||
case door_blue_air:
|
||||
case door_book_air:
|
||||
case door_red_air:
|
||||
case door_darkpink_air:
|
||||
case door_darkgrey_air:
|
||||
case door_lightgrey_air:
|
||||
case door_white_air:
|
||||
|
||||
case odoor1_air:
|
||||
case odoor2_air:
|
||||
|
@ -157,7 +157,7 @@ namespace MCGalaxy.Commands.World {
|
||||
scope[id].Changed = true;
|
||||
|
||||
if (scope == Block.Props) {
|
||||
BlockBehaviour.SetupCoreHandlers();
|
||||
BlockBehaviour.InitCoreHandlers();
|
||||
BlockProps.Save("core", scope);
|
||||
} else if (scope == BlockDefinition.GlobalProps) {
|
||||
Level[] loaded = LevelInfo.Loaded.Items;
|
||||
|
Loading…
x
Reference in New Issue
Block a user