Skip to content

Commit

Permalink
KvStore now has a way for other packages to access it without a depen…
Browse files Browse the repository at this point in the history
…dency
  • Loading branch information
scraphammer committed Jun 5, 2022
1 parent 84aeb50 commit 7fc23b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions Classes/KvStore.uc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ replication {
globalKeys, globalValues, globalKVLength;
}

function string inventoryCapsString(name property, Pawn other, Actor test) {
if (Inventory(test) == none) return "";
switch (Inventory(test).autoSwitchPriority) {
case 1: //global
return get(Inventory(test).itemName, false, Inventory(test).bActivatable);
case 2: //cascading
return getCascading(Inventory(test).itemName, Inventory(test).bActivatable);
default: //personal
return get(Inventory(test).itemName, true, Inventory(test).bActivatable);
}
}

function destroyed() {
local KvStore kvs;
local int i;
Expand Down
6 changes: 3 additions & 3 deletions Classes/KvTemplatedTranslatorEvent.uc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function trigger(Actor other, Pawn eventInstigator) {
if (event != '') triggerEvent(event, self, eventInstigator);
}

function string filterMessage(Actor other) {
static final function string filterMessage(Actor other, string message, string templateString, KvTemplatedTranslatorEventReplacement replacements[8]) {
local PlayerPawn p;
local Inventory inventory;
local int i;
Expand All @@ -94,7 +94,7 @@ function string filterMessage(Actor other) {
}

if (kvs == none) {
kvs = spawn(class'KvStore');
kvs = other.spawn(class'KvStore');
kvs.touch(p);
}

Expand Down Expand Up @@ -196,7 +196,7 @@ function touch(Actor other){
}
if (!bHitOnce) Trans.bNewMessage = true;
else Trans.bNotNewMessage = true;
Trans.NewMessage = filterMessage(other);
Trans.NewMessage = filterMessage(other, message, templateString, replacements);
if (!bHitOnce) Pawn(Other).ClientMessage(M_NewMessage);
else Pawn(Other).ClientMessage(M_TransMessage);
bHitOnce = true;
Expand Down

0 comments on commit 7fc23b7

Please sign in to comment.