Skip to content

Commit

Permalink
Hunger: Set initial spoil times more sanely.
Browse files Browse the repository at this point in the history
  • Loading branch information
caligari87 committed Aug 21, 2021
1 parent 6451246 commit 77a8ba6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hunger/module/consumable/consumable_input.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ extend class UaS_Consumable {
CHAN_WEAPON, CHANF_OVERLAP,
attenuation: ATTN_STATIC);
weaponstatus[UGCS_OPEN] = UGCSF_OPENED;
if (weaponstatus[UGCS_LASTSPOILTIME] == -1) {
weaponstatus[UGCS_LASTSPOILTIME] = level.totaltime;
}
owner.A_Log(string.format("Opened %s. %s", gettag(), RandomOpenMessage()), true);
GiveContents();
}
Expand Down
2 changes: 2 additions & 0 deletions hunger/module/consumable/consumable_misc.zsc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extend class UaS_Consumable {
// 10% minor contamination +2
// 20% basic spoilage +1
// 60% nothing
if (weaponstatus[UGCS_LASTSPOILTIME] == -1) { return; }
if (weaponstatus[UGCS_LASTSPOILTIME] < level.totaltime) {
// Spoilage from external contamination if open
if (weaponstatus[UGCS_OPEN] == UGCSF_OPENED) {
Expand Down Expand Up @@ -105,6 +106,7 @@ extend class UaS_Consumable {
weaponstatus[UGCS_SPOILAGE] = random(0,100) * (frandom(0,1) * frandom(0,1));
weaponstatus[UGCS_LASTSPOILTIME] = level.totaltime;
}
else { weaponstatus[UGCS_LASTSPOILTIME] = -1; }
}

override void PostBeginPlay() {
Expand Down

0 comments on commit 77a8ba6

Please sign in to comment.