mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added new HOOK_EXPLOSIVETIMER (#175)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Example implementation of the algorithm of the game engine setting the timer of explosives.
|
||||
*/
|
||||
|
||||
#include "..\..\scripting_docs\headers\define_lite.h"
|
||||
|
||||
procedure start;
|
||||
|
||||
procedure start begin
|
||||
if (init_hook == 0) then begin
|
||||
variable
|
||||
time := get_sfall_arg,
|
||||
result := ROLL_CRITICAL_FAILURE;
|
||||
|
||||
if has_trait(TRAIT_PERK, dude_obj, PERK_demolition_expert_perk) then
|
||||
result := ROLL_SUCCESS;
|
||||
else begin
|
||||
result := roll_vs_skill(dude_obj, SKILL_TRAPS, 0);
|
||||
end
|
||||
|
||||
if (result) then begin
|
||||
if (result == ROLL_FAILURE) then
|
||||
time /= 2;
|
||||
else begin // success or critical success
|
||||
result := ROLL_SUCCESS;
|
||||
end
|
||||
end else begin // critical failure
|
||||
time := 0;
|
||||
result := ROLL_FAILURE;
|
||||
end
|
||||
|
||||
set_sfall_return(time);
|
||||
set_sfall_return(result); // failure/success
|
||||
end
|
||||
end
|
||||
@@ -53,6 +53,7 @@
|
||||
#define HOOK_RESTTIMER (30)
|
||||
#define HOOK_GAMEMODECHANGE (31)
|
||||
#define HOOK_USEANIMOBJ (32)
|
||||
#define HOOK_EXPLOSIVETIMER (33)
|
||||
|
||||
//Valid arguments to list_begin
|
||||
#define LIST_CRITTERS (0)
|
||||
|
||||
Reference in New Issue
Block a user