Create PacketView, a more efficient packet handler.
* Include higher level functions in the vector library. * Optimize more includes. * Add outlined textures to repo and switch the graphics.master
parent
0a41147846
commit
2baf847828
|
@ -1,318 +1,325 @@
|
|||
set(ZEPHA_SRC
|
||||
game/graph/meshtypes/ChunkMesh.cpp
|
||||
game/graph/meshtypes/ChunkMesh.h
|
||||
game/entity/Entity.cpp
|
||||
game/entity/Entity.h
|
||||
game/graph/shader/Shader.cpp
|
||||
game/graph/shader/Shader.h
|
||||
game/graph/window/Window.cpp
|
||||
game/graph/window/Window.h
|
||||
game/graph/Camera.cpp
|
||||
game/graph/Camera.h
|
||||
game/graph/Texture.cpp
|
||||
game/graph/Texture.h
|
||||
game/scene/world/graph/MeshGenerator.cpp
|
||||
game/scene/world/graph/MeshGenerator.h
|
||||
util/Timer.cpp
|
||||
util/Timer.h
|
||||
def/LocalDefinitionAtlas.cpp
|
||||
def/LocalDefinitionAtlas.h
|
||||
def/item/MeshPart.cpp
|
||||
def/item/MeshPart.h
|
||||
def/item/ShaderMod.h
|
||||
def/item/BlockModelVertex.h
|
||||
game/scene/world/LocalWorld.cpp
|
||||
game/scene/world/LocalWorld.h
|
||||
world/chunk/BlockChunk.cpp
|
||||
world/chunk/BlockChunk.h
|
||||
game/scene/world/graph/MeshChunk.cpp
|
||||
game/scene/world/graph/MeshChunk.h
|
||||
game/scene/GameScene.cpp
|
||||
game/scene/GameScene.h
|
||||
game/graph/Renderer.cpp
|
||||
game/graph/Renderer.h
|
||||
lua/parser/LocalLuaParser.cpp
|
||||
lua/parser/LocalLuaParser.h
|
||||
game/hud/components/basic/GuiText.cpp
|
||||
game/hud/components/basic/GuiText.h
|
||||
game/hud/DebugGui.cpp
|
||||
game/hud/DebugGui.h
|
||||
game/scene/world/Player.cpp
|
||||
game/scene/world/Player.h
|
||||
util/Ray.cpp
|
||||
util/Ray.h
|
||||
game/Client.cpp
|
||||
game/Client.h
|
||||
game/graph/scene/SceneManager.cpp
|
||||
game/graph/scene/SceneManager.h
|
||||
game/graph/scene/Scene.h
|
||||
game/ClientState.h
|
||||
game/scene/MainMenuScene.cpp
|
||||
game/scene/MainMenuScene.h
|
||||
server/Server.cpp
|
||||
server/Server.h
|
||||
util/net/Packet.cpp
|
||||
util/net/Packet.h
|
||||
game/scene/net/ClientNetworkInterpreter.cpp
|
||||
game/scene/net/ClientNetworkInterpreter.h
|
||||
def/gen/MapGen.cpp
|
||||
def/gen/MapGen.h
|
||||
util/net/NetHandler.cpp
|
||||
util/net/NetHandler.h
|
||||
game/hud/GameGui.cpp
|
||||
game/hud/GameGui.h
|
||||
server/conn/ClientList.cpp
|
||||
server/conn/ClientList.h
|
||||
server/conn/ServerClient.h
|
||||
util/net/PacketChannel.h
|
||||
game/entity/engine/PlayerEntity.h
|
||||
game/hud/components/basic/GuiRect.cpp
|
||||
game/hud/components/basic/GuiRect.h
|
||||
game/hud/components/basic/GuiGraph.cpp
|
||||
game/hud/components/basic/GuiGraph.h
|
||||
def/gen/MapGenJob.h
|
||||
util/Interp.h
|
||||
def/gen/NoiseSample.cpp
|
||||
def/gen/NoiseSample.h
|
||||
game/graph/frustum/Frustum.cpp
|
||||
game/graph/frustum/Frustum.h
|
||||
game/graph/frustum/FrustumPlane.cpp
|
||||
game/graph/frustum/FrustumPlane.h
|
||||
game/graph/frustum/FrustumAABB.cpp
|
||||
game/graph/frustum/FrustumAABB.h
|
||||
server/world/ServerWorld.cpp
|
||||
server/world/ServerWorld.h
|
||||
server/world/WorldGenStream.cpp
|
||||
server/world/WorldGenStream.h
|
||||
game/scene/world/WorldInterpolationStream.cpp
|
||||
game/scene/world/WorldInterpolationStream.h
|
||||
util/Space.h
|
||||
game/scene/world/MeshGenStream.cpp
|
||||
game/scene/world/MeshGenStream.h
|
||||
util/Vec.h
|
||||
world/LocalDimension.cpp
|
||||
world/LocalDimension.h
|
||||
world/region/Region.h
|
||||
game/entity/engine/WireframeEntity.cpp
|
||||
game/entity/engine/WireframeEntity.h
|
||||
def/item/SelectionBox.h
|
||||
game/graph/drawable/Drawable.h
|
||||
game/graph/drawable/DrawableGroup.cpp
|
||||
game/graph/drawable/DrawableGroup.h
|
||||
game/graph/window/Input.cpp
|
||||
game/graph/window/Input.h
|
||||
game/entity/engine/BlockCrackEntity.cpp
|
||||
game/entity/engine/BlockCrackEntity.h
|
||||
def/texture/TextureAtlas.cpp
|
||||
def/texture/TextureAtlas.h
|
||||
def/texture/AtlasRef.h
|
||||
world/region/MapBlock.h
|
||||
def/ClientGame.cpp
|
||||
def/ClientGame.h
|
||||
world/region/Region.cpp
|
||||
world/region/MapBlock.cpp
|
||||
util/Util.h
|
||||
world/block/PointedThing.h
|
||||
game/hud/components/compound/GuiLabelledGraph.cpp
|
||||
game/hud/components/compound/GuiLabelledGraph.cpp
|
||||
game/entity/engine/ParticleEntity.cpp
|
||||
game/entity/engine/ParticleEntity.h
|
||||
def/ServerGame.cpp
|
||||
def/ServerGame.h
|
||||
def/ServerDefinitionAtlas.cpp
|
||||
def/ServerDefinitionAtlas.h
|
||||
def/item/BlockDef.cpp
|
||||
def/item/BlockDef.h
|
||||
util/Dir.h
|
||||
def/DefinitionAtlas.h
|
||||
lua/LuaParser.cpp
|
||||
lua/LuaParser.h
|
||||
lua/parser/ServerLuaParser.cpp
|
||||
lua/parser/ServerLuaParser.h
|
||||
util/Log.h
|
||||
lua/Callback.h
|
||||
game/graph/shader/GuiUniforms.h
|
||||
game/graph/meshtypes/EntityMesh.cpp
|
||||
game/graph/meshtypes/EntityMesh.h
|
||||
server/conn/ServerClient.cpp
|
||||
server/config/ServerConfig.cpp
|
||||
server/config/ServerConfig.h
|
||||
util/net/PacketType.h
|
||||
util/net/NetState.h
|
||||
game/scene/ConnectScene.cpp
|
||||
game/scene/ConnectScene.h
|
||||
util/net/Address.h
|
||||
game/scene/net/ServerConnection.cpp
|
||||
game/scene/net/ServerConnection.h
|
||||
game/scene/world/MeshDetails.h
|
||||
game/hud/components/GuiComponent.cpp
|
||||
game/hud/components/GuiComponent.h
|
||||
game/hud/components/basic/GuiContainer.cpp
|
||||
game/hud/components/basic/GuiContainer.h
|
||||
lua/LuaModFile.h
|
||||
lua/LuaMod.h
|
||||
lua/LuaModConfig.h
|
||||
server/asset/ServerTexture.h
|
||||
server/asset/AssetStorage.h
|
||||
lua/LuaMod.cpp
|
||||
def/ItemDef.h
|
||||
def/DefinitionAtlas.cpp
|
||||
def/item/BlockModel.h
|
||||
def/texture/Font.cpp
|
||||
def/texture/Font.h
|
||||
game/entity/Model.cpp
|
||||
game/entity/Model.h
|
||||
game/graph/meshtypes/EntityVertex.h
|
||||
game/graph/meshtypes/ChunkVertex.h
|
||||
game/graph/meshtypes/Mesh.cpp
|
||||
game/graph/meshtypes/Mesh.h
|
||||
util/Mat4Conv.h
|
||||
game/entity/ModelBone.cpp
|
||||
game/entity/ModelBone.h
|
||||
game/entity/ModelAnimation.cpp
|
||||
game/entity/ModelAnimation.h
|
||||
game/entity/AnimChannel.cpp
|
||||
game/entity/AnimChannel.h
|
||||
game/entity/AnimationState.cpp
|
||||
game/entity/AnimationState.h
|
||||
game/entity/AnimationSegment.h
|
||||
lua/api/usertype/cLuaEntity.h
|
||||
StartGame.h
|
||||
game/graph/shader/SSAOShader.cpp
|
||||
game/graph/shader/SSAOShader.h
|
||||
game/graph/shader/BlurShader.cpp
|
||||
game/graph/shader/BlurShader.h
|
||||
game/graph/shader/LightingShader.cpp
|
||||
game/graph/shader/LightingShader.h
|
||||
game/graph/shader/WorldGeometryShader.cpp
|
||||
game/graph/shader/WorldGeometryShader.h
|
||||
game/graph/shader/EntityGeometryShader.cpp
|
||||
game/graph/shader/EntityGeometryShader.h
|
||||
game/scene/world/graph/ChunkRenderElem.h
|
||||
world/ServerDimension.cpp
|
||||
world/ServerDimension.h
|
||||
def/item/CraftItemDef.cpp
|
||||
def/item/CraftItemDef.h
|
||||
lua/api/modules/add_entity.h
|
||||
lua/api/class/LocalLuaEntity.cpp
|
||||
lua/api/class/LocalLuaEntity.h
|
||||
def/model/SerializedModel.h
|
||||
server/asset/AssetType.h
|
||||
def/model/ModelStore.h
|
||||
lua/api/modules/remove_entity.h
|
||||
lua/api/functions/update_entities.h
|
||||
lua/api/modules/register_keybind.h
|
||||
lua/LuaInputManager.cpp
|
||||
lua/LuaInputManager.h
|
||||
lua/api/usertype/cLocalPlayer.h
|
||||
lua/api/class/LocalLuaPlayer.cpp
|
||||
lua/api/class/LocalLuaPlayer.h
|
||||
game/entity/Collidable.cpp
|
||||
game/entity/Collidable.h
|
||||
game/hud/components/compound/GuiInventoryList.cpp
|
||||
game/hud/components/compound/GuiInventoryList.h
|
||||
game/hud/components/basic/GuiInventoryItem.cpp
|
||||
game/hud/components/basic/GuiInventoryItem.h
|
||||
game/inventory/ServerInventoryList.cpp
|
||||
game/inventory/ServerInventoryList.h
|
||||
game/inventory/ItemStack.h
|
||||
server/LocalServerInstance.cpp
|
||||
server/LocalServerInstance.h
|
||||
game/hud/SerialGui.h
|
||||
util/Voronoi3D.cpp
|
||||
util/Voronoi3D.h
|
||||
def/gen/BiomeDef.cpp
|
||||
def/gen/BiomeDef.h
|
||||
def/gen/BiomeAtlas.cpp
|
||||
def/gen/BiomeAtlas.h
|
||||
def/gen/ServerBiomeAtlas.cpp
|
||||
def/gen/ServerBiomeAtlas.h
|
||||
def/gen/LocalBiomeAtlas.cpp
|
||||
def/gen/LocalBiomeAtlas.h
|
||||
world/Dimension.cpp
|
||||
world/Dimension.h
|
||||
def/texture/RawTexData.h
|
||||
game/hud/components/compound/GuiImageButton.cpp
|
||||
game/hud/components/compound/GuiImageButton.h
|
||||
game/ClientState.cpp
|
||||
game/scene/menu/Subgame.cpp
|
||||
game/scene/menu/Subgame.h
|
||||
game/scene/menu/SubgameConfig.h
|
||||
game/scene/menu/MenuSandbox.cpp
|
||||
game/scene/menu/MenuSandbox.h
|
||||
lua/api/menu/mDelay.h
|
||||
lua/api/menu/mSetGui.h
|
||||
game/hud/GuiBuilder.cpp
|
||||
game/hud/GuiBuilder.h
|
||||
game/hud/GameGuiBuilder.cpp
|
||||
game/hud/GameGuiBuilder.h
|
||||
lua/api/menu/mStartGame.h
|
||||
lua/api/class/ServerLuaInventoryList.cpp
|
||||
lua/api/class/ServerLuaInventoryList.h
|
||||
lua/api/class/ServerLuaInventory.cpp
|
||||
lua/api/class/ServerLuaInventory.h
|
||||
game/inventory/Inventory.cpp
|
||||
game/inventory/Inventory.h
|
||||
lua/api/class/LuaItemStack.cpp
|
||||
lua/api/class/LuaItemStack.h
|
||||
game/inventory/ItemStack.cpp
|
||||
lua/api/usertype/cInventoryRef.h
|
||||
lua/api/usertype/cItemStack.h
|
||||
game/hud/components/basic/GuiModel.cpp
|
||||
game/hud/components/basic/GuiModel.h
|
||||
server/world/ServerEntity.cpp
|
||||
server/world/ServerEntity.h
|
||||
lua/api/class/ServerLuaEntity.cpp
|
||||
lua/api/class/ServerLuaEntity.h
|
||||
game/scene/LuaErrorScene.cpp
|
||||
game/scene/LuaErrorScene.h
|
||||
lua/api/usertype/sLuaEntity.h
|
||||
util/net/Serializer.h
|
||||
util/net/Deserializer.h
|
||||
lua/api/class/ServerLocalLuaEntity.cpp
|
||||
lua/api/class/ServerLocalLuaEntity.h
|
||||
lua/api/modules/register_item.h
|
||||
lua/api/modules/register_biome.h
|
||||
lua/api/modules/delay.h
|
||||
lua/api/modules/register_block.h
|
||||
lua/api/modules/register_blockmodel.h
|
||||
lua/api/modules/register_entity.h
|
||||
game/scene/world/World.cpp
|
||||
game/scene/world/World.h
|
||||
lua/api/modules/set_block.h
|
||||
lua/api/modules/get_block.h
|
||||
lua/api/modules/remove_block.h
|
||||
lua/register/RegisterBiomes.h
|
||||
lua/register/RegisterBlocks.h
|
||||
lua/register/RegisterItems.h
|
||||
lua/register/RegisterKeybinds.h
|
||||
lua/api/class/LocalLuaAnimationManager.cpp
|
||||
lua/api/class/LocalLuaAnimationManager.h
|
||||
lua/api/usertype/cAnimationManager.h
|
||||
game/scene/world/Schematic.cpp
|
||||
game/scene/world/Schematic.h
|
||||
lua/VenusParser.cpp
|
||||
lua/VenusParser.h
|
||||
lua/ErrorFormatter.cpp
|
||||
lua/ErrorFormatter.h
|
||||
util/RIE.h
|
||||
lua/api/class/ServerLuaPlayer.cpp
|
||||
lua/api/class/ServerLuaPlayer.h
|
||||
lua/api/usertype/sServerPlayer.h
|
||||
lua/api/modules/register_on.h
|
||||
lua/api/functions/trigger_event.h
|
||||
lua/parser/ServerModHandler.cpp
|
||||
lua/parser/ServerModHandler.h
|
||||
lua/parser/LocalModHandler.cpp
|
||||
lua/parser/LocalModHandler.h
|
||||
game/scene/net/NetPlayerField.h
|
||||
game/inventory/LocalInventoryRefs.cpp
|
||||
game/inventory/LocalInventoryRefs.h
|
||||
game/inventory/LocalInventory.cpp
|
||||
game/inventory/LocalInventory.h
|
||||
lua/api/class/LocalLuaInventory.cpp
|
||||
lua/api/class/LocalLuaInventory.h
|
||||
lua/api/class/LocalLuaInventoryList.cpp
|
||||
lua/api/class/LocalLuaInventoryList.h game/inventory/InventoryRefs.cpp game/inventory/InventoryRefs.h game/inventory/InventoryList.cpp game/inventory/InventoryList.h lua/api/modules/time.h)
|
||||
set(ZEPHA_SRC
|
||||
game/graph/meshtypes/ChunkMesh.cpp
|
||||
game/graph/meshtypes/ChunkMesh.h
|
||||
game/entity/Entity.cpp
|
||||
game/entity/Entity.h
|
||||
game/graph/shader/Shader.cpp
|
||||
game/graph/shader/Shader.h
|
||||
game/graph/window/Window.cpp
|
||||
game/graph/window/Window.h
|
||||
game/graph/Camera.cpp
|
||||
game/graph/Camera.h
|
||||
game/graph/Texture.cpp
|
||||
game/graph/Texture.h
|
||||
game/scene/world/graph/MeshGenerator.cpp
|
||||
game/scene/world/graph/MeshGenerator.h
|
||||
util/Timer.cpp
|
||||
util/Timer.h
|
||||
def/LocalDefinitionAtlas.cpp
|
||||
def/LocalDefinitionAtlas.h
|
||||
def/item/MeshPart.cpp
|
||||
def/item/MeshPart.h
|
||||
def/item/ShaderMod.h
|
||||
def/item/BlockModelVertex.h
|
||||
game/scene/world/LocalWorld.cpp
|
||||
game/scene/world/LocalWorld.h
|
||||
world/chunk/BlockChunk.cpp
|
||||
world/chunk/BlockChunk.h
|
||||
game/scene/world/graph/MeshChunk.cpp
|
||||
game/scene/world/graph/MeshChunk.h
|
||||
game/scene/GameScene.cpp
|
||||
game/scene/GameScene.h
|
||||
game/graph/Renderer.cpp
|
||||
game/graph/Renderer.h
|
||||
lua/parser/LocalLuaParser.cpp
|
||||
lua/parser/LocalLuaParser.h
|
||||
game/hud/components/basic/GuiText.cpp
|
||||
game/hud/components/basic/GuiText.h
|
||||
game/hud/DebugGui.cpp
|
||||
game/hud/DebugGui.h
|
||||
game/scene/world/Player.cpp
|
||||
game/scene/world/Player.h
|
||||
util/Ray.cpp
|
||||
util/Ray.h
|
||||
game/Client.cpp
|
||||
game/Client.h
|
||||
game/graph/scene/SceneManager.cpp
|
||||
game/graph/scene/SceneManager.h
|
||||
game/graph/scene/Scene.h
|
||||
game/ClientState.h
|
||||
game/scene/MainMenuScene.cpp
|
||||
game/scene/MainMenuScene.h
|
||||
server/Server.cpp
|
||||
server/Server.h
|
||||
util/net/Packet.cpp
|
||||
util/net/Packet.h
|
||||
game/scene/net/ClientNetworkInterpreter.cpp
|
||||
game/scene/net/ClientNetworkInterpreter.h
|
||||
def/gen/MapGen.cpp
|
||||
def/gen/MapGen.h
|
||||
util/net/NetHandler.cpp
|
||||
util/net/NetHandler.h
|
||||
game/hud/GameGui.cpp
|
||||
game/hud/GameGui.h
|
||||
server/conn/ClientList.cpp
|
||||
server/conn/ClientList.h
|
||||
server/conn/ServerClient.h
|
||||
util/net/PacketChannel.h
|
||||
game/entity/engine/PlayerEntity.h
|
||||
game/hud/components/basic/GuiRect.cpp
|
||||
game/hud/components/basic/GuiRect.h
|
||||
game/hud/components/basic/GuiGraph.cpp
|
||||
game/hud/components/basic/GuiGraph.h
|
||||
def/gen/MapGenJob.h
|
||||
util/Interp.h
|
||||
def/gen/NoiseSample.cpp
|
||||
def/gen/NoiseSample.h
|
||||
game/graph/frustum/Frustum.cpp
|
||||
game/graph/frustum/Frustum.h
|
||||
game/graph/frustum/FrustumPlane.cpp
|
||||
game/graph/frustum/FrustumPlane.h
|
||||
game/graph/frustum/FrustumAABB.cpp
|
||||
game/graph/frustum/FrustumAABB.h
|
||||
server/world/ServerWorld.cpp
|
||||
server/world/ServerWorld.h
|
||||
server/world/WorldGenStream.cpp
|
||||
server/world/WorldGenStream.h
|
||||
game/scene/world/WorldInterpolationStream.cpp
|
||||
game/scene/world/WorldInterpolationStream.h
|
||||
util/Space.h
|
||||
game/scene/world/MeshGenStream.cpp
|
||||
game/scene/world/MeshGenStream.h
|
||||
util/Vec.h
|
||||
world/LocalDimension.cpp
|
||||
world/LocalDimension.h
|
||||
world/region/Region.h
|
||||
game/entity/engine/WireframeEntity.cpp
|
||||
game/entity/engine/WireframeEntity.h
|
||||
def/item/SelectionBox.h
|
||||
game/graph/drawable/Drawable.h
|
||||
game/graph/drawable/DrawableGroup.cpp
|
||||
game/graph/drawable/DrawableGroup.h
|
||||
game/graph/window/Input.cpp
|
||||
game/graph/window/Input.h
|
||||
game/entity/engine/BlockCrackEntity.cpp
|
||||
game/entity/engine/BlockCrackEntity.h
|
||||
def/texture/TextureAtlas.cpp
|
||||
def/texture/TextureAtlas.h
|
||||
def/texture/AtlasRef.h
|
||||
world/region/MapBlock.h
|
||||
def/ClientGame.cpp
|
||||
def/ClientGame.h
|
||||
world/region/Region.cpp
|
||||
world/region/MapBlock.cpp
|
||||
util/Util.h
|
||||
world/block/PointedThing.h
|
||||
game/hud/components/compound/GuiLabelledGraph.cpp
|
||||
game/hud/components/compound/GuiLabelledGraph.cpp
|
||||
game/entity/engine/ParticleEntity.cpp
|
||||
game/entity/engine/ParticleEntity.h
|
||||
def/ServerGame.cpp
|
||||
def/ServerGame.h
|
||||
def/ServerDefinitionAtlas.cpp
|
||||
def/ServerDefinitionAtlas.h
|
||||
def/item/BlockDef.cpp
|
||||
def/item/BlockDef.h
|
||||
util/Dir.h
|
||||
def/DefinitionAtlas.h
|
||||
lua/LuaParser.cpp
|
||||
lua/LuaParser.h
|
||||
lua/parser/ServerLuaParser.cpp
|
||||
lua/parser/ServerLuaParser.h
|
||||
util/Log.h
|
||||
lua/Callback.h
|
||||
game/graph/shader/GuiUniforms.h
|
||||
game/graph/meshtypes/EntityMesh.cpp
|
||||
game/graph/meshtypes/EntityMesh.h
|
||||
server/conn/ServerClient.cpp
|
||||
server/config/ServerConfig.cpp
|
||||
server/config/ServerConfig.h
|
||||
util/net/PacketType.h
|
||||
util/net/NetState.h
|
||||
game/scene/ConnectScene.cpp
|
||||
game/scene/ConnectScene.h
|
||||
util/net/Address.h
|
||||
game/scene/net/ServerConnection.cpp
|
||||
game/scene/net/ServerConnection.h
|
||||
game/scene/world/MeshDetails.h
|
||||
game/hud/components/GuiComponent.cpp
|
||||
game/hud/components/GuiComponent.h
|
||||
game/hud/components/basic/GuiContainer.cpp
|
||||
game/hud/components/basic/GuiContainer.h
|
||||
lua/LuaModFile.h
|
||||
lua/LuaMod.h
|
||||
lua/LuaModConfig.h
|
||||
server/asset/ServerTexture.h
|
||||
server/asset/AssetStorage.h
|
||||
lua/LuaMod.cpp
|
||||
def/ItemDef.h
|
||||
def/DefinitionAtlas.cpp
|
||||
def/item/BlockModel.h
|
||||
def/texture/Font.cpp
|
||||
def/texture/Font.h
|
||||
game/entity/Model.cpp
|
||||
game/entity/Model.h
|
||||
game/graph/meshtypes/EntityVertex.h
|
||||
game/graph/meshtypes/ChunkVertex.h
|
||||
game/graph/meshtypes/Mesh.cpp
|
||||
game/graph/meshtypes/Mesh.h
|
||||
util/Mat4Conv.h
|
||||
game/entity/ModelBone.cpp
|
||||
game/entity/ModelBone.h
|
||||
game/entity/ModelAnimation.cpp
|
||||
game/entity/ModelAnimation.h
|
||||
game/entity/AnimChannel.cpp
|
||||
game/entity/AnimChannel.h
|
||||
game/entity/AnimationState.cpp
|
||||
game/entity/AnimationState.h
|
||||
game/entity/AnimationSegment.h
|
||||
lua/api/usertype/cLuaEntity.h
|
||||
StartGame.h
|
||||
game/graph/shader/SSAOShader.cpp
|
||||
game/graph/shader/SSAOShader.h
|
||||
game/graph/shader/BlurShader.cpp
|
||||
game/graph/shader/BlurShader.h
|
||||
game/graph/shader/LightingShader.cpp
|
||||
game/graph/shader/LightingShader.h
|
||||
game/graph/shader/WorldGeometryShader.cpp
|
||||
game/graph/shader/WorldGeometryShader.h
|
||||
game/graph/shader/EntityGeometryShader.cpp
|
||||
game/graph/shader/EntityGeometryShader.h
|
||||
game/scene/world/graph/ChunkRenderElem.h
|
||||
world/ServerDimension.cpp
|
||||
world/ServerDimension.h
|
||||
def/item/CraftItemDef.cpp
|
||||
def/item/CraftItemDef.h
|
||||
lua/api/modules/add_entity.h
|
||||
lua/api/class/LocalLuaEntity.cpp
|
||||
lua/api/class/LocalLuaEntity.h
|
||||
def/model/SerializedModel.h
|
||||
server/asset/AssetType.h
|
||||
def/model/ModelStore.h
|
||||
lua/api/modules/remove_entity.h
|
||||
lua/api/functions/update_entities.h
|
||||
lua/api/modules/register_keybind.h
|
||||
lua/LuaInputManager.cpp
|
||||
lua/LuaInputManager.h
|
||||
lua/api/usertype/cLocalPlayer.h
|
||||
lua/api/class/LocalLuaPlayer.cpp
|
||||
lua/api/class/LocalLuaPlayer.h
|
||||
game/entity/Collidable.cpp
|
||||
game/entity/Collidable.h
|
||||
game/hud/components/compound/GuiInventoryList.cpp
|
||||
game/hud/components/compound/GuiInventoryList.h
|
||||
game/hud/components/basic/GuiInventoryItem.cpp
|
||||
game/hud/components/basic/GuiInventoryItem.h
|
||||
game/inventory/ServerInventoryList.cpp
|
||||
game/inventory/ServerInventoryList.h
|
||||
game/inventory/ItemStack.h
|
||||
server/LocalServerInstance.cpp
|
||||
server/LocalServerInstance.h
|
||||
game/hud/SerialGui.h
|
||||
util/Voronoi3D.cpp
|
||||
util/Voronoi3D.h
|
||||
def/gen/BiomeDef.cpp
|
||||
def/gen/BiomeDef.h
|
||||
def/gen/BiomeAtlas.cpp
|
||||
def/gen/BiomeAtlas.h
|
||||
def/gen/ServerBiomeAtlas.cpp
|
||||
def/gen/ServerBiomeAtlas.h
|
||||
def/gen/LocalBiomeAtlas.cpp
|
||||
def/gen/LocalBiomeAtlas.h
|
||||
world/Dimension.cpp
|
||||
world/Dimension.h
|
||||
def/texture/RawTexData.h
|
||||
game/hud/components/compound/GuiImageButton.cpp
|
||||
game/hud/components/compound/GuiImageButton.h
|
||||
game/ClientState.cpp
|
||||
game/scene/menu/Subgame.cpp
|
||||
game/scene/menu/Subgame.h
|
||||
game/scene/menu/SubgameConfig.h
|
||||
game/scene/menu/MenuSandbox.cpp
|
||||
game/scene/menu/MenuSandbox.h
|
||||
lua/api/menu/mDelay.h
|
||||
lua/api/menu/mSetGui.h
|
||||
game/hud/GuiBuilder.cpp
|
||||
game/hud/GuiBuilder.h
|
||||
game/hud/GameGuiBuilder.cpp
|
||||
game/hud/GameGuiBuilder.h
|
||||
lua/api/menu/mStartGame.h
|
||||
lua/api/class/ServerLuaInventoryList.cpp
|
||||
lua/api/class/ServerLuaInventoryList.h
|
||||
lua/api/class/ServerLuaInventory.cpp
|
||||
lua/api/class/ServerLuaInventory.h
|
||||
game/inventory/Inventory.cpp
|
||||
game/inventory/Inventory.h
|
||||
lua/api/class/LuaItemStack.cpp
|
||||
lua/api/class/LuaItemStack.h
|
||||
game/inventory/ItemStack.cpp
|
||||
lua/api/usertype/cInventoryRef.h
|
||||
lua/api/usertype/cItemStack.h
|
||||
game/hud/components/basic/GuiModel.cpp
|
||||
game/hud/components/basic/GuiModel.h
|
||||
server/world/ServerEntity.cpp
|
||||
server/world/ServerEntity.h
|
||||
lua/api/class/ServerLuaEntity.cpp
|
||||
lua/api/class/ServerLuaEntity.h
|
||||
game/scene/LuaErrorScene.cpp
|
||||
game/scene/LuaErrorScene.h
|
||||
lua/api/usertype/sLuaEntity.h
|
||||
util/net/Serializer.h
|
||||
util/net/Deserializer.h
|
||||
lua/api/class/ServerLocalLuaEntity.cpp
|
||||
lua/api/class/ServerLocalLuaEntity.h
|
||||
lua/api/modules/register_item.h
|
||||
lua/api/modules/register_biome.h
|
||||
lua/api/modules/delay.h
|
||||
lua/api/modules/register_block.h
|
||||
lua/api/modules/register_blockmodel.h
|
||||
lua/api/modules/register_entity.h
|
||||
game/scene/world/World.cpp
|
||||
game/scene/world/World.h
|
||||
lua/api/modules/set_block.h
|
||||
lua/api/modules/get_block.h
|
||||
lua/api/modules/remove_block.h
|
||||
lua/register/RegisterBiomes.h
|
||||
lua/register/RegisterBlocks.h
|
||||
lua/register/RegisterItems.h
|
||||
lua/register/RegisterKeybinds.h
|
||||
lua/api/class/LocalLuaAnimationManager.cpp
|
||||
lua/api/class/LocalLuaAnimationManager.h
|
||||
lua/api/usertype/cAnimationManager.h
|
||||
game/scene/world/Schematic.cpp
|
||||
game/scene/world/Schematic.h
|
||||
lua/VenusParser.cpp
|
||||
lua/VenusParser.h
|
||||
lua/ErrorFormatter.cpp
|
||||
lua/ErrorFormatter.h
|
||||
util/RIE.h
|
||||
lua/api/class/ServerLuaPlayer.cpp
|
||||
lua/api/class/ServerLuaPlayer.h
|
||||
lua/api/usertype/sServerPlayer.h
|
||||
lua/api/modules/register_on.h
|
||||
lua/api/functions/trigger_event.h
|
||||
lua/parser/ServerModHandler.cpp
|
||||
lua/parser/ServerModHandler.h
|
||||
lua/parser/LocalModHandler.cpp
|
||||
lua/parser/LocalModHandler.h
|
||||
game/scene/net/NetPlayerField.h
|
||||
game/inventory/LocalInventoryRefs.cpp
|
||||
game/inventory/LocalInventoryRefs.h
|
||||
game/inventory/LocalInventory.cpp
|
||||
game/inventory/LocalInventory.h
|
||||
lua/api/class/LocalLuaInventory.cpp
|
||||
lua/api/class/LocalLuaInventory.h
|
||||
lua/api/class/LocalLuaInventoryList.cpp
|
||||
lua/api/class/LocalLuaInventoryList.h
|
||||
game/inventory/InventoryRefs.cpp
|
||||
game/inventory/InventoryRefs.h
|
||||
game/inventory/InventoryList.cpp
|
||||
game/inventory/InventoryList.h
|
||||
lua/api/modules/time.h
|
||||
util/net/PacketView.cpp
|
||||
util/net/PacketView.h)
|
||||
|
||||
add_library (Zepha_Core ${ZEPHA_SRC})
|
|
@ -4,14 +4,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <glm/vec3.hpp>
|
||||
#include <vector>
|
||||
#include <noise/noise.h>
|
||||
|
||||
#include "MapGenJob.h"
|
||||
#include "BiomeAtlas.h"
|
||||
#include "../ClientGame.h"
|
||||
#include "../../util/Vec.h"
|
||||
#include "../../world/chunk/BlockChunk.h"
|
||||
|
||||
using namespace noise;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "LocalInventoryRefs.h"
|
||||
|
||||
#include "../scene/net/ClientNetworkInterpreter.h"
|
||||
#include "../../util/net/PacketView.h"
|
||||
|
||||
LocalInventoryRefs::LocalInventoryRefs(LocalDefinitionAtlas& defs, ClientNetworkInterpreter& net) : defs(defs) {
|
||||
namespace ph = std::placeholders;
|
||||
|
@ -43,25 +44,23 @@ std::shared_ptr<LocalInventoryList> LocalInventoryRefs::getHand() {
|
|||
return inventories["current_player"]->operator[]("hand");
|
||||
}
|
||||
|
||||
void LocalInventoryRefs::packetReceived(std::unique_ptr<Packet> p) {
|
||||
Deserializer d(p->data);
|
||||
|
||||
std::string source = d.read<std::string>();
|
||||
std::string list = d.read<std::string>();
|
||||
void LocalInventoryRefs::packetReceived(std::unique_ptr<PacketView> p) {
|
||||
std::string source = p->d.read<std::string>();
|
||||
std::string list = p->d.read<std::string>();
|
||||
if (strncmp(source.data(), "player:", 7) == 0) source = "current_player";
|
||||
|
||||
if (!inventories.count(source)) return;
|
||||
if (!inventories[source]->operator[](list)) return;
|
||||
|
||||
unsigned int size = d.read<unsigned int>();
|
||||
unsigned int width = d.read<unsigned int>();
|
||||
unsigned int size = p->d.read<unsigned int>();
|
||||
unsigned int width = p->d.read<unsigned int>();
|
||||
|
||||
std::vector<ItemStack> stacks {};
|
||||
stacks.reserve(size);
|
||||
|
||||
while (!d.atEnd()) {
|
||||
unsigned short count = d.read<unsigned short>();
|
||||
unsigned int id = d.read<unsigned int>();
|
||||
while (!p->d.atEnd()) {
|
||||
unsigned short count = p->d.read<unsigned short>();
|
||||
unsigned int id = p->d.read<unsigned int>();
|
||||
stacks.push_back({id, count});
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
LocalInventoryRefs(LocalDefinitionAtlas& defs, ClientNetworkInterpreter& net);
|
||||
|
||||
void update(double delta, ClientNetworkInterpreter& net);
|
||||
void packetReceived(std::unique_ptr<Packet> p);
|
||||
void packetReceived(std::unique_ptr<PacketView> p);
|
||||
|
||||
std::shared_ptr<LocalInventory> getInv(const std::string& inv);
|
||||
std::shared_ptr<LocalInventoryList> getList(const std::string& inv, const std::string& list);
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
//
|
||||
|
||||
#include <gzip/decompress.hpp>
|
||||
|
||||
#include "ConnectScene.h"
|
||||
|
||||
#include "../../server/asset/AssetType.h"
|
||||
#include "../hud/components/basic/GuiText.h"
|
||||
#include "../hud/components/basic/GuiRect.h"
|
||||
|
||||
ConnectScene::ConnectScene(ClientState &state, Address addr) : Scene(state),
|
||||
connection(state.connection) {
|
||||
|
@ -52,14 +56,13 @@ void ConnectScene::update() {
|
|||
|
||||
ENetEvent e;
|
||||
if (connection.pollEvents(&e) && e.type == ENET_EVENT_TYPE_RECEIVE) {
|
||||
Packet p(e.packet);
|
||||
Deserializer d(p.data);
|
||||
PacketView p(e.packet);
|
||||
|
||||
if (p.type == PacketType::BLOCK_IDENTIFIER_LIST) {
|
||||
auto statusText = components.get<GuiText>("statusText");
|
||||
statusText->setText(statusText->getText() + "Received block index-identifier table.\n");
|
||||
|
||||
state.defs.defs.setIdentifiers(d.read<std::vector<std::string>>());
|
||||
state.defs.defs.setIdentifiers(p.d.read<std::vector<std::string>>());
|
||||
|
||||
Packet resp(PacketType::BIOME_IDENTIFIER_LIST);
|
||||
resp.sendTo(connection.getPeer(), PacketChannel::CONNECT);
|
||||
|
@ -68,7 +71,7 @@ void ConnectScene::update() {
|
|||
auto statusText = components.get<GuiText>("statusText");
|
||||
statusText->setText(statusText->getText() + "Received biome index-identifier table.\nDownloading mods...\n");
|
||||
|
||||
state.defs.biomes.setIdentifiers(d.read<std::vector<std::string>>());
|
||||
state.defs.biomes.setIdentifiers(p.d.read<std::vector<std::string>>());
|
||||
|
||||
connectState = State::MODS;
|
||||
Packet resp(PacketType::MODS);
|
||||
|
@ -82,8 +85,7 @@ void ConnectScene::update() {
|
|||
components.get<GuiRect>("loadBar")->setScale({state.renderer.window.getSize().x * 0.4, 32});
|
||||
ENetEvent e;
|
||||
if (connection.pollEvents(&e) && e.type == ENET_EVENT_TYPE_RECEIVE) {
|
||||
Packet p(e.packet);
|
||||
Deserializer d(p.data);
|
||||
PacketView p(e.packet);
|
||||
|
||||
auto statusText = components.get<GuiText>("statusText");
|
||||
|
||||
|
@ -93,7 +95,7 @@ void ConnectScene::update() {
|
|||
state.defs.parser.getHandler().addLuaMod(std::move(luaMod));
|
||||
}
|
||||
else if (p.type == PacketType::MOD_ORDER) {
|
||||
state.defs.parser.getHandler().setModsOrder(d.read<std::vector<std::string>>());
|
||||
state.defs.parser.getHandler().setModsOrder(p.d.read<std::vector<std::string>>());
|
||||
|
||||
statusText->setText(statusText->getText() + "Done downloading mods.\nReceived the mods order.\nDownloading media...\n");
|
||||
|
||||
|
@ -110,23 +112,22 @@ void ConnectScene::update() {
|
|||
|
||||
ENetEvent e;
|
||||
if (connection.pollEvents(&e) && e.type == ENET_EVENT_TYPE_RECEIVE) {
|
||||
Packet p(e.packet);
|
||||
Deserializer d(p.data);
|
||||
PacketView p(e.packet);
|
||||
|
||||
auto statusText = components.get<GuiText>("statusText");
|
||||
|
||||
if (p.type == PacketType::MEDIA) {
|
||||
AssetType t = static_cast<AssetType>(d.read<int>());
|
||||
AssetType t = static_cast<AssetType>(p.d.read<int>());
|
||||
unsigned int count = 0;
|
||||
|
||||
while (t != AssetType::END) {
|
||||
std::string assetName = d.read<std::string>();
|
||||
std::string assetName = p.d.read<std::string>();
|
||||
|
||||
if (t == AssetType::TEXTURE) {
|
||||
int width = d.read<unsigned int>();
|
||||
int height = d.read<unsigned int>();
|
||||
int width = p.d.read<unsigned int>();
|
||||
int height = p.d.read<unsigned int>();
|
||||
|
||||
std::string data = d.read<std::string>();
|
||||
std::string data = p.d.read<std::string>();
|
||||
std::string uncompressed = gzip::decompress(data.data(), data.length());
|
||||
|
||||
state.defs.textures.addImage(
|
||||
|
@ -134,13 +135,13 @@ void ConnectScene::update() {
|
|||
assetName, true, width, height);
|
||||
}
|
||||
else if (t == AssetType::MODEL) {
|
||||
std::string format = d.read<std::string>();
|
||||
std::string data = d.read<std::string>();
|
||||
std::string format = p.d.read<std::string>();
|
||||
std::string data = p.d.read<std::string>();
|
||||
|
||||
state.defs.models.models.insert({assetName, SerializedModel{assetName, data, format}});
|
||||
}
|
||||
|
||||
t = static_cast<AssetType>(d.read<int>());
|
||||
t = static_cast<AssetType>(p.d.read<int>());
|
||||
count++;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,16 +4,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include "net/ServerConnection.h"
|
||||
#include "../graph/scene/Scene.h"
|
||||
#include "../hud/components/basic/GuiText.h"
|
||||
#include "../hud/components/basic/GuiContainer.h"
|
||||
#include "../hud/components/basic/GuiRect.h"
|
||||
#include "../../lua/LuaModFile.h"
|
||||
#include "../../lua/LuaMod.h"
|
||||
#include "../../server/asset/AssetType.h"
|
||||
#include "../../util/net/Deserializer.h"
|
||||
|
||||
class ConnectScene : public Scene {
|
||||
public:
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "NetPlayerField.h"
|
||||
#include "../world/Player.h"
|
||||
#include "../../../util/net/NetHandler.h"
|
||||
#include "../../../util/net/PacketView.h"
|
||||
#include "../../../util/net/Serializer.h"
|
||||
|
||||
ClientNetworkInterpreter::ClientNetworkInterpreter(ServerConnection &connection, ClientGame &defs, Player& player) :
|
||||
player(player),
|
||||
|
@ -15,7 +17,7 @@ ClientNetworkInterpreter::ClientNetworkInterpreter(ServerConnection &connection,
|
|||
playerModel->fromSerialized(defs.models.models["zeus:default:player"], {defs.textures["zeus:default:player"]});
|
||||
}
|
||||
|
||||
void ClientNetworkInterpreter::init(LocalWorld *world, std::function<void(std::unique_ptr<Packet>)> invCallback) {
|
||||
void ClientNetworkInterpreter::init(LocalWorld *world, std::function<void(std::unique_ptr<PacketView>)> invCallback) {
|
||||
this->world = world;
|
||||
this->onInvPacket = invCallback;
|
||||
}
|
||||
|
@ -36,9 +38,8 @@ void ClientNetworkInterpreter::update() {
|
|||
break;
|
||||
}
|
||||
case ENET_EVENT_TYPE_RECEIVE: {
|
||||
std::unique_ptr<Packet> p = std::make_unique<Packet>(event.packet);
|
||||
std::unique_ptr<PacketView> p = std::make_unique<PacketView>(event.packet);
|
||||
receivedPacket(std::move(p));
|
||||
enet_packet_destroy(event.packet);
|
||||
break;
|
||||
}
|
||||
case ENET_EVENT_TYPE_DISCONNECT: {
|
||||
|
@ -60,9 +61,7 @@ void ClientNetworkInterpreter::update() {
|
|||
p.sendTo(connection.getPeer(), PacketChannel::PLAYER);
|
||||
}
|
||||
|
||||
void ClientNetworkInterpreter::receivedPacket(std::unique_ptr<Packet> p) {
|
||||
Deserializer d(p->data);
|
||||
|
||||
void ClientNetworkInterpreter::receivedPacket(std::unique_ptr<PacketView> p) {
|
||||
switch (p->type) {
|
||||
default: {
|
||||
std::cout << Log::err << "Received unknown packet of type " << static_cast<int>(p->type)
|
||||
|
@ -71,22 +70,22 @@ void ClientNetworkInterpreter::receivedPacket(std::unique_ptr<Packet> p) {
|
|||
}
|
||||
|
||||
case PacketType::THIS_PLAYER_INFO: {
|
||||
while (!d.atEnd()) {
|
||||
switch (d.read<unsigned int>()) {
|
||||
while (!p->d.atEnd()) {
|
||||
switch (p->d.read<unsigned int>()) {
|
||||
case static_cast<unsigned int>(NetPlayerField::ID): {
|
||||
cid = d.read<unsigned int>();
|
||||
cid = p->d.read<unsigned int>();
|
||||
break;
|
||||
}
|
||||
case static_cast<unsigned int>(NetPlayerField::POSITION): {
|
||||
player.setPos(d.read<glm::vec3>());
|
||||
player.setPos(p->d.read<glm::vec3>());
|
||||
break;
|
||||
}
|
||||
case static_cast<unsigned int>(NetPlayerField::PITCH): {
|
||||
player.setPitch(d.read<float>());
|
||||
player.setPitch(p->d.read<float>());
|
||||
break;
|
||||
}
|
||||
case static_cast<unsigned int>(NetPlayerField::YAW): {
|
||||
player.setYaw(d.read<float>());
|
||||
player.setYaw(p->d.read<float>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -94,16 +93,16 @@ void ClientNetworkInterpreter::receivedPacket(std::unique_ptr<Packet> p) {
|
|||
break;
|
||||
}
|
||||
case PacketType::PLAYER_INFO: {
|
||||
unsigned int cid = d.read<unsigned int>();
|
||||
unsigned int cid = p->d.read<unsigned int>();
|
||||
if (this->cid == cid) break;
|
||||
|
||||
bool found = false;
|
||||
for (auto& entity : world->dimension.playerEntities) {
|
||||
if (entity.getCid() == cid) {
|
||||
// Update an existing PlayerEntity
|
||||
entity.interpPos(d.read<glm::vec3>());
|
||||
entity.interpRotateZ(-d.read<float>() + 90);
|
||||
entity.interpRotateY(-d.read<float>() + 90);
|
||||
entity.interpPos(p->d.read<glm::vec3>());
|
||||
entity.interpRotateZ(-p->d.read<float>() + 90);
|
||||
entity.interpRotateY(-p->d.read<float>() + 90);
|
||||
|
||||
found = true;
|
||||
break;
|
||||
|
@ -112,7 +111,7 @@ void ClientNetworkInterpreter::receivedPacket(std::unique_ptr<Packet> p) {
|
|||
if (found) break;
|
||||
|
||||
// Instantiate a new PlayerEntity
|
||||
world->dimension.playerEntities.emplace_back(d.read<glm::vec3>(), cid, playerModel);
|
||||
world->dimension.playerEntities.emplace_back(p->d.read<glm::vec3>(), cid, playerModel);
|
||||
break;
|
||||
}
|
||||
case PacketType::ENTITY_INFO: {
|
||||
|
@ -120,12 +119,12 @@ void ClientNetworkInterpreter::receivedPacket(std::unique_ptr<Packet> p) {
|
|||
break;
|
||||
}
|
||||
case PacketType::ENTITY_REMOVED: {
|
||||
world->dimension.serverEntityRemoved(d.read<unsigned int>());
|
||||
world->dimension.serverEntityRemoved(p->d.read<unsigned int>());
|
||||
break;
|
||||
}
|
||||
case PacketType::BLOCK_SET: {
|
||||
auto pos = d.read<glm::ivec3>();
|
||||
auto block = d.read<unsigned int>();
|
||||
auto pos = p->d.read<glm::ivec3>();
|
||||
auto block = p->d.read<unsigned int>();
|
||||
world->setBlock(pos, block);
|
||||
break;
|
||||
}
|
||||
|
@ -134,12 +133,12 @@ void ClientNetworkInterpreter::receivedPacket(std::unique_ptr<Packet> p) {
|
|||
break;
|
||||
}
|
||||
case PacketType::SERVER_INFO: {
|
||||
serverSideChunkGens = d.read<unsigned int>();
|
||||
serverSideChunkGens = p->d.read<unsigned int>();
|
||||
break;
|
||||
}
|
||||
case PacketType::INV_INVALID: {
|
||||
std::string source = d.read<std::string>();
|
||||
std::string list = d.read<std::string>();
|
||||
std::string source = p->d.read<std::string>();
|
||||
std::string list = p->d.read<std::string>();
|
||||
|
||||
std::cout << Log::err << "Invalid inventory " << source << ":" << list << " was requested by client." << Log::endl;
|
||||
exit(1);
|
||||
|
|
|
@ -12,7 +12,7 @@ public:
|
|||
ClientNetworkInterpreter(ServerConnection& connection, ClientGame& defs, Player& player);
|
||||
ClientNetworkInterpreter(const ClientNetworkInterpreter& other) = default;
|
||||
|
||||
void init(LocalWorld* world, std::function<void(std::unique_ptr<Packet>)> invCallback);
|
||||
void init(LocalWorld* world, std::function<void(std::unique_ptr<PacketView>)> invCallback);
|
||||
void update();
|
||||
|
||||
// Functions to be called by outside of ClientNetworkInterpreter
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
int recvPackets = 0;
|
||||
int serverSideChunkGens = 0;
|
||||
private:
|
||||
void receivedPacket(std::unique_ptr<Packet> ePacket);
|
||||
void receivedPacket(std::unique_ptr<PacketView> ePacket);
|
||||
|
||||
int cid = 0;
|
||||
Player& player;
|
||||
|
@ -35,6 +35,6 @@ private:
|
|||
LocalWorld* world = nullptr;
|
||||
std::shared_ptr<Model> playerModel;
|
||||
|
||||
std::function<void(std::unique_ptr<Packet>)> onInvPacket;
|
||||
std::function<void(std::unique_ptr<PacketView>)> onInvPacket;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
|
||||
#include "Player.h"
|
||||
#include "WorldInterpolationStream.h"
|
||||
#include "../net/ClientNetworkInterpreter.h"
|
||||
#include "../../entity/engine/BlockCrackEntity.h"
|
||||
#include "../../entity/engine/ParticleEntity.h"
|
||||
#include "../../entity/engine/BlockCrackEntity.h"
|
||||
|
||||
LocalWorld::LocalWorld(ClientGame& defs, ClientNetworkInterpreter* server) :
|
||||
defs(defs),
|
||||
|
@ -38,7 +37,7 @@ void LocalWorld::update(double delta) {
|
|||
if (end != particles.begin()) particles.erase(particles.begin(), end + 1);
|
||||
}
|
||||
|
||||
void LocalWorld::loadChunkPacket(std::unique_ptr<Packet> p) {
|
||||
void LocalWorld::loadChunkPacket(std::unique_ptr<PacketView> p) {
|
||||
worldGenStream->pushBack(std::move(p));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void init(Player* player);
|
||||
void update(double delta) override;
|
||||
|
||||
void loadChunkPacket(std::unique_ptr<Packet> p);
|
||||
void loadChunkPacket(std::unique_ptr<PacketView> p);
|
||||
void commitChunk(std::shared_ptr<BlockChunk> chunk);
|
||||
|
||||
unsigned int getBlock(glm::ivec3 pos) override;
|
||||
|
|
|
@ -15,7 +15,7 @@ WorldInterpolationStream::WorldInterpolationStream(unsigned int seed, ClientGame
|
|||
}
|
||||
}
|
||||
|
||||
bool WorldInterpolationStream::pushBack(std::unique_ptr<Packet> p) {
|
||||
bool WorldInterpolationStream::pushBack(std::unique_ptr<PacketView> p) {
|
||||
queuedTasks.push_back(std::move(p));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,30 +4,28 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <glm/vec3.hpp>
|
||||
#include <thread>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "../../../def/ClientGame.h"
|
||||
#include "../../../world/chunk/BlockChunk.h"
|
||||
#include "../../../def/gen/MapGen.h"
|
||||
|
||||
class WorldInterpolationStream {
|
||||
public:
|
||||
static const int THREAD_QUEUE_SIZE = 128;
|
||||
static const int THREADS = 2;
|
||||
|
||||
WorldInterpolationStream(unsigned int seed, ClientGame& defs);
|
||||
WorldInterpolationStream(unsigned int seed, ClientGame& defs);
|
||||
~WorldInterpolationStream();
|
||||
|
||||
//Add `p` to the pre-thread queue.
|
||||
bool pushBack(std::unique_ptr<Packet> p);
|
||||
bool pushBack(std::unique_ptr<PacketView> p);
|
||||
|
||||
//Will return a vector of BlockChunk pointers containing finished chunks.
|
||||
//Frees up the threads and starts new tasks.
|
||||
std::vector<std::shared_ptr<BlockChunk>> update();
|
||||
|
||||
struct Unit {
|
||||
std::unique_ptr<Packet> packet;
|
||||
std::unique_ptr<PacketView> packet;
|
||||
BlockChunk* chunk = nullptr;
|
||||
|
||||
bool unlocked = true;
|
||||
|
@ -50,6 +48,6 @@ private:
|
|||
static void threadFunction(Thread* thread);
|
||||
|
||||
// MapGen gen;
|
||||
std::vector<std::unique_ptr<Packet>> queuedTasks;
|
||||
std::vector<std::unique_ptr<PacketView>> queuedTasks;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,10 +4,13 @@
|
|||
|
||||
#include <vector>
|
||||
#include <glm/gtx/normal.hpp>
|
||||
|
||||
#include "MeshGenerator.h"
|
||||
|
||||
#include "../MeshDetails.h"
|
||||
#include "../../../../util/Vec.h"
|
||||
#include "../../../../util/Timer.h"
|
||||
#include "../../../../world/chunk/BlockChunk.h"
|
||||
#include "MeshGenerator.h"
|
||||
|
||||
MeshGenerator::MeshGenerator(MeshDetails* meshDetails, ClientGame& defs, std::shared_ptr<BlockChunk> chunk,
|
||||
std::array<std::shared_ptr<BlockChunk>, 6> adjacent,
|
||||
|
|
|
@ -2,14 +2,16 @@
|
|||
// Created by aurailus on 05/08/19.
|
||||
//
|
||||
|
||||
#include "LuaMod.h"
|
||||
#include "../util/net/Deserializer.h"
|
||||
#include <gzip/decompress.hpp>
|
||||
|
||||
LuaMod LuaMod::fromPacket(const Packet& p) {
|
||||
#include "LuaMod.h"
|
||||
|
||||
#include "../util/net/PacketView.h"
|
||||
|
||||
LuaMod LuaMod::fromPacket(PacketView& p) {
|
||||
LuaMod luaMod {};
|
||||
|
||||
auto serialized = Deserializer(p.data).read<std::string>();
|
||||
auto serialized = p.d.read<std::string>();
|
||||
std::string mod = gzip::decompress(serialized.c_str(), serialized.length());
|
||||
luaMod.serialized = serialized;
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "LuaModFile.h"
|
||||
#include "LuaModConfig.h"
|
||||
#include "../util/net/Packet.h"
|
||||
|
||||
class PacketView;
|
||||
|
||||
class LuaMod {
|
||||
public:
|
||||
|
@ -16,5 +18,5 @@ public:
|
|||
std::string modPath;
|
||||
std::string serialized;
|
||||
|
||||
static LuaMod fromPacket(const Packet& p);
|
||||
static LuaMod fromPacket(PacketView& p);
|
||||
};
|
||||
|
|
|
@ -131,7 +131,7 @@ void ServerLuaParser::loadApi(ServerGame &defs, ServerWorld &world) {
|
|||
Api::time(lua, core);
|
||||
|
||||
// Functions
|
||||
Api::trigger_event (lua);
|
||||
Api::trigger_event (lua);
|
||||
Api::update_entities(lua);
|
||||
|
||||
// Create sandboxed runfile()
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "../util/Timer.h"
|
||||
#include "../lua/api/class/ServerLuaPlayer.h"
|
||||
#include "../util/net/PacketView.h"
|
||||
|
||||
Server::Server(unsigned short port, const std::string& subgame) :
|
||||
port(port),
|
||||
|
@ -27,7 +28,7 @@ Server::Server(unsigned short port, const std::string& subgame) :
|
|||
}
|
||||
|
||||
void Server::update() {
|
||||
const static long interval_ns = static_cast<long>((1000 / 20.f) * 1000000L);
|
||||
const static long interval_ns = static_cast<long>((1000 / 60.f) * 1000000L);
|
||||
Timer loop("");
|
||||
|
||||
world.update(0);
|
||||
|
@ -51,7 +52,7 @@ void Server::update() {
|
|||
break;
|
||||
}
|
||||
case ENET_EVENT_TYPE_RECEIVE: {
|
||||
Packet p(event.packet);
|
||||
PacketView p(event.packet);
|
||||
ServerClient* client = static_cast<ServerClient*>(event.peer->data);
|
||||
|
||||
if (client->hasPlayer) {
|
||||
|
@ -74,8 +75,6 @@ void Server::update() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
enet_packet_destroy(event.packet);
|
||||
}
|
||||
|
||||
for (auto& cid : playersUpdated) {
|
||||
|
@ -103,26 +102,23 @@ void Server::update() {
|
|||
elapsedSeconds += deltaTime;
|
||||
}
|
||||
|
||||
void Server::handlePlayerPacket(ServerClient &client, Packet& p) {
|
||||
void Server::handlePlayerPacket(ServerClient& client, PacketView& p) {
|
||||
switch (p.type) {
|
||||
default: {
|
||||
std::cout << Log::err << "Invalid packet type (" << static_cast<int>(p.type) << ") recieved." << Log::endl;
|
||||
break;
|
||||
}
|
||||
case PacketType::PLAYER_INFO: {
|
||||
Deserializer d(p.data);
|
||||
client.setPos(d.read<glm::vec3>());
|
||||
client.setPitch(d.read<float>());
|
||||
client.setYaw(d.read<float>());
|
||||
client.setPos(p.d.read<glm::vec3>());
|
||||
client.setPitch(p.d.read<float>());
|
||||
client.setYaw(p.d.read<float>());
|
||||
|
||||
playersUpdated.emplace(client.cid);
|
||||
break;
|
||||
}
|
||||
case PacketType::BLOCK_SET: {
|
||||
Deserializer d(p.data);
|
||||
|
||||
glm::ivec3 pos = d.read<glm::ivec3>();
|
||||
unsigned int block = d.read<unsigned int>();
|
||||
glm::ivec3 pos = p.d.read<glm::ivec3>();
|
||||
unsigned int block = p.d.read<unsigned int>();
|
||||
|
||||
unsigned int worldBlock = (block == DefinitionAtlas::AIR ? world.getBlock(pos) : 0);
|
||||
|
||||
|
@ -152,10 +148,8 @@ void Server::handlePlayerPacket(ServerClient &client, Packet& p) {
|
|||
break;
|
||||
}
|
||||
case PacketType::INV_WATCH: {
|
||||
Deserializer d(p.data);
|
||||
|
||||
std::string source = d.read<std::string>();
|
||||
std::string list = d.read<std::string>();
|
||||
std::string source = p.d.read<std::string>();
|
||||
std::string list = p.d.read<std::string>();
|
||||
|
||||
// TODO: When inventory saving / loading is implemented there will need to be a cross-save identifier.
|
||||
if (source == "current_player") source = "player:" + std::to_string(client.cid);
|
||||
|
@ -170,7 +164,7 @@ void Server::handlePlayerPacket(ServerClient &client, Packet& p) {
|
|||
break;
|
||||
}
|
||||
case PacketType::INV_UNWATCH: {
|
||||
Deserializer d(p.data);
|
||||
Deserializer d(p.d.data);
|
||||
|
||||
std::string source = d.read<std::string>();
|
||||
std::string list = d.read<std::string>();
|
||||
|
@ -188,7 +182,7 @@ void Server::handlePlayerPacket(ServerClient &client, Packet& p) {
|
|||
break;
|
||||
}
|
||||
case PacketType::INV_INTERACT: {
|
||||
Deserializer d(p.data);
|
||||
Deserializer d(p.d.data);
|
||||
|
||||
unsigned short type = d.read<unsigned short>();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
explicit Server(unsigned short port, const std::string& subgame);
|
||||
|
||||
void update();
|
||||
void handlePlayerPacket(ServerClient& client, Packet& p);
|
||||
void handlePlayerPacket(ServerClient& client, PacketView& p);
|
||||
|
||||
void cleanup();
|
||||
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#include "ServerConfig.h"
|
||||
|
||||
#include "../asset/AssetType.h"
|
||||
#include "../../util/net/PacketView.h"
|
||||
#include "../../util/net/Serializer.h"
|
||||
|
||||
ServerConfig::ServerConfig(ServerGame &defs) : defs(defs) {}
|
||||
|
||||
void ServerConfig::init() {
|
||||
|
@ -18,7 +22,7 @@ void ServerConfig::init() {
|
|||
}
|
||||
}
|
||||
|
||||
bool ServerConfig::handlePacket(ServerClient& client, Packet& r) {
|
||||
bool ServerConfig::handlePacket(ServerClient& client, PacketView& r) {
|
||||
switch (r.type) {
|
||||
default: break;
|
||||
case PacketType::CONNECT_DATA_RECVD: {
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../conn/ServerClient.h"
|
||||
#include "../asset/AssetType.h"
|
||||
#include "../../def/ServerGame.h"
|
||||
#include "../../util/net/Packet.h"
|
||||
#include "../../util/net/Serializer.h"
|
||||
|
||||
class ServerClient;
|
||||
|
||||
class ServerConfig {
|
||||
public:
|
||||
|
@ -17,7 +15,7 @@ public:
|
|||
void init();
|
||||
|
||||
//Bool: Create player
|
||||
bool handlePacket(ServerClient &client, Packet& p);
|
||||
bool handlePacket(ServerClient &client, PacketView& p);
|
||||
private:
|
||||
ServerGame& defs;
|
||||
std::vector<std::string> blockIdentifierList {};
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
|
||||
class Deserializer {
|
||||
public:
|
||||
Deserializer(const std::string& data) : data(data) {};
|
||||
Deserializer(const std::string& data) : data(&data[0]), len(data.length()) {};
|
||||
Deserializer(const char* start, size_t len) : data(start), len(len) {};
|
||||
|
||||
template <typename T> inline T read() {};
|
||||
template <typename T> inline Deserializer& read(T& ref) {
|
||||
|
@ -20,10 +21,11 @@ public:
|
|||
};
|
||||
|
||||
bool atEnd() {
|
||||
return ind >= data.length();
|
||||
return ind >= len;
|
||||
};
|
||||
|
||||
const std::string& data;
|
||||
const char* data;
|
||||
size_t len;
|
||||
size_t ind = 0;
|
||||
|
||||
private:
|
||||
|
@ -84,7 +86,7 @@ template <> inline std::string Deserializer::read<std::string>() {
|
|||
unsigned int len = read<unsigned int>();
|
||||
size_t i = ind;
|
||||
ind += len;
|
||||
return data.substr(i, len);
|
||||
return std::string(&data[i], len);
|
||||
}
|
||||
|
||||
template <> inline glm::vec2 Deserializer::read<glm::vec2>() {
|
||||
|
|
|
@ -9,13 +9,6 @@
|
|||
|
||||
Packet::Packet(PacketType type, bool reliable) : type(type), reliable(reliable) {}
|
||||
|
||||
Packet::Packet(ENetPacket *packet) : reliable(true) {
|
||||
std::string packetData(packet->data, packet->data + packet->dataLength);
|
||||
this->type = static_cast<PacketType>(Deserializer(packetData).read<unsigned int>());
|
||||
|
||||
this->data = packetData.substr(4, packetData.length() - 4);
|
||||
}
|
||||
|
||||
ENetPacket* Packet::toENetPacket() {
|
||||
std::string serialized = Serializer().append(static_cast<unsigned int>(type)).data + data;
|
||||
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <enet/enet.h>
|
||||
|
||||
#include "PacketType.h"
|
||||
|
@ -18,7 +16,6 @@ class Packet {
|
|||
public:
|
||||
Packet() = default;
|
||||
explicit Packet(PacketType type, bool reliable = true);
|
||||
explicit Packet(ENetPacket* packet);
|
||||
|
||||
ENetPacket* toENetPacket();
|
||||
void sendTo(ENetPeer* peer, PacketChannel channel);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
//
|
||||
// Created by aurailus on 2020-03-07.
|
||||
//
|
||||
|
||||
#include "PacketView.h"
|
||||
|
||||
PacketView::PacketView(ENetPacket *packet) :
|
||||
packet(packet, [](ENetPacket* p) { enet_packet_destroy(p); }),
|
||||
d(reinterpret_cast<char*>(this->packet->data), this->packet->dataLength),
|
||||
type(static_cast<PacketType>(d.read<unsigned int>())) {}
|
|
@ -0,0 +1,21 @@
|
|||
//
|
||||
// Created by aurailus on 2020-03-07.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <enet/enet.h>
|
||||
|
||||
#include "PacketType.h"
|
||||
#include "Deserializer.h"
|
||||
|
||||
class PacketView {
|
||||
public:
|
||||
explicit PacketView(ENetPacket* packet);
|
||||
PacketView(const PacketView&) = delete;
|
||||
|
||||
std::shared_ptr<ENetPacket> packet;
|
||||
Deserializer d;
|
||||
PacketType type;
|
||||
};
|
|
@ -5,8 +5,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <glm/glm.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "../util/Vec.h"
|
||||
#include "region/Region.h"
|
||||
|
||||
class Dimension {
|
||||
|
|
|
@ -158,17 +158,15 @@ void LocalDimension::removeLocalEntity(std::shared_ptr<LocalLuaEntity> &entity)
|
|||
localEntityRefs.erase(entity->id);
|
||||
}
|
||||
|
||||
void LocalDimension::serverEntityInfo(const Packet& p) {
|
||||
Deserializer d(p.data);
|
||||
|
||||
auto id = d.read<unsigned int>();
|
||||
auto position = d.read<glm::vec3>();
|
||||
auto visualOffset = d.read<glm::vec3>();
|
||||
auto rotation = d.read<glm::vec3>();
|
||||
auto scale = d.read<float>();
|
||||
auto displayMode = d.read<std::string>();
|
||||
auto displayArg1 = d.read<std::string>();
|
||||
auto displayArg2 = d.read<std::string>();
|
||||
void LocalDimension::serverEntityInfo(PacketView& p) {
|
||||
auto id = p.d.read<unsigned int>();
|
||||
auto position = p.d.read<glm::vec3>();
|
||||
auto visualOffset = p.d.read<glm::vec3>();
|
||||
auto rotation = p.d.read<glm::vec3>();
|
||||
auto scale = p.d.read<float>();
|
||||
auto displayMode = p.d.read<std::string>();
|
||||
auto displayArg1 = p.d.read<std::string>();
|
||||
auto displayArg2 = p.d.read<std::string>();
|
||||
|
||||
if (serverEntityRefs.count(id)) {
|
||||
auto& luaEntity = *serverEntityRefs.at(id)->get();
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void addLocalEntity(std::shared_ptr<LocalLuaEntity>& entity);
|
||||
void removeLocalEntity(std::shared_ptr<LocalLuaEntity>& entity);
|
||||
|
||||
void serverEntityInfo(const Packet& p);
|
||||
void serverEntityInfo(PacketView& p);
|
||||
void serverEntityRemoved(unsigned int id);
|
||||
|
||||
int renderChunks(Renderer &renderer);
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
// Created by aurailus on 14/12/18.
|
||||
//
|
||||
|
||||
#include "BlockChunk.h"
|
||||
|
||||
#include <gzip/compress.hpp>
|
||||
#include <gzip/decompress.hpp>
|
||||
#include <gzip/utils.hpp>
|
||||
|
||||
#include "BlockChunk.h"
|
||||
|
||||
#include "../../util/net/Serializer.h"
|
||||
#include "../../util/net/PacketView.h"
|
||||
|
||||
BlockChunk::BlockChunk(const std::vector<unsigned int>& blocks, const std::vector<unsigned short>& biomes) :
|
||||
BlockChunk(blocks, biomes, {0, 0, 0}) {}
|
||||
|
||||
|
@ -59,19 +62,18 @@ Packet BlockChunk::serialize() {
|
|||
return s.packet(PacketType::CHUNK);
|
||||
}
|
||||
|
||||
void BlockChunk::deserialize(Packet& packet) {
|
||||
Deserializer d(packet.data);
|
||||
void BlockChunk::deserialize(PacketView& packet) {
|
||||
|
||||
pos = d.read<glm::ivec3>();
|
||||
pos = packet.d.read<glm::ivec3>();
|
||||
|
||||
auto gzip = d.read<std::string>();
|
||||
auto gzip = packet.d.read<std::string>();
|
||||
if (!gzip::is_compressed(gzip.data(), gzip.length())) throw "Invalid Blocks GZip Data.";
|
||||
gzip = gzip::decompress(gzip.data(), gzip.length());
|
||||
|
||||
blocks = Deserializer(gzip).read<std::vector<unsigned int>>();
|
||||
calcNonAirBlocks();
|
||||
|
||||
gzip = d.read<std::string>();
|
||||
gzip = packet.d.read<std::string>();
|
||||
if (!gzip::is_compressed(gzip.data(), gzip.length())) throw "Invalid Biomes GZip Data.";
|
||||
gzip = gzip::decompress(gzip.data(), gzip.length());
|
||||
|
||||
|
|
|
@ -5,17 +5,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <glm/vec3.hpp>
|
||||
#include "../../util/Log.h"
|
||||
#include "../../util/Vec.h"
|
||||
|
||||
#include "../../util/RIE.h"
|
||||
#include "../../util/Util.h"
|
||||
#include "../../util/Space.h"
|
||||
#include "../../util/net/Packet.h"
|
||||
#include "../../def/gen/BiomeAtlas.h"
|
||||
#include "../../def/DefinitionAtlas.h"
|
||||
#include "../../util/net/Serializer.h"
|
||||
#include "../../util/net/Deserializer.h"
|
||||
#include "../../util/net/PacketView.h"
|
||||
|
||||
class BlockChunk {
|
||||
public:
|
||||
|
@ -47,7 +44,7 @@ public:
|
|||
const std::vector<unsigned short>& cGetBiomes() const;
|
||||
|
||||
Packet serialize();
|
||||
void deserialize(Packet& packet);
|
||||
void deserialize(PacketView& packet);
|
||||
|
||||
bool shouldHaveMesh = true;
|
||||
bool dirty = true;
|
||||
|
|
|
@ -4,53 +4,71 @@
|
|||
-- Vector metatable
|
||||
-- A metatable to be assigned to vectors which applies mathematic operators
|
||||
local vector_mt = {
|
||||
__is_vector = true,
|
||||
__is_vector = true,
|
||||
|
||||
__index = function(tbl, key)
|
||||
if key == "x" then return rawget(tbl, 1) end
|
||||
if key == "y" then return rawget(tbl, 2) end
|
||||
if key == "z" then return rawget(tbl, 3) end
|
||||
-- Value manipulation functions
|
||||
__index = function(tbl, key)
|
||||
if key == "x" then return rawget(tbl, 1) end
|
||||
if key == "y" then return rawget(tbl, 2) end
|
||||
if key == "z" then return rawget(tbl, 3) end
|
||||
|
||||
local val = rawget(tbl, key)
|
||||
if val == nil then val = rawget(getmetatable(tbl), key) end
|
||||
return val
|
||||
end,
|
||||
__newindex = function(tbl, key, val)
|
||||
if key == "x" or key == 0 then rawset(tbl, 1, val)
|
||||
elseif key == "y" or key == 1 then rawset(tbl, 2, val)
|
||||
elseif key == "z" or key == 2 then rawset(tbl, 3, val) end
|
||||
end,
|
||||
__tostring = function(tbl)
|
||||
return table.concat({
|
||||
local val = rawget(tbl, key)
|
||||
if val == nil then val = rawget(getmetatable(tbl), key) end
|
||||
return val
|
||||
end,
|
||||
__newindex = function(tbl, key, val)
|
||||
if key == "x" or key == 0 then rawset(tbl, 1, val)
|
||||
elseif key == "y" or key == 1 then rawset(tbl, 2, val)
|
||||
elseif key == "z" or key == 2 then rawset(tbl, 3, val) end
|
||||
end,
|
||||
__tostring = function(tbl)
|
||||
return table.concat({
|
||||
"{ ",
|
||||
tostring(tbl[1]), ", ",
|
||||
tostring(tbl[2]), ", ",
|
||||
tostring(tbl[3]), " }"
|
||||
})
|
||||
end,
|
||||
__eq = function(tbl, o)
|
||||
return vector.equal(tbl, o)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
__eq = function(tbl, o)
|
||||
return vector.equal(tbl, o)
|
||||
end,
|
||||
|
||||
__unm = function(tbl)
|
||||
return vector.negative(tbl)
|
||||
end,
|
||||
__add = function(tbl, o)
|
||||
return vector.add(tbl, o)
|
||||
end,
|
||||
__sub = function(tbl, o)
|
||||
return vector.subtract(tbl, o)
|
||||
end,
|
||||
__mul = function(tbl, o)
|
||||
return vector.multiply(tbl, o)
|
||||
end,
|
||||
__pow = function(tbl, power)
|
||||
local curr = tbl
|
||||
for i = 1, power - 1 do
|
||||
curr = curr * tbl
|
||||
end
|
||||
return curr
|
||||
end,
|
||||
-- Arithmetic functions
|
||||
__unm = function(tbl)
|
||||
return vector.negative(tbl)
|
||||
end,
|
||||
__add = function(tbl, o)
|
||||
return vector.add(tbl, o)
|
||||
end,
|
||||
__sub = function(tbl, o)
|
||||
return vector.subtract(tbl, o)
|
||||
end,
|
||||
__mul = function(tbl, o)
|
||||
return vector.multiply(tbl, o)
|
||||
end,
|
||||
__pow = function(tbl, power)
|
||||
return vector.pow(tbl, o)
|
||||
end,
|
||||
|
||||
-- Higher level methods
|
||||
abs = function(tbl)
|
||||
return vector.abs(tbl)
|
||||
end,
|
||||
round = function(tbl)
|
||||
return vector.round(tbl)
|
||||
end,
|
||||
floor = function(tbl)
|
||||
return vector.floor(tbl)
|
||||
end,
|
||||
ceil = function(tbl)
|
||||
return vector.ceil(tbl)
|
||||
end,
|
||||
distance_squared = function(tbl, o)
|
||||
return vector.distance_squared(tbl, o)
|
||||
end,
|
||||
distance = function(tbl, o)
|
||||
return vector.distance(tbl, o)
|
||||
end
|
||||
}
|
||||
|
||||
-- create_vector
|
||||
|
@ -127,6 +145,15 @@ vector.multiply = function(v1, m)
|
|||
end
|
||||
end
|
||||
|
||||
-- vector.pow
|
||||
-- Return v to the power of p
|
||||
vector.pow = function(v, m)
|
||||
if not check_vector(v) then return end
|
||||
local res = create_vector(rawget(v, 1), rawget(v, 2), rawget(v, 3))
|
||||
for i = 1, power - 1 do res = res * v end
|
||||
return res
|
||||
end
|
||||
|
||||
-- vector.equal
|
||||
-- Return a boolean indicating if v1 == v2
|
||||
vector.equal = function(v1, v2)
|
||||
|
@ -157,7 +184,7 @@ end
|
|||
|
||||
-- vector.ceil
|
||||
-- Ceil each vector value to the highest integer
|
||||
vector.floor = function(v)
|
||||
vector.ceil = function(v)
|
||||
if not check_vector(v) then return end
|
||||
return create_vector(math.ceil(rawget(v, 1)), math.ceil(rawget(v, 2)), math.ceil(rawget(v, 3)))
|
||||
end
|
||||
|
|
|
@ -17,7 +17,14 @@ zepha.register_block("zeus:default:grass", {
|
|||
shovel = 1,
|
||||
pick = 2
|
||||
},
|
||||
yields = "zeus:default:dirt"
|
||||
yields = fn() {
|
||||
if (math.random() >= 0.5) {
|
||||
return "zeus:default:dirt"
|
||||
}
|
||||
else {
|
||||
return "zeus:materials:plant_fibre"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
zepha.register_block("zeus:default:grass_slab", {
|
||||
|
|
|
@ -6,5 +6,12 @@ zepha.register_block("zeus:default:stone", {
|
|||
hand = 14,
|
||||
pick = 3
|
||||
},
|
||||
yields = "zeus:default:cobblestone"
|
||||
yields = fn() {
|
||||
if (math.random() >= 0.5) {
|
||||
return "zeus:default:cobblestone"
|
||||
}
|
||||
else {
|
||||
return "zeus:materials:rock"
|
||||
}
|
||||
}
|
||||
})
|
|
@ -1,4 +1,4 @@
|
|||
local formspec = zepha.create_menu(function()
|
||||
local menu = zepha.create_menu(function()
|
||||
return Gui.Body {
|
||||
background = "#0003",
|
||||
|
||||
|
@ -118,9 +118,9 @@ zepha.register_keybind("zeus:inventory:open_inventory", {
|
|||
default = zepha.keys.e,
|
||||
on_press = function()
|
||||
if (zepha.player.menu_state == "") then
|
||||
zepha.player:open_menu(formspec)
|
||||
zepha.player:open_menu(menu)
|
||||
else
|
||||
zepha.player:close_menu()
|
||||
end
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
zepha.register_item("zeus:materials:flint", {
|
||||
name = "Flint",
|
||||
textures = {
|
||||
"zeus:materials:flint",
|
||||
"zeus:materials:flint_outlined",
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
zepha.register_item("zeus:materials:plant_fibre", {
|
||||
name = "Plant Fibre",
|
||||
textures = {
|
||||
"zeus:materials:plant_fibre"
|
||||
"zeus:materials:plant_fibre_outlined"
|
||||
},
|
||||
groups = {
|
||||
organic = 1,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
zepha.register_item("zeus:materials:plant_twine", {
|
||||
name = "Plant Twine",
|
||||
textures = {
|
||||
"zeus:materials:plant_twine"
|
||||
"zeus:materials:plant_twine_outlined"
|
||||
},
|
||||
groups = {
|
||||
rope = 1,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
zepha.register_item("zeus:materials:rock", {
|
||||
name = "Rock",
|
||||
textures = {
|
||||
"zeus:materials:rock"
|
||||
"zeus:materials:rock_outlined"
|
||||
},
|
||||
groups = {
|
||||
rock = 1,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
zepha.register_item("zeus:materials:stick", {
|
||||
name = "Stick",
|
||||
textures = {
|
||||
"zeus:materials:stick_0",
|
||||
"zeus:materials:stick_1",
|
||||
"zeus:materials:stick_2",
|
||||
"zeus:materials:stick_3"
|
||||
"zeus:materials:stick_outlined",
|
||||
## "zeus:materials:stick_1_outlined",
|
||||
## "zeus:materials:stick_2_outlined",
|
||||
## "zeus:materials:stick_3_outlined"
|
||||
},
|
||||
groups = {
|
||||
stick = 1,
|
||||
|
|
Loading…
Reference in New Issue