Exemplo n.º 1
0
def StartTuxemon(mods=None, starting_map=None, slot=None):
    """Usage: StartTuxemon(mods="tuxemon", starting_map="player_house_bedroom.tmx", slot=False)
    Start the game from a specified path.
    If mods is not in mods folder, or it's other type than str, it will be ignored, the same is for starting_map."""
    
    '''parser = ArgumentParser()
    parser.add_argument('-m', '--mod', dest='mod', metavar='mymod', type=str, nargs='?',
                        default=None, help='The mod directory used in the mods directory')
    parser.add_argument('-l', '--load', dest='slot', metavar='1,2,3', type=int, nargs='?',
                        default=None, help='The index of the save file to load')
    parser.add_argument('-s', '--starting-map', dest='starting_map', metavar='map.tmx', type=str, nargs='?',
                        default=None, help='The starting map')
    args = parser.parse_args()'''
    
    if type(mods) == str:
        prepare.CONFIG.mods.insert(0, mods)
    if type(starting_map) == str:
        prepare.CONFIG.starting_map = starting_map
    
    main.main(load_slot=slot)
    
Exemplo n.º 2
0
def main(args=None):
    server = False
    opts, args = getopt.getopt(sys.argv[1:], "hs", ["help", "server"])
    for opt, arg in opts:
        if opt == '-h':
            print(sys.argv[0], '[--server]')
            print("  -h              Display this help message")
            print("  -s, --headless  Start a headless server")
            sys.exit()
        elif opt in ("-s", "--server"):
            server = True

    if server:
        from tuxemon.core.main import headless

        headless()

    else:
        from tuxemon.core.main import main

        main()

    sys.exit()
Exemplo n.º 3
0
                        dest='mod',
                        metavar='mymod',
                        type=str,
                        nargs='?',
                        default=None,
                        help='The mod directory used in the mods directory')
    parser.add_argument('-l',
                        '--load',
                        dest='slot',
                        metavar='1,2,3',
                        type=int,
                        nargs='?',
                        default=None,
                        help='The index of the save file to load')
    parser.add_argument('-s',
                        '--starting-map',
                        dest='starting_map',
                        metavar='map.tmx',
                        type=str,
                        nargs='?',
                        default=None,
                        help='The starting map')
    args = parser.parse_args()

    if args.mod:
        prepare.CONFIG.mods.insert(0, args.mod)
    if args.starting_map:
        prepare.CONFIG.starting_map = args.starting_map

    main.main(load_slot=args.slot)
Exemplo n.º 4
0
import sys


def main(args=None):
    server = False
    opts, args = getopt.getopt(sys.argv[1:], "hs", ["help", "server"])
    for opt, arg in opts:
        if opt == '-h':
            print(sys.argv[0], '[--server]')
            print("  -h              Display this help message")
            print("  -s, --headless  Start a headless server")
            sys.exit()
        elif opt in ("-s", "--server"):
            server = True

    if server:
        from tuxemon.core.main import headless

        headless()

    else:
        from tuxemon.core.main import main

        main()

    sys.exit()


if __name__ == "__main__":
    main()