Esempio n. 1
0

import sys, soya, tofu_enet, cerealizer, soya.cerealizer4soya

tofu_enet.HOST = "127.0.0.1"
if len(sys.argv) > 1: tofu_enet.LOGIN = sys.argv[1]

cerealizer.register(tofu_enet.Level, soya.cerealizer4soya.SavedInAPathHandler(tofu_enet.Level))
cerealizer.register(tofu_enet.Mobile)

tofu_enet.set_mode("client")
main_loop = tofu_enet.MainLoop(soya.World())
main_loop.main_loop()
Esempio n. 2
0
import sys, os, os.path

import soya, tofu_enet, cerealizer, soya.cerealizer4soya, soya.sdlconst as sdlconst


mode = sys.argv[1]

HERE = os.path.dirname(sys.argv[0])

soya.path.append(os.path.join(HERE, "data"))

tofu_enet.set_mode(mode)


class Player(tofu_enet.Player):
  def __init__(self, filename, password, opt_data = ""):
    tofu_enet.Player.__init__(self, filename, password, opt_data)
    
    mobile = Mobile()
    mobile.set_xyz(108.0, -8.0, 107.0)
    mobile.x += 2 * len(LEVEL.mobiles)
    LEVEL.add_mobile(mobile)
    self.add_mobile(mobile)
    self.save()
    
    
tofu_enet.CREATE_PLAYER = Player

class Level(tofu_enet.Level):
  def __init__(self):
Esempio n. 3
0
import sys, os, os.path

import soya, tofu_enet, cerealizer, soya.cerealizer4soya

try: os.mkdir("/tmp/tofu_data")
except: pass
try: os.mkdir("/tmp/tofu_data/players")
except: pass
try: os.mkdir("/tmp/tofu_data/levels")
except: pass

soya.path.append("/tmp/tofu_data")

tofu_enet.set_mode("server")




class TestPlayer(tofu_enet.Player):
  def __init__(self, filename, password, opt_data = ""):
    tofu_enet.Player.__init__(self, filename, password, opt_data)
    
    mobile = tofu_enet.Mobile()
    LEVEL.add_mobile(mobile)
    self.add_mobile(mobile)
    self.save()

tofu_enet.CREATE_PLAYER = TestPlayer

cerealizer.register(tofu_enet.Level, soya.cerealizer4soya.SavedInAPathHandler(tofu_enet.Level))