Skip to content

Commit

Permalink
primitive water spots, sink in water
Browse files Browse the repository at this point in the history
  • Loading branch information
ronmurphy committed Apr 18, 2013
1 parent 0df9ef1 commit 2be0d3e
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 114 deletions.
19 changes: 1 addition & 18 deletions commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# Modules from this project
from blocks import BlockID
from items import get_item
from player import *

COMMAND_HANDLED = True
COMMAND_NOT_HANDLED = None
Expand Down Expand Up @@ -188,20 +187,4 @@ def execute(self, *args, **kwargs):

# ...and then show them again
self.controller.text_input.visible = True
self.controller.chat_box.visible = True

#class TeleportCommand(Command):
#command = r"^tp (\d+) (\d+) (\d+)$"
#help_text = "tp <x y z>: Teleport to x y z"

#def execute(self, tpx, tpy, tpz, *args, **kwargs):
#try:
#tx = int(tpx)
#ty = int(tpy)
#tz = int(tpz)
#print tx, ty, tz

#self.position = (tx, ty, tz)
#self.send_info("Teleported.")
#except ValueError:
#raise CommandException(self.command_text, message="x y and z should be integers.")
self.controller.chat_box.visible = True
2 changes: 1 addition & 1 deletion controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def setup(self):
seeds.write('%s\n\n' % seed)

self.model = Model()
self.player = Player((0, 0, 0), (-20, 0),
self.player = Player((0,self.model.terraingen.get_height(0,0)+2,0), (-20, 0),
game_mode=G.GAME_MODE)
self.save_to_file() #So the hardcoded spawn sectors aren't overwritten by the worldgen
print('Game mode: ' + self.player.game_mode)
Expand Down
6 changes: 5 additions & 1 deletion globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@

SEED = None

#
# Biome
#
DESERT, PLAINS, MOUNTAINS, SNOW, FOREST = range(5)

#
# Graphical rendering
Expand All @@ -172,7 +176,7 @@
WINDOW_HEIGHT = 480 # Screen height (in pixels)

MAX_FPS = 60 # Maximum frames per second.
QUEUE_PROCESS_SPEED = 0.2 / MAX_FPS #Try shrinking this if chunk loading is laggy, higher loads chunks faster
QUEUE_PROCESS_SPEED = 0.3 / MAX_FPS #Try shrinking this if chunk loading is laggy, higher loads chunks faster

VISIBLE_SECTORS_RADIUS = 8
DELOAD_SECTORS_RADIUS = 16
Expand Down
6 changes: 4 additions & 2 deletions player.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ def __init__(self, position, rotation, flying=False,
self.inventory.add_item(item.id, quantity)
#else:
# self.quick_slots.add_item(item.id, quantity)
#perlin tends to be about y=16 to 18, so we set the player at 18...
self.position = 0,18,0

def add_item(self, item_id):
if self.quick_slots.add_item(item_id):
Expand Down Expand Up @@ -167,6 +165,10 @@ def collide(self, parent, position, height):
if op not in parent.model \
or parent.model[op].vertex_mode != G.VERTEX_CUBE:
continue
# if density <= 1 then we can walk through it. (water)
if op not in parent.model \
or parent.model[op].density < 1:
continue
p[i] -= (d - pad) * face[i]
if face == (0, -1, 0) or face == (0, 1, 0):
# jump damage
Expand Down
8 changes: 1 addition & 7 deletions run.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
@echo off
echo Starting pyCraftr...
c:\Python\python.exe %1 --disable-auto-save --disable-save %2 %3 %4 %5 %6 %7 %8 %9
echo Cleaning up...
del *.pyc
del *.c
del *.h
del *.so
cleanup.bat
3 changes: 3 additions & 0 deletions savingsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def save_world(window, game_dir, world=None):
if G.SAVE_MODE == G.REGION_SAVE_MODE:
#Saves individual sectors in region files (4x4x4 sectors)
blocks = window.model

while blocks.generation_queue: #This must be empty or it'll save queued sectors as all air
blocks.dequeue_generation()
for secpos in window.model.sectors: #TODO: only save dirty sectors
if not window.model.sectors[secpos]:
continue #Skip writing empty sectors
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
excluded_modules = (
'globals',
'gui',
'pyglet.event',
'pyglet.image.codecs',
'pyglet.image.codecs.pypng',
'pyglet.canvas.base',
'pyglet.event',
'pyglet.gl.glext_arb',
'pyglet.gl.glext_nv',
'pyglet.image.codecs',
'pyglet.image.codecs.pypng',
'pyglet.media',
'pyglet.media.drivers.alsa.asound',
'pyglet.window',
'pyglet.window.xlib.xlib',
)


Expand Down
Loading

0 comments on commit 2be0d3e

Please sign in to comment.