Backported "item_make_explosive" script function

Updated documents for the function.
Removed deprecated "register" keyword.
This commit is contained in:
NovaRain
2023-03-10 21:08:05 +08:00
parent 13445a1b83
commit 736c2cb6fe
10 changed files with 214 additions and 7 deletions
+2 -1
View File
@@ -52,7 +52,7 @@
#define HOOK_INVENTORYMOVE (24)
#define HOOK_INVENWIELD (25)
#define HOOK_ADJUSTFID (26)
//#define HOOK_COMBATTURN (27) // unimplemented
//#define HOOK_COMBATTURN (27) // unimplemented
#define HOOK_CARTRAVEL (28)
#define HOOK_SETGLOBALVAR (29)
#define HOOK_RESTTIMER (30)
@@ -348,6 +348,7 @@
#define intface_redraw sfall_func0("intface_redraw")
#define intface_show sfall_func0("intface_show")
#define inventory_redraw(invSide) sfall_func1("inventory_redraw", invSide)
#define item_make_explosive(pid, activePid, min, max) sfall_func4("item_make_explosive", pid, activePid, min, max)
#define item_weight(obj) sfall_func1("item_weight", obj)
#define lock_is_jammed(obj) sfall_func1("lock_is_jammed", obj)
#define loot_obj sfall_func0("loot_obj")
+12 -1
View File
@@ -286,7 +286,7 @@ FUNCTION REFERENCE
-----
##### `array get_explosion_damage(itemPid)`
- Returns an array of the minimum and maximum damage of Dynamite or Plastic Explosives.
- Returns an array of the minimum and maximum damage of the explosive item.
-----
##### `void set_dynamite_damage(minDmg, maxDmg)`
@@ -682,6 +682,17 @@ sfall_funcX metarule functions
- Redraws inventory list in the inventory/use inventory item on/loot/barter screens
- `invSide` specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens), -1 - both sides (same as without argument)
----
#### item_make_explosive
`void sfall_func3("item_make_explosive", int pid, int activePid, int damage)`\
`void sfall_func4("item_make_explosive", int pid, int activePid, int min, int max)`
- Makes the specified item (pid) an explosive item like Dynamite or Plastic Explosives
- `activePid` is for an item with an active timer, can be the same as the `pid` argument
- The item proto must be the **Misc Item** type and have the **Use** action flag
- `min` and `max` are the minimum and maximum explosion damage
- Using the function on an item that is already set as an explosive will override its previous settings
- __NOTE:__ this function does not work for pid's of Dynamite and Plastic Explosives
----
#### get_string_pointer
`int sfall_func1("get_string_pointer", string text)`