mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-25 14:17:29 -04:00
Merge branch 'master' of github.com:Hetal728/MCGalaxy
This commit is contained in:
commit
d1b09a5254
@ -85,7 +85,8 @@ namespace MCGalaxy.BlockBehaviour {
|
||||
p.checkpointX = x; p.checkpointY = y; p.checkpointZ = z;
|
||||
int index = p.level.PosToInt(x, y, z);
|
||||
if (index != p.lastCheckpointIndex) {
|
||||
p.SpawnEntity(p, 0xFF, p.pos[0], (ushort)((y - 1) * 32 + 51), p.pos[2], p.rot[0], p.rot[1]);
|
||||
int sendY = (p.pos[1] / 32) * 32 + 10;
|
||||
p.SpawnEntity(p, 0xFF, p.pos[0], (ushort)sendY, p.pos[2], p.rot[0], p.rot[1]);
|
||||
p.lastCheckpointIndex = index;
|
||||
}
|
||||
return true;
|
||||
|
@ -114,7 +114,9 @@ namespace MCGalaxy {
|
||||
for (int i = 0; i < names.Length; i++) {
|
||||
Properties[i].Name = names[i];
|
||||
if (names[i] != "unknown")
|
||||
Aliases[names[i]] = (byte)i;
|
||||
Aliases[names[i]] = (byte)i;
|
||||
if (names[i].IndexOf('_') >= 0)
|
||||
Aliases[names[i].Replace("_", "")] = (byte)i;
|
||||
}
|
||||
|
||||
// Add old MCGalaxy aliases
|
||||
|
@ -76,6 +76,7 @@ namespace MCGalaxy.Games {
|
||||
void DoRound() {
|
||||
if (!Running) return;
|
||||
List<Player> players = DoRoundCountdown();
|
||||
if (players == null) return;
|
||||
RoundInProgress = true;
|
||||
Random random = new Random();
|
||||
Player first = PickFirstZombie(random, players);
|
||||
@ -125,6 +126,7 @@ namespace MCGalaxy.Games {
|
||||
List<Player> DoRoundCountdown() {
|
||||
while (true) {
|
||||
RoundStart = DateTime.UtcNow.AddSeconds(30);
|
||||
if (!Running) return null;
|
||||
CurLevel.ChatLevel("&4Round Start:&f 30...");
|
||||
Thread.Sleep(20000); if (!Running) return null;
|
||||
CurLevel.ChatLevel("&4Round Start:&f 10...");
|
||||
@ -150,6 +152,7 @@ namespace MCGalaxy.Games {
|
||||
}
|
||||
}
|
||||
|
||||
if (!Running) return null;
|
||||
if (nonRefPlayers >= 2) return players;
|
||||
CurLevel.ChatLevel("&cNeed 2 or more players to start a round.");
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ namespace MCGalaxy.BlockPhysics {
|
||||
door = true; break;
|
||||
}
|
||||
}
|
||||
if (!wait)
|
||||
return false;
|
||||
if (!wait) return false;
|
||||
|
||||
if (door && C.time < 2) {
|
||||
// TODO: perhaps do proper bounds checking
|
||||
@ -179,7 +178,7 @@ namespace MCGalaxy.BlockPhysics {
|
||||
if (rainbownum > 2) {
|
||||
byte block = lvl.blocks[C.b];
|
||||
if (block < Block.red || block > Block.darkpink) {
|
||||
lvl.AddUpdate(C.b, Block.red, true, C.data);
|
||||
lvl.AddUpdate(C.b, Block.red, false, C.data);
|
||||
} else {
|
||||
byte next = block == Block.darkpink ? Block.red : (byte)(block + 1);
|
||||
lvl.AddUpdate(C.b, next);
|
||||
|
101
Levels/PhysicsArgs.cs
Normal file
101
Levels/PhysicsArgs.cs
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
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 System.Runtime.InteropServices;
|
||||
|
||||
namespace MCGalaxy.BlockPhysics {
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct PhysicsArgs {
|
||||
public uint Raw;
|
||||
|
||||
// Flags
|
||||
/// <summary> Whether this physics item should wait before performing its other arguments. </summary>
|
||||
public bool Wait {
|
||||
get { return (Raw & (1u << 0)) != 0; }
|
||||
set { Raw &= ~(1u << 0);
|
||||
Raw |= (value ? 1u : 0u) << 0; }
|
||||
}
|
||||
|
||||
/// <summary> Whether this physics item should randomly drop downards. </summary>
|
||||
public bool Drop {
|
||||
get { return (Raw & (1u << 1)) != 0; }
|
||||
set { Raw &= ~(1u << 1);
|
||||
Raw |= (value ? 1u : 0u) << 1; }
|
||||
}
|
||||
|
||||
/// <summary> Whether this physics item should randomly convert back into air. </summary>
|
||||
public bool Dissipate {
|
||||
get { return (Raw & (1u << 2)) != 0; }
|
||||
set { Raw &= ~(1u << 2);
|
||||
Raw |= (value ? 1u : 0u) << 2; }
|
||||
}
|
||||
|
||||
/// <summary> Whether this physics item should revert back into the given block id. </summary>
|
||||
public bool Revert {
|
||||
get { return (Raw & (1u << 3)) != 0; }
|
||||
set { Raw &= ~(1u << 3);
|
||||
Raw |= (value ? 1u : 0u) << 3; }
|
||||
}
|
||||
|
||||
/// <summary> Whether this physics item should check itself and its neighbours for tdoor activation. </summary>
|
||||
public bool Door {
|
||||
get { return (Raw & (1u << 4)) != 0; }
|
||||
set { Raw &= ~(1u << 4);
|
||||
Raw |= (value ? 1u : 0u) << 4; }
|
||||
}
|
||||
|
||||
/// <summary> Whether this physics item should randomly explode. </summary>
|
||||
public bool Explode {
|
||||
get { return (Raw & (1u << 5)) != 0; }
|
||||
set { Raw &= ~(1u << 5);
|
||||
Raw |= (value ? 1u : 0u) << 5; }
|
||||
}
|
||||
|
||||
/// <summary> Whether this physics update should have a rainbow affect applied. </summary>
|
||||
public bool Rainbow {
|
||||
get { return (Raw & (1u << 6)) != 0; }
|
||||
set { Raw &= ~(1u << 6);
|
||||
Raw |= (value ? 1u : 0u) << 6; }
|
||||
}
|
||||
|
||||
// Data
|
||||
public bool RandomRainbow {
|
||||
get { return (Raw & (1u << 7)) != 0; }
|
||||
set { Raw |= (value ? 1u : 0u) << 7; }
|
||||
}
|
||||
|
||||
public byte Value1 {
|
||||
get { return (byte)(Raw >> 8); }
|
||||
set { Raw &= ~(0xFFu << 8);
|
||||
Raw |= (uint)value << 8; }
|
||||
}
|
||||
|
||||
public byte Value2 {
|
||||
get { return (byte)(Raw >> 16); }
|
||||
set { Raw &= ~(0xFFu << 16);
|
||||
Raw |= (uint)value << 16; }
|
||||
}
|
||||
|
||||
public byte Value3 {
|
||||
get { return (byte)(Raw >> 24); }
|
||||
set { Raw &= ~(0xFFu << 24);
|
||||
Raw |= (uint)value << 24; }
|
||||
}
|
||||
}
|
||||
}
|
@ -470,6 +470,7 @@
|
||||
<Compile Include="Levels\Level.Blocks.cs" />
|
||||
<Compile Include="Levels\Level.Physics.cs" />
|
||||
<Compile Include="Levels\LevelInfo.cs" />
|
||||
<Compile Include="Levels\PhysicsArgs.cs" />
|
||||
<Compile Include="Levels\Physics\AIPhysics.cs" />
|
||||
<Compile Include="Levels\Physics\AirPhysics.cs" />
|
||||
<Compile Include="Levels\Physics\BirdPhysics.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user