Пример #1
0
def focus_on_object_from_position(obj_position=None,
                                  camera_position=None,
                                  client=None):
    op = FocusCamera()
    op.set_position(camera_position)
    op.set_location(obj_position)
    Distributor.instance().add_op_with_no_owner(op)
Пример #2
0
def deserialize(client=None, active_sim=None):
    global _sim_id, _target_position, _camera_position, _follow_mode, _zone_id
    save_slot_data_msg = services.get_persistence_service(
    ).get_save_slot_proto_buff()
    if save_slot_data_msg is not None and save_slot_data_msg.HasField(
            'gameplay_data'):
        gameplay_data = save_slot_data_msg.gameplay_data
        if gameplay_data.HasField('camera_data'):
            camera_data = save_slot_data_msg.gameplay_data.camera_data
            if camera_data.HasField('target_id'):
                if active_sim is not None:
                    _sim_id = active_sim.id
                else:
                    _sim_id = camera_data.target_id
                _target_position = camera_data.target_position
                _camera_position = camera_data.camera_position
                _follow_mode = camera_data.follow_mode
                _zone_id = camera_data.zone_id
                if camera_data.HasField(
                        'household_id') and services.active_lot(
                        ).owner_household_id != camera_data.household_id:
                    return False
                if _follow_mode and services.sim_info_manager().get(
                        _sim_id) is None:
                    _sim_id = None
                    _target_position = None
                    _camera_position = None
                    _follow_mode = None
                    _zone_id = None
                    return False
                zone_id = services.current_zone_id()
                if _zone_id == zone_id:
                    op = FocusCamera(id=_sim_id, follow_mode=_follow_mode)
                    op.set_location(_target_position)
                    op.set_position(_camera_position)
                    Distributor.instance().add_op_with_no_owner(op)
                    return True
    _sim_id = None
    _target_position = None
    _camera_position = None
    _follow_mode = None
    _zone_id = None
    return False
Пример #3
0
def focus_on_position(pos, client=None):
    op = FocusCamera()
    op.set_location(pos)
    Distributor.instance().add_op_with_no_owner(op)
Пример #4
0
def focus_on_sim(sim=None, follow=True, client=None):
    focus_sim = sim or client.active_sim
    op = FocusCamera(id=focus_sim.id, follow_mode=follow)
    Distributor.instance().add_op_with_no_owner(op)
Пример #5
0
def set_to_default():
    op = FocusCamera(id=0)
    Distributor.instance().add_op_with_no_owner(op)