Skip to content

Commit 1b4a12e

Browse files
committed
Allow to use multitool and supertool in EPA to fix the hologram computer, ref #325
1 parent 61f1d9e commit 1b4a12e

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

scripts_src/epa/epai17.ssl

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#define LVAR_Herebefore (4)
1717
#define LVAR_Problem (5)
1818
#define LVAR_Personal_Enemy (6)
19+
/**
20+
* Minimal Repair skill level to fix the terminal
21+
*/
22+
#define MIN_REPAIR_LEVEL 41
1923

2024
procedure start;
2125
procedure use_skill_on_p_proc;
@@ -34,31 +38,45 @@ procedure start
3438
begin
3539
end
3640

37-
procedure use_skill_on_p_proc
38-
begin
39-
if (action_being_used == SKILL_REPAIR) then
40-
begin
41-
if (has_skill(source_obj, SKILL_REPAIR) > 40) then
42-
begin
43-
if (local_var(LVAR_Problem) == 1) then
44-
begin
45-
script_overrides;
41+
/**
42+
* Fixes the terminal if `skill_level >= MIN_REPAIR_LEVEL`
43+
*/
44+
procedure repair_self(variable skill_level) begin
45+
if (skill_level >= MIN_REPAIR_LEVEL) then begin
46+
if (local_var(LVAR_Problem) == 1) then begin
4647
set_global_var(GVAR_MAGNETIC_FIELD, 1);
4748
set_local_var(LVAR_Problem, 2);
4849
float_msg(source_obj, mstr(108), FLOAT_MSG_YELLOW);
4950
display_msg(mstr(109));
5051
give_xp(100);
5152
end else if (local_var(LVAR_Problem) == 2) then begin
52-
script_overrides;
5353
display_msg(message_str(SCRIPT_EPAI2, 115));
5454
end
5555
end else begin
56-
script_overrides;
5756
display_msg(message_str(SCRIPT_EPAI2, 108));
5857
end
59-
end
6058
end
6159

60+
61+
procedure use_skill_on_p_proc begin
62+
if (action_being_used == SKILL_REPAIR) then begin
63+
call repair_self(has_skill(source_obj, SKILL_REPAIR));
64+
end
65+
end
66+
67+
procedure use_obj_on_p_proc begin
68+
variable tool = obj_pid(obj_being_used_with);
69+
if (tool == PID_MULTI_TOOL) or (tool == PID_SUPER_TOOL_KIT) then begin
70+
variable skill = has_skill(source_obj, SKILL_REPAIR);
71+
variable bonus = 0;
72+
if (tool == PID_MULTI_TOOL) then bonus = 20;
73+
if (tool == PID_SUPER_TOOL_KIT) then bonus = 40;
74+
script_overrides;
75+
call repair_self(skill + bonus);
76+
end
77+
end
78+
79+
6280
procedure look_at_p_proc
6381
begin
6482
script_overrides;

0 commit comments

Comments
 (0)