From cb2a8c74dd1fcd5059346765f48c342efbdb9ade Mon Sep 17 00:00:00 2001
From: Mehdi Yousfi-Monod <myousfimonod@chapsvision.com>
Date: Sun, 1 Sep 2024 15:26:58 +0200
Subject: [PATCH] FEAT: Expose starter spells

---
 apps/openmw/mwlua/magicbindings.cpp | 2 ++
 files/lua_api/openmw/core.lua       | 1 +
 2 files changed, 3 insertions(+)

diff --git a/apps/openmw/mwlua/magicbindings.cpp b/apps/openmw/mwlua/magicbindings.cpp
index 8078537d5a..9498c68477 100644
--- a/apps/openmw/mwlua/magicbindings.cpp
+++ b/apps/openmw/mwlua/magicbindings.cpp
@@ -306,6 +306,8 @@ namespace MWLua
         spellT["cost"] = sol::readonly_property([](const ESM::Spell& rec) -> int { return rec.mData.mCost; });
         spellT["alwaysSucceedFlag"] = sol::readonly_property(
             [](const ESM::Spell& rec) -> bool { return !!(rec.mData.mFlags & ESM::Spell::F_Always); });
+        spellT["starterSpellFlag"] = sol::readonly_property(
+                [](const ESM::Spell& rec) -> bool { return !!(rec.mData.mFlags & ESM::Spell::F_PCStart); });
         spellT["autocalcFlag"] = sol::readonly_property(
             [](const ESM::Spell& rec) -> bool { return !!(rec.mData.mFlags & ESM::Spell::F_Autocalc); });
         spellT["effects"] = sol::readonly_property(
diff --git a/files/lua_api/openmw/core.lua b/files/lua_api/openmw/core.lua
index 6178fed08b..8a78a52441 100644
--- a/files/lua_api/openmw/core.lua
+++ b/files/lua_api/openmw/core.lua
@@ -679,6 +679,7 @@
 -- @field #number cost
 -- @field #list<#MagicEffectWithParams> effects The effects (@{#MagicEffectWithParams}) of the spell
 -- @field #boolean alwaysSucceedFlag If set, the spell should ignore skill checks and always succeed.
+-- @field #boolean starterSpellFlag If set, the spell can be selected as a player's starting spell.
 -- @field #boolean autocalcFlag If set, the casting cost should be computed based on the effect list rather than read from the cost field
 
 ---