Exemple #1
0
def test_unpacked_folder_map_redefines_rules_ai_and_style(test):
    res = test
    from soundrts.definitions import get_ai, rules, style
    from soundrts.mapfile import Map

    m = Map(unpack=Map("soundrts/tests/single/map1").pack())
    m.load_rules_and_ai(res)
    m.load_style(res)
    assert rules.get("test", "cost") == [0, 0]
    assert rules.get("peasant", "cost") == [6000, 0]
    assert get_ai("easy") == ["get 6 peasant", "goto -1"]
    assert style.get("peasant", "noise") == ["6"]
Exemple #2
0
def test_isolated_map(test):
    res = test
    from soundrts.mapfile import Map
    from soundrts.definitions import rules, get_ai, style
    map1 = Map("soundrts/tests/single/map1")
    map1.load_resources()
    map1.load_rules_and_ai(res)
    map1.load_style(res)
    assert rules.get("test", "cost") == [0, 0]
    assert rules.get("peasant", "cost") == [6000, 0]
    assert get_ai("easy") == ['get 6 peasant', 'goto -1']
    assert style.get("peasant", "noise") == ["6"]
    assert sounds.get_text("0") == "map1"
    map1.unload_resources()
Exemple #3
0
def test_isolated_map(test):
    res = test
    from soundrts.mapfile import Map
    from soundrts.definitions import rules, get_ai, style
    map1 = Map("soundrts/tests/single/map1")
    map1.load_resources()
    map1.load_rules_and_ai(res)
    map1.load_style(res)
    assert rules.get("test", "cost") == [0, 0]
    assert rules.get("peasant", "cost") == [6000, 0]
    assert get_ai("easy") == ['get 6 peasant', 'goto -1']
    assert style.get("peasant", "noise") == ["6"]
    assert sounds.get_text("0") == "map1"
    map1.unload_resources()