Skip to content

Commit

Permalink
🐛 use weak ref with all tweak db record
Browse files Browse the repository at this point in the history
  • Loading branch information
Roms1383 committed May 8, 2024
1 parent fc15d40 commit 6597b1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions scripts/Addicted/Crossover.reds
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public class NeuroBlockerTweaks extends ScriptableTweak {
// with status effect set as BaseStatusEffect.NotablyWeakenedRipperDocMedBuff
private func Derive(prefixes: array<String>, diminutive: String, suffixes: array<String>) -> Void {
for suffix in suffixes {
let effect: ref<StatusEffect_Record> = TweakDBInterface.GetStatusEffectRecord(TDBID.Create("BaseStatusEffect." + diminutive + suffix));
let duration: ref<StatModifierGroup_Record> = effect.Duration();
let uiData: ref<StatusEffectUIData_Record> = effect.UiData();
let modifier: ref<ConstantStatModifier_Record> = duration.GetStatModifiersItem(0) as ConstantStatModifier_Record;
let effect: wref<StatusEffect_Record> = TweakDBInterface.GetStatusEffectRecord(TDBID.Create("BaseStatusEffect." + diminutive + suffix));
let duration: wref<StatModifierGroup_Record> = effect.Duration();
let uiData: wref<StatusEffectUIData_Record> = effect.UiData();
let modifier: wref<ConstantStatModifier_Record> = duration.GetStatModifiersItem(0) as ConstantStatModifier_Record;
let updated: Float;
let value: Float = modifier.Value();
Expand Down
2 changes: 1 addition & 1 deletion scripts/Addicted/Tweaks.reds
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public func Reacts(reaction: CName) -> Void {
/// ObjectActionEffect_Record are immutable but actionEffects can be swapped
private func AlterStatusEffects(const actionEffects: script_ref<array<wref<ObjectActionEffect_Record>>>, gameInstance: GameInstance) -> Void {
let system = AddictedSystem.GetInstance(gameInstance);
let altered: ref<ObjectActionEffect_Record>;
let altered: wref<ObjectActionEffect_Record>;
let consumable: Consumable;
let addiction: Addiction;
let threshold: Threshold = Threshold.Clean;
Expand Down

0 comments on commit 6597b1d

Please sign in to comment.