def test_island(resourcepath): success, world_uid = micropsi.new_world("Misland", "Island", owner="tester") assert success world = runtime.worlds[world_uid] assert world.__class__.__name__ == 'Island' runtime.add_worldobject(world_uid, "Lightsource", (10, 10), uid='foobar', name='foobar', parameters={}) runtime.save_world(world_uid) runtime.revert_world(world_uid) world = runtime.worlds[world_uid] assert world.objects["foobar"].__class__.__name__ == 'Lightsource' assert world.objects["foobar"].position == [10, 10] assert world.data['objects']['foobar']['position'] == [10, 10] assert world.__class__.__name__ == 'Island' runtime.set_worldobject_properties(world_uid, "foobar", position=(5, 5)) assert world.objects["foobar"].position == (5, 5) assert world.data['objects']['foobar']['position'] == (5, 5) assert runtime.get_world_view(world_uid, -1)['objects']['foobar']['position'] == (5, 5) runtime.delete_world(world_uid)
def test_set_object_properties(test_world): world = runtime.get_available_worlds()[test_world] runtime.add_worldobject(test_world, "Default", (10, 10), uid='foobar', name='foobar', parameters={}) runtime.set_worldobject_properties(test_world, "foobar", position=(5, 5)) assert world.objects["foobar"].position == (5, 5) assert world.data['objects']['foobar']['position'] == (5, 5) assert runtime.get_world_view(test_world, -1)['objects']['foobar']['position'] == (5, 5)
def set_worldobject_properties(world_uid, uid, position=None, orientation=None, name=None, parameters=None): if runtime.set_worldobject_properties(world_uid, uid, position, int(orientation), name, parameters): return dict(status="success") else: return dict(status="error", msg="unknown world or world object")
def set_worldobject_properties(world_uid, uid, position=None, orientation=None, name=None, parameters=None): """ Set the properties of a worldobject in the given world """ if runtime.set_worldobject_properties(world_uid, uid, position, float(orientation), name, parameters): return dict(status="success") else: return dict(status="error", msg="unknown environment or world object")