Skip to content

Commit 03daabf

Browse files
committed
Linting
1 parent fbe23b5 commit 03daabf

15 files changed

Lines changed: 24 additions & 32 deletions

data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from colours import *
1+
from colours import DARK, BOLD, DARK_GRAY, YELLOW, RED, WHITE
22
from console import supported_chars
33

44

events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ def boom(server, x, y):
4040

4141
server.splash_damage(x, y, radius*2, blast_strength/3)
4242

43-
return new_blocks
43+
return new_blocks

items.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ def items_to_render_objects(items, x, offset):
6666

6767
objects.append(object_)
6868

69-
return objects
69+
return objects

main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def setdown():
8080

8181
def game(server, settings, benchmarks):
8282
dt = 0 # Tick
83-
df = 0 # Frame
8483
dc = 0 # Cursor
8584
ds = 0 # Selector
8685
dpos = False
@@ -286,14 +285,14 @@ def game(server, settings, benchmarks):
286285
events += new_events
287286

288287
new_blocks = {}
289-
for i in range(int(dt)):
288+
for _ in range(int(dt)):
290289
new_blocks.update(process_events(events, server))
291290
if new_blocks:
292291
server.set_blocks(new_blocks)
293292

294293
# If no block below, kill player
295294
try:
296-
block = server.map_[x][y+1]
295+
_ = server.map_[x][y+1]
297296
except IndexError:
298297
alive = False
299298

mobs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def update(mobs, players, map_, last_tick):
3030
new_items = {}
3131

3232
for mob_id, mob in mobs.items():
33-
mx, my, x_vel = mob['x'], mob['y'], mob['x_vel']
33+
mx, my = mob['x'], mob['y']
3434

3535
if mob['health'] <= 0:
3636
removed_mobs.append(mob_id)
@@ -64,7 +64,7 @@ def update(mobs, players, map_, last_tick):
6464

6565

6666
def spawn(mobs, players, map_, x_start_range, y_start_range, x_end_range, y_end_range):
67-
log("spawning", x_start_range, x_end_range, m='mobs');
67+
log('spawning', x_start_range, x_end_range, m='mobs')
6868

6969
n_mobs_to_spawn = random.randint(0, 5) if random.random() < mob_rate else 0
7070
new_mobs = {}

network.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def receive(sock):
5353
d = bytes()
5454

5555
try:
56-
for i in range(length // bufsize):
56+
for _ in range(length // bufsize):
5757
d += sock.recv(bufsize)
5858
time.sleep(0.001)
5959
d += sock.recv(length % bufsize)
@@ -107,7 +107,7 @@ def start(data_handler, port):
107107
HOST, PORT = '0.0.0.0', int(port)
108108

109109
server = ThreadedTCPServer((HOST, PORT), requestHandlerFactory(data_handler))
110-
ip, port = server.server_address
110+
_, port = server.server_address
111111

112112
# Start a thread with the server -- that thread will then start one
113113
# more thread for each request

pathfinding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ def pathfind_towards_delta(entity, delta, map_):
3333

3434
updated = True
3535

36-
return updated, kill_entity
36+
return updated, kill_entity

player.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_pos_delta_on_input(inp, map_, x, y, jump, flight):
4444
return dx, dy, jump
4545

4646

47-
def get_pos_delta(dx, x, y, map_, flight):
47+
def get_pos_delta(dx, x, y, map_, flight=False):
4848

4949
player_slice = map_[x]
5050

render.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from math import pi, cos, sin, sqrt, modf, radians
22

3-
from colours import *
4-
from console import *
3+
from colours import colour_str, uncolour_str, rgb, round_to_palette, lightness, bold, RED, CYAN, BLUE
4+
from console import supported_chars, DEBUG, POS_STR, CLS_END_LN
55
from data import lighting, world_gen, blocks, timings
66
from terrain import is_solid
77

@@ -104,7 +104,6 @@ def obj_pixel(x, y, objects):
104104

105105
if object_:
106106
model = object_['model']
107-
width = len(model)
108107
height = len(model[0])
109108

110109
dx = x - object_['x']
@@ -240,7 +239,7 @@ def get_light_colour(x, y, world_x, map_, slice_heights, lights, colour_behind,
240239

241240
else:
242241

243-
light = CYAN if any(map(lambda l: lit(world_x, x, y, l) < 1, lights)) else hsv_to_rgb(colour_behind)
242+
light = CYAN if any(map(lambda l: lit(world_x + x, y, l) < 1, lights)) else hsv_to_rgb(colour_behind)
244243

245244
return light
246245

render_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ def get_light_level(*args):
5555
log('Not implemented: Python get_light_level function', m='warning')
5656

5757
log('{}'.format(result), m='lighting')
58-
return result
58+
return result

0 commit comments

Comments
 (0)