On this page
Kits, pickups and supplies
A kit is not a property of a soldier. It is an object the soldier holds: it has a template, a team and a mesh, it can lie on the ground, and somebody else can pick it up. The things that give a soldier back what he used up (an ammunition bag, a medic's pack, a supply crate, a repair station) are one more kind of object with one loop. This page covers both.
The kit#
ObjectTemplate.Kit (template bf2_w32ded.exe!0x0055d2a0, object 0x0055dac0) is an item whose children are the weapons and gadgets of the class. Its own properties:
| Property | Default | Meaning |
|---|---|---|
kitType | unknown | assault, medic, sniper ..: what the HUD's icon and the scripts' statistics go by |
kitTeam | 0 | which team's kit it is |
unlockIndex | -1 | which unlock gives it |
defaultWeaponIndex | 3 | the weapon in hand at the spawn |
timeToLiveAfterDeath | 30.0 | seconds a dropped kit lies before it is removed |
sprintStaminaDissipationFactor | 1.0 | the likely source of the sprint's drain factor; the notes mark the link as unverified |
abilityRestoreRate | -1.0 | how fast the kit's ability (the medic's or engineer's aura in a vehicle) recovers |
abilityInVehicleMaterial, ...Strength, ...Radius | 0 | the kit's ability while its holder sits in a vehicle: a material, a strength, a radius |
geometry.kit, geometry.dropGeom | 0, 1 | which mesh the soldier wears and which lies on the ground |
No shipped script sets timeToLiveAfterDeath, so every dropped kit lies for exactly 30 seconds.
Dropping and picking up#
- At death the soldier drops his kit (
Kit::scheduleDespawn,0x0055c790); the server schedules its removal after the time to live, and the script hearsDropKit(player, kit). - The pickup key (the server's input processor,
0x004580c0): for a standing soldier, more than 2 seconds after his last pickup, the server looks for kits within 3 m that lie on the ground (0x00456010), takes the nearest, and hands it over only when the kit's team is the soldier's. The script hearsPickupKit(player, kit); the clients get a pickup event. - A kit of the other team within reach still counts as found, and nothing happens: an enemy's kit cannot be taken.
- The same key also tries ziplines and grappling-hook ropes near the soldier.
The key is refused, like the use key and the seat keys, while the weapon in hand cannot be put away: firing or reloading.
The notes mark the pickup path as a draft: read from the listing, not executed against the original. Open there: what the inventory does with the kit the soldier held, and where the unlock is enforced.
Supply objects#
A SupplyObject (template 0x0059b860) is anything that gives or takes health and ammunition in a radius: the medic's pack, the ammunition bag, the commander's supply crate, a repair station, and also a fire, which is a supply object with a damage speed.
| Property | Meaning |
|---|---|
radius | reach, added to the receiver's own bounding radius |
team, teamFromClosestCP | whom it serves: a team, everyone (0), or whoever holds the nearest control point |
workOnSoldiers, workOnVehicles, addVehicleType | what it serves; an empty type list is every vehicle |
healSpeed, refillAmmoSpeed, damageSpeed | per second |
healStorageSize, ammoStorageSize | how much it holds |
restoreSpeed | how fast the storage refills: size x restoreSpeed x dt x 0.05 a step |
destroyWhenEmptyStorage | a bag that is used up disappears |
Its loop (0x0059b6a0, on the server) runs from one second after the object appears, then every 0.2 seconds:
- take the team from the nearest control point, when the template says so;
- remove itself when its storage is empty and it is the kind that goes;
- soldiers: every living player's soldier of its team (or any, for team 0) within reach. A soldier in a vehicle is served only by a supply object on that same vehicle;
- vehicles: every vehicle of its team or of none, of a listed category, within reach;
- for each: ammunition first, then health. Health is
healSpeed x 0.2through the game logic's heal and repair, damagedamageSpeed x 0.2through the common damage function (damage and armor); - refill the storages.
A SupplyDepot is the fixed version at a base: a radius, a team, lists of ammunition and vehicle types.
Healing itself is armor repair by a share of the maximum hit points, scaled by a material pair: the healer's material against the receiver's. What heals what is, again, a number in the material table.
Both later games keep the kit object and the supply object. What a hero carries in Heroes, and how he is healed, is on abilities and widgets and Heroes: damage.
What the port has#
| Part | State |
|---|---|
| kit templates and the kit as an object; the drop at death | ported; the client's side of a kit dropped at death is ported for Battlefield 2 and 2142 |
| the pickup | ported from the listing (a draft in the notes); the two-second and three-metre rules as read |
| supply objects on soldiers: the timer, damage and healing | ported; the health part verified on burning fires against the original server |
| supply objects' ammunition refill and the vehicle pass | not yet, as the notes say of the server's file |
| the amounts inside the heal and refill calls | open in the notes |
How it is tested#
- Kits, from Battlefield 2's listing, each in a process of its own: a dropped kit's despawn schedule and what a kit gives a soldier (
dropped_kit_bf2.rs), a soldier who takes a kit dropping his own first (soldier_pickup_kit_bf2.rs), a fire arm's pickup (fire_arm_pickup_bf2.rs); 2142's pickup and a dropped weapon's magazines in a 2142 process. - Supply objects (
crates/bf2-server/src/damage_supply.rs): a heal that worked drains the storage, a heal that did not is not paid for.
Three of seven addresses stand in a test's text. As the table above says, the pickup is a draft in the notes and the supply objects' refill and vehicle pass are not done: those have no test against the original.
In the code#
| What | Where |
|---|---|
| ladders and ziplines (the other soldier systems) | crates/bf2-gameplay/src/soldier_systems/ |
| supply objects on the server | crates/bf2-server/src/damage_supply.rs |
| kit templates in the data | CON scripts |
| the pickup's events in Python | the Python layer |
Notes: notes/subsystems/gameplay-soldier-systems.md (sections 1, 2 and 5), notes/subsystems/players.md.
docs/dev/soldier/kits-and-supplies.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.