mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Edited description of CheckWeaponAmmoCost and HOOK_AMMOCOST
This commit is contained in:
+1
-1
@@ -643,7 +643,7 @@ ExplosionsEmitLight=0
|
||||
;Set to 0 for backward compatibility with pre-3.4 scripts
|
||||
arraysBehavior=1
|
||||
|
||||
;Set to 1 to add proper checks if there is enough ammo to use weapons that use multiple ammo per shot
|
||||
;Set to 1 to add proper checks to see if there is enough ammo to attack with weapons that use multiple ammo per shot
|
||||
CheckWeaponAmmoCost=0
|
||||
|
||||
;Controls the speed of combat panel animations (lower - faster; valid range: 0..65535)
|
||||
|
||||
@@ -16,7 +16,7 @@ list[5] := "Value";
|
||||
```
|
||||
|
||||
There are 2 different types of arrays currently available:
|
||||
* Lists - a set of values with specific size (number of elements), where all elements have numeric indexes starting from zero (0) up to array length minus one.
|
||||
* **Lists** - a set of values with specific size (number of elements), where all elements have numeric indexes starting from zero (0) up to array length minus one.
|
||||
|
||||
For example:
|
||||
```js
|
||||
@@ -29,7 +29,7 @@ There are 2 different types of arrays currently available:
|
||||
- to assign value to a specific index, you must first resize array to contain this index
|
||||
(for example, if list is of size 3 (indexes from 0 to 2), you can't assign value to index 4 unless you change list size to 5 first).
|
||||
|
||||
* Maps (or associative arrays) - a set of key=>value pairs, where all elements (values) are accessed by corresponding keys.
|
||||
* **Maps** (or associative arrays) - a set of key=>value pairs, where all elements (values) are accessed by corresponding keys.
|
||||
|
||||
Differences from list:
|
||||
- maps don't have specific size (to assign values, you don't need to resize array first);
|
||||
@@ -156,15 +156,14 @@ end
|
||||
___
|
||||
### ARRAY OPERATORS REFERENCE
|
||||
|
||||
**mixed means any type*
|
||||
_*mixed means any type_
|
||||
|
||||
**`int create_array(int size, int flags)`**
|
||||
- creates permanent array (but not "saved")
|
||||
- if `size >= 0`, creates list with given size
|
||||
- if `size == -1`, creates map (associative array)
|
||||
- if `size == -1` and `flags == 2`, creates a "lookup" map (associative array) in which the values of existing keys are read-only and can't be updated.
|
||||
This type of array allows you to store a zero (0) key value
|
||||
- NOTE: in earlier versions (up to 4.1.3/3.8.13) the second argument is not used, just use 0
|
||||
- if `size == -1` and `flags == 2`, creates a "lookup" map (associative array) in which the values of existing keys are read-only and can't be updated. This type of array allows you to store a zero (0) key value
|
||||
* NOTE: in earlier versions (up to 4.1.3/3.8.13) the second argument is not used, just use 0
|
||||
- returns array ID (valid until array is deleted)
|
||||
|
||||
**`int temp_array(int size, int flags)`**
|
||||
@@ -178,7 +177,7 @@ This type of array allows you to store a zero (0) key value
|
||||
- if used on list, "key" must be numeric and within valid index range (0..size-1)
|
||||
- if used on map, key can be of any type
|
||||
- to "unset" a value from map, just set it to zero (0)
|
||||
- NOTE: to add a value of 0 for the key, use the float value of 0.0
|
||||
* NOTE: to add a value of 0 for the key, use the float value of 0.0
|
||||
- this works exactly like statement: `arrayID[key] := value;`
|
||||
|
||||
**`mixed get_array(int arrayID, mixed key)`**
|
||||
|
||||
@@ -327,7 +327,7 @@ Runs when retrieving the damage rating of the player's used weapon. (Which may b
|
||||
|
||||
int arg0 - The default min damage
|
||||
int arg1 - The default max damage
|
||||
Item arg2 - The weapon used. (0 if unarmed)
|
||||
Item arg2 - The weapon used (0 if unarmed)
|
||||
Critter arg3 - The critter doing the attacking
|
||||
int arg4 - The type of attack
|
||||
int arg5 - non-zero if this is an attack using a melee weapon
|
||||
@@ -343,13 +343,16 @@ Runs when calculating ammo cost for a weapon. Doesn't affect damage, only how mu
|
||||
By default, weapon will shoot when at least 1 round is left, regardless of ammo cost calculations.
|
||||
To add proper check for ammo before shooting and proper calculation of number of burst rounds (hook type 1 and 2 in arg4), set Misc.CheckWeaponAmmoCost=1 in ddraw.ini
|
||||
|
||||
Item arg0 - weapon
|
||||
int arg1 - Number of bullets in burst (1 for single shots)
|
||||
int arg2 - Ammo cost calculated by original function (this is basically 2 for Super Cattle Prod and Mega Power Fist)
|
||||
int arg3 - Type of hook (0 - when subtracting ammo after single shot attack, 1 - when checking for "out of ammo" before attack, 2 - when calculating number of burst rounds, 3 - when subtracting ammo after burst attack)
|
||||
Item arg0 - The weapon
|
||||
int arg1 - Number of bullets in burst or 1 for single shots
|
||||
int arg2 - The amount of ammo that will be consumed, calculated by the original ammo cost function (this is basically 2 for Super Cattle Prod and Mega Power Fist)
|
||||
int arg3 - Type of hook:
|
||||
0 - when subtracting ammo after single shot attack
|
||||
1 - when checking for "out of ammo" before attack
|
||||
2 - when calculating number of burst rounds
|
||||
3 - when subtracting ammo after burst attack
|
||||
|
||||
int ret0 - new ammo cost value (set to 0 for unlimited ammo)
|
||||
NOTE: for hook type 2, you should return the new cost value based on the original ammo cost instead of the number of bullets
|
||||
int ret0 - The new amount of ammo to be consumed, or ammo cost of each round for hook type 2 (set to 0 for unlimited ammo)
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user