File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -293,6 +293,20 @@ namespace geode {
293293 saved[key] = value;
294294 return old;
295295 }
296+
297+ /* *
298+ * Set the name of setting.
299+ * @param key Setting key
300+ * @param name New name
301+ */
302+ void setSettingName (std::string_view key, std::string_view name);
303+
304+ /* *
305+ * Set the description of a setting.
306+ * @param key Setting key
307+ * @param desc New description
308+ */
309+ void setSettingDescription (std::string_view key, std::string_view description);
296310
297311 /* *
298312 * Get the Mod of the current mod being developed
Original file line number Diff line number Diff line change @@ -150,6 +150,14 @@ namespace geode {
150150 * Get the description of this setting
151151 */
152152 std::optional<std::string> getDescription () const ;
153+ /* *
154+ * Set the display name of this setting
155+ */
156+ void setDisplayName (std::string_view name);
157+ /* *
158+ * Set the description of this setting
159+ */
160+ void setDescription (std::string_view desc);
153161 /* *
154162 * Get the "enable-if" scheme for this setting
155163 */
Original file line number Diff line number Diff line change @@ -163,6 +163,18 @@ std::shared_ptr<Setting> Mod::getSetting(std::string_view key) const {
163163 return m_impl->m_settings ->get (std::string (key));
164164}
165165
166+ void Mod::setSettingName (std::string_view key, std::string_view name) {
167+ if (auto setting = getSetting (key)) {
168+ setting->setDisplayName (name);
169+ }
170+ }
171+
172+ void Mod::setSettingDescription (std::string_view key, std::string_view desc) {
173+ if (auto setting = getSetting (key)) {
174+ setting->setDescription (desc);
175+ }
176+ }
177+
166178Result<> Mod::registerCustomSettingType (std::string_view type, SettingGenerator generator) {
167179 return m_impl->m_settings ->registerCustomSettingType (type, generator);
168180}
Original file line number Diff line number Diff line change @@ -585,6 +585,12 @@ std::string SettingV3::getDisplayName() const {
585585std::optional<std::string> SettingV3::getDescription () const {
586586 return m_impl->description ;
587587}
588+ void SettingV3::setDisplayName (std::string_view name) {
589+ m_impl->name = name;
590+ }
591+ void SettingV3::setDescription (std::string_view description) {
592+ m_impl->description = description;
593+ }
588594std::optional<std::string> SettingV3::getEnableIf () const {
589595 return m_impl->enableIf ;
590596}
You can’t perform that action at this time.
0 commit comments