Skip to content

Commit

Permalink
gl_k_alcohl.ssl: remove extra var, fix wrong placement, ref #298
Browse files Browse the repository at this point in the history
  • Loading branch information
burner1024 committed Jul 3, 2024
1 parent f8e61ae commit 137d667
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts_src/global/gl_k_alcohl.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,21 @@ variable msg;
* @arg {ObjPtr} item - item being used
*/
procedure drink(variable who, variable item) begin
variable roll, chance, last_drink_date, time_since_last_drink;
variable roll, chance, time_since_last_drink;

// target is not PC
if (who != dude_obj) then return;
// not alcohol
if not is_alcohol(item) then return;

// PC is drinking
last_drink_date = get_sfall_global_int(SGVAR_last_drink_date);
time_since_last_drink = game_time - get_sfall_global_int(SGVAR_last_drink_date);
set_sfall_global(SGVAR_last_drink_date, game_time);

// already addicted
if (global_var(GVAR_ALCOHOL_ADDICT) == 1) then return;

// regular drinking increases chances
time_since_last_drink = game_time - last_drink_date;
if (time_since_last_drink >= TIME_ALCOHOL_USAGE_SPORADIC) then begin
chance = 1;
end else if (time_since_last_drink >= TIME_ALCOHOL_USAGE_MEDIUM) then begin
Expand Down

0 comments on commit 137d667

Please sign in to comment.