|
|
@ -1,6 +1,6 @@ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Config object for `FixInventoryAbuse_Feature`. |
|
|
|
* Config object for `FixInventoryAbuse_Feature`. |
|
|
|
* Copyright 2021 Anton Tarasenko |
|
|
|
* Copyright 2021-2022 Anton Tarasenko |
|
|
|
*------------------------------------------------------------------------------ |
|
|
|
*------------------------------------------------------------------------------ |
|
|
|
* This file is part of Acedia. |
|
|
|
* This file is part of Acedia. |
|
|
|
* |
|
|
|
* |
|
|
@ -25,17 +25,17 @@ class FixInventoryAbuse extends FeatureConfig |
|
|
|
var public config float checkInterval; |
|
|
|
var public config float checkInterval; |
|
|
|
var public config array<FixInventoryAbuse_Feature.DualiesPair> dualiesClasses; |
|
|
|
var public config array<FixInventoryAbuse_Feature.DualiesPair> dualiesClasses; |
|
|
|
|
|
|
|
|
|
|
|
protected function AssociativeArray ToData() |
|
|
|
protected function HashTable ToData() |
|
|
|
{ |
|
|
|
{ |
|
|
|
local int i; |
|
|
|
local int i; |
|
|
|
local DynamicArray pairsArray; |
|
|
|
local ArrayList pairsArray; |
|
|
|
local AssociativeArray data, pair; |
|
|
|
local HashTable data, pair; |
|
|
|
data = _.collections.EmptyAssociativeArray(); |
|
|
|
data = _.collections.EmptyHashTable(); |
|
|
|
data.SetFloat(P("checkInterval"), checkInterval, true); |
|
|
|
data.SetFloat(P("checkInterval"), checkInterval); |
|
|
|
pairsArray = _.collections.EmptyDynamicArray(); |
|
|
|
pairsArray = _.collections.EmptyArrayList(); |
|
|
|
for (i = 0; i < dualiesClasses.length; i += 1) |
|
|
|
for (i = 0; i < dualiesClasses.length; i += 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pair = _.collections.EmptyAssociativeArray(); |
|
|
|
pair = _.collections.EmptyHashTable(); |
|
|
|
pair.SetItem( P("single"), |
|
|
|
pair.SetItem( P("single"), |
|
|
|
_.text.FromString(string(dualiesClasses[i].single))); |
|
|
|
_.text.FromString(string(dualiesClasses[i].single))); |
|
|
|
pair.SetItem( P("dual"), |
|
|
|
pair.SetItem( P("dual"), |
|
|
@ -43,27 +43,28 @@ protected function AssociativeArray ToData() |
|
|
|
pairsArray.AddItem(pair); |
|
|
|
pairsArray.AddItem(pair); |
|
|
|
} |
|
|
|
} |
|
|
|
data.SetItem(P("dualiesClasses"), pairsArray); |
|
|
|
data.SetItem(P("dualiesClasses"), pairsArray); |
|
|
|
|
|
|
|
_.memory.Free(pairsArray); |
|
|
|
return data; |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function FromData(AssociativeArray source) |
|
|
|
protected function FromData(HashTable source) |
|
|
|
{ |
|
|
|
{ |
|
|
|
local int i; |
|
|
|
local int i; |
|
|
|
local DynamicArray pairsArray; |
|
|
|
local ArrayList pairsArray; |
|
|
|
local AssociativeArray loadedPair; |
|
|
|
local HashTable loadedPair; |
|
|
|
local FixInventoryAbuse_Feature.DualiesPair newPair; |
|
|
|
local FixInventoryAbuse_Feature.DualiesPair newPair; |
|
|
|
if (source == none) { |
|
|
|
if (source == none) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
checkInterval = source.GetFloat(P("checkInterval"), 0.25); |
|
|
|
checkInterval = source.GetFloat(P("checkInterval"), 0.25); |
|
|
|
pairsArray = source.GetDynamicArray(P("dualiesClasses")); |
|
|
|
pairsArray = source.GetArrayList(P("dualiesClasses")); |
|
|
|
dualiesClasses.length = 0; |
|
|
|
dualiesClasses.length = 0; |
|
|
|
if (pairsArray == none) { |
|
|
|
if (pairsArray == none) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
for (i = 0; i < pairsArray.GetLength(); i += 1) |
|
|
|
for (i = 0; i < pairsArray.GetLength(); i += 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
loadedPair = pairsArray.GetAssociativeArray(i); |
|
|
|
loadedPair = pairsArray.GetHashTable(i); |
|
|
|
if (loadedPair == none) continue; |
|
|
|
if (loadedPair == none) continue; |
|
|
|
|
|
|
|
|
|
|
|
newPair.single = class<KFWeaponPickup>( |
|
|
|
newPair.single = class<KFWeaponPickup>( |
|
|
@ -72,6 +73,7 @@ protected function FromData(AssociativeArray source) |
|
|
|
_.memory.LoadClass(loadedPair.GetText(P("dual"))) ); |
|
|
|
_.memory.LoadClass(loadedPair.GetText(P("dual"))) ); |
|
|
|
dualiesClasses[dualiesClasses.length] = newPair; |
|
|
|
dualiesClasses[dualiesClasses.length] = newPair; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
_.memory.Free(pairsArray); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected function DefaultIt() |
|
|
|
protected function DefaultIt() |
|
|
|