File tree 4 files changed +40
-0
lines changed
4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -293,6 +293,20 @@ namespace geode {
293
293
saved[key] = value;
294
294
return old;
295
295
}
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);
296
310
297
311
/* *
298
312
* 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 {
150
150
* Get the description of this setting
151
151
*/
152
152
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);
153
161
/* *
154
162
* Get the "enable-if" scheme for this setting
155
163
*/
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 {
163
163
return m_impl->m_settings ->get (std::string (key));
164
164
}
165
165
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
+
166
178
Result<> Mod::registerCustomSettingType (std::string_view type, SettingGenerator generator) {
167
179
return m_impl->m_settings ->registerCustomSettingType (type, generator);
168
180
}
Original file line number Diff line number Diff line change @@ -585,6 +585,12 @@ std::string SettingV3::getDisplayName() const {
585
585
std::optional<std::string> SettingV3::getDescription () const {
586
586
return m_impl->description ;
587
587
}
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
+ }
588
594
std::optional<std::string> SettingV3::getEnableIf () const {
589
595
return m_impl->enableIf ;
590
596
}
You can’t perform that action at this time.
0 commit comments