diff --git a/README.md b/README.md index 40306ed..f274e42 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # cubicjs -сайт: https://meex.lol/cubic/ +сайт: https://meex.lol/cubic/client/index.html ## роадмап diff --git a/client/build.sh b/build.sh old mode 100755 new mode 100644 similarity index 100% rename from client/build.sh rename to build.sh diff --git a/client/index.html b/index.html similarity index 100% rename from client/index.html rename to index.html diff --git a/server/src/__main__.py b/server/src/__main__.py index 1b3f4a1..df62e90 100644 --- a/server/src/__main__.py +++ b/server/src/__main__.py @@ -1,27 +1,16 @@ -import asyncio, time +import asyncio from network import startServer -from player import Player -from block import Block from world import * from config import * -def current_milli_time(): - return round(time.time() * 1000) - async def tickTimer(): while True: for b in WORLD: await b.tick() await asyncio.sleep(1/20) -async def keepAliveTimer(): - while True: - for b in getPlayers(): - await b.keepAlive() - await asyncio.sleep(1) - async def renderTimer(): while True: for p in getPlayers(): @@ -30,7 +19,6 @@ async def renderTimer(): async def main(): asyncio.get_event_loop().create_task(tickTimer()) - asyncio.get_event_loop().create_task(keepAliveTimer()) asyncio.get_event_loop().create_task(renderTimer()) await startServer(HOST, PORT) diff --git a/server/src/player.py b/server/src/player.py index 6a09ac0..24f06a0 100644 --- a/server/src/player.py +++ b/server/src/player.py @@ -231,25 +231,13 @@ class Player(Block): async def onCollide(self, player, x, y): await super().onCollide(player, x, y) - # if x != 0: - # player.vel_x *= 0.5 - # self.vel_x = player.vel_x - # if y != 0: - # player.vel_y *= 0.5 - # self.vel_y = player.vel_y - # pass async def render(self): self.vel_x *= 0.5 self.vel_y *= 0.5 self.x += self.vel_x self.y += self.vel_y - # await self.setVel(self.vel_x * 0.5, self.vel_y * 0.5) - # await self.setPos(self.x + self.vel_x, self.y + self.vel_y) return self.vel_x != 0 or self.vel_y != 0 - async def keepAlive(self): - await self.sendPacket("R", [str(self.x), str(self.y), str(self.vel_x), str(self.vel_y)]) - def toStatement(self, add=True): return f"P1{self.name},{self.x},{self.y},{self.vel_x},{self.vel_y},{self.color}" if add else f"P0{self.name}" diff --git a/client/src/block.ts b/src/block.ts similarity index 100% rename from client/src/block.ts rename to src/block.ts diff --git a/client/src/core.ts b/src/core.ts similarity index 100% rename from client/src/core.ts rename to src/core.ts diff --git a/client/src/main.ts b/src/main.ts similarity index 100% rename from client/src/main.ts rename to src/main.ts diff --git a/client/src/network.ts b/src/network.ts similarity index 100% rename from client/src/network.ts rename to src/network.ts diff --git a/client/src/player.ts b/src/player.ts similarity index 100% rename from client/src/player.ts rename to src/player.ts diff --git a/client/tsconfig.json b/tsconfig.json similarity index 100% rename from client/tsconfig.json rename to tsconfig.json