void Functions::getPosition(Aurora::NWScript::FunctionContext &ctx) { ctx.getReturn().setVector(0.0f, 0.0f, 0.0f); Witcher::Object *object = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0)); if (!object) return; float x, y, z; object->getPosition(x, y, z); ctx.getReturn().setVector(x, y, z); }
void Functions::actionMoveToObject(Aurora::NWScript::FunctionContext &ctx) { Witcher::Object *object = Witcher::ObjectContainer::toObject(ctx.getCaller()); Witcher::Object *moveTo = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0)); if (!object || !moveTo) return; float x, y, z; moveTo->getPosition(x, y, z); jumpTo(object, moveTo->getArea(), x, y, z); unimplementedFunction(ctx); }
void Functions::jumpToObject(Aurora::NWScript::FunctionContext &ctx) { // TODO: walkStraightLineToPoint // bool walkStraightLineToPoint = ctx.getParams()[1].getInt() != 0; Witcher::Object *object = Witcher::ObjectContainer::toObject(ctx.getCaller()); Witcher::Object *moveTo = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0)); if (!object || !moveTo) return; float x, y, z; moveTo->getPosition(x, y, z); jumpTo(object, moveTo->getArea(), x, y, z); }
float ObjectDistanceSort::getDistance(Witcher::Object &a) { float x, y, z; a.getPosition(x, y, z); return ABS(x - xt) + ABS(y - yt) + ABS(z - zt); }
ObjectDistanceSort::ObjectDistanceSort(const Witcher::Object &target) { target.getPosition(xt, yt, zt); }