mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-28 19:21:04 +00:00
use string_view
This commit is contained in:
parent
9811eb7d32
commit
cd7017e0e4
@ -257,11 +257,11 @@ namespace MWLua
|
|||||||
};
|
};
|
||||||
|
|
||||||
api["addVfx"] = [context](
|
api["addVfx"] = [context](
|
||||||
const sol::object& object, const std::string& model, sol::optional<sol::table> options) {
|
const sol::object& object, std::string_view model, sol::optional<sol::table> options) {
|
||||||
if (options)
|
if (options)
|
||||||
{
|
{
|
||||||
context.mLuaManager->addAction(
|
context.mLuaManager->addAction(
|
||||||
[object = ObjectVariant(object), model = model,
|
[object = ObjectVariant(object), model = std::string(model),
|
||||||
effectId = options->get_or<std::string>("vfxId", ""), loop = options->get_or("loop", false),
|
effectId = options->get_or<std::string>("vfxId", ""), loop = options->get_or("loop", false),
|
||||||
boneName = options->get_or<std::string>("boneName", ""),
|
boneName = options->get_or<std::string>("boneName", ""),
|
||||||
particleTexture = options->get_or<std::string>("particleTextureOverride", "")] {
|
particleTexture = options->get_or<std::string>("particleTextureOverride", "")] {
|
||||||
@ -274,7 +274,7 @@ namespace MWLua
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
context.mLuaManager->addAction(
|
context.mLuaManager->addAction(
|
||||||
[object = ObjectVariant(object), model = model] {
|
[object = ObjectVariant(object), model = std::string(model)] {
|
||||||
MWRender::Animation* anim = getMutableAnimationOrThrow(object);
|
MWRender::Animation* anim = getMutableAnimationOrThrow(object);
|
||||||
anim->addEffect(model, "");
|
anim->addEffect(model, "");
|
||||||
},
|
},
|
||||||
@ -310,22 +310,21 @@ namespace MWLua
|
|||||||
auto world = MWBase::Environment::get().getWorld();
|
auto world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
api["spawn"]
|
api["spawn"]
|
||||||
= [world, context](const std::string model, const osg::Vec3f& worldPos, sol::optional<sol::table> options) {
|
= [world, context](std::string_view model, const osg::Vec3f& worldPos, sol::optional<sol::table> options) {
|
||||||
if (options)
|
if (options)
|
||||||
{
|
{
|
||||||
bool magicVfx = options->get_or("mwMagicVfx", true);
|
bool magicVfx = options->get_or("mwMagicVfx", true);
|
||||||
std::string texture = options->get_or<std::string>("particleTextureOverride", "");
|
std::string texture = options->get_or<std::string>("particleTextureOverride", "");
|
||||||
float scale = options->get_or("scale", 1.f);
|
float scale = options->get_or("scale", 1.f);
|
||||||
context.mLuaManager->addAction(
|
context.mLuaManager->addAction(
|
||||||
[world, model = model, texture = std::move(texture), worldPos, scale, magicVfx]() {
|
[world, model = std::string(model), texture = std::move(texture), worldPos, scale,
|
||||||
world->spawnEffect(model, texture, worldPos, scale, magicVfx);
|
magicVfx]() { world->spawnEffect(model, texture, worldPos, scale, magicVfx); },
|
||||||
},
|
|
||||||
"openmw.vfx.spawn");
|
"openmw.vfx.spawn");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
context.mLuaManager->addAction(
|
context.mLuaManager->addAction(
|
||||||
[world, model = model, worldPos]() { world->spawnEffect(model, "", worldPos); },
|
[world, model = std::string(model), worldPos]() { world->spawnEffect(model, "", worldPos); },
|
||||||
"openmw.vfx.spawn");
|
"openmw.vfx.spawn");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user