Backported game hooks from 4.0.x

* COMBATTURN is not implemented.

Updated documents.
This commit is contained in:
NovaRain
2022-11-26 09:57:01 +08:00
parent f4666dad18
commit 4f34217625
12 changed files with 276 additions and 32 deletions
+1 -1
View File
@@ -146,7 +146,7 @@
//#define RMOBJ_AI_USE_DRUG_ON_2 4360176 // same as RMOBJ_AI_USE_DRUG_ON (obsolete, use only for sfall before 4.3.1/3.8.31)
#define RMOBJ_BARTER_ARMOR 4675656 // removing armor from NPC's slot before entering the barter screen
#define RMOBJ_BARTER_WEAPON 4675722 // removing weapon from NPC's slot before entering the barter screen
#define RMOBJ_INVEN_DROP_CAPS 4667295 // if money/caps are dropped manually by the player from the inventory screen
#define RMOBJ_INVEN_DROP_CAPS 4667295 // if multiple money/caps are dropped manually by the player from the inventory screen
#define RMOBJ_DROP_INTO_CONTAINER 4678833 // when dropping items into a container item (bag/backpack)
// old defines
#define RMOBJ_RM_MULT_OBJS RMOBJ_ITEM_REMOVED_MULTI
+4
View File
@@ -52,6 +52,10 @@
#define HOOK_INVENTORYMOVE (24)
#define HOOK_INVENWIELD (25)
#define HOOK_ADJUSTFID (26)
//#define HOOK_COMBATTURN (27) // unimplemented
#define HOOK_CARTRAVEL (28)
#define HOOK_SETGLOBALVAR (29)
#define HOOK_RESTTIMER (30)
#define HOOK_GAMEMODECHANGE (31)
// Valid arguments to list_begin
+42
View File
@@ -582,6 +582,48 @@ int ret0 - overrides the calculated FID with provided value
-------------------------------------------
#### `HOOK_CARTRAVEL (hs_cartravel.int)`
Runs continuously during worldmap travel on car.
```
int arg0 - vanilla car speed (between 3 and 8 "steps")
int arg1 - vanilla fuel consumption (100 and below)
int ret0 - car speed override (pass -1 if you just want to override fuel consumption)
int ret1 - fuel consumption override
```
-------------------------------------------
#### `HOOK_SETGLOBALVAR (hs_setglobalvar.int)`
Runs when setting the value of a global variable.
```
int arg0 - the index number of the global variable being set
int arg1 - the set value of the global variable
int ret0 - overrides the value of the global variable
```
-------------------------------------------
#### `HOOK_RESTTIMER (hs_resttimer.int)`
Runs continuously while the player is resting (using pipboy alarm clock).
```
int arg0 - the game time in ticks
int arg1 - event type: 1 - when the resting ends normally, -1 - when pressing ESC to cancel the timer, 0 - otherwise
int arg2 - the hour part of the length of resting time
int arg3 - the minute part of the length of resting time
int ret0 - pass 1 to interrupt the resting, pass 0 to continue the rest if it was interrupted by pressing ESC key
```
-------------------------------------------
#### `HOOK_GAMEMODECHANGE (hs_gamemodechange.int)`
Runs once every time when the game mode was changed, like opening/closing the inventory, character screen, pipboy, etc.