Fix: [Script] Apply random deviation only at script start (#11944)
This commit is contained in:
@@ -235,9 +235,10 @@ public:
|
||||
* is selected. Required. The value will be clamped in the range
|
||||
* [MIN(int32_t), MAX(int32_t)] (inclusive).
|
||||
* - random_deviation If this property has a nonzero value, then the
|
||||
* actual value of the setting in game will be randomized in the range
|
||||
* actual value of the setting in game will be randomised in the range
|
||||
* [user_configured_value - random_deviation, user_configured_value + random_deviation] (inclusive).
|
||||
* random_deviation sign is ignored and the value is clamped in the range [0, MAX(int32_t)] (inclusive).
|
||||
* The randomisation will happen just before the Script start.
|
||||
* Not allowed if the CONFIG_RANDOM flag is set, otherwise optional.
|
||||
* - step_size The increase/decrease of the value every time the user
|
||||
* clicks one of the up/down arrow buttons. Optional, default is 1.
|
||||
|
@@ -32,10 +32,6 @@ void ScriptConfig::Change(std::optional<const std::string> name, int version, bo
|
||||
this->to_load_data.reset();
|
||||
|
||||
this->ClearConfigList();
|
||||
|
||||
if (_game_mode == GM_NORMAL && this->info != nullptr) {
|
||||
this->AddRandomDeviation();
|
||||
}
|
||||
}
|
||||
|
||||
ScriptConfig::ScriptConfig(const ScriptConfig *config)
|
||||
@@ -49,9 +45,6 @@ ScriptConfig::ScriptConfig(const ScriptConfig *config)
|
||||
for (const auto &item : config->settings) {
|
||||
this->settings[item.first] = item.second;
|
||||
}
|
||||
|
||||
/* Virtual functions get called statically in constructors, so make it explicit to remove any confusion. */
|
||||
this->ScriptConfig::AddRandomDeviation();
|
||||
}
|
||||
|
||||
ScriptConfig::~ScriptConfig()
|
||||
|
Reference in New Issue
Block a user