Category: Landscape
/ Material
Since engine version: 1.0 OC
InsertMaterial
Description
Inserts a material pixel at the given position and given speed.
Syntax
bool InsertMaterial(int material_index, int x, int y, int xdir, int ydir, proplist out_insertpos);
Parameters
- material_index:
- Material to be inserted (see Material()).
- x:
- [opt] X insert position or offset
- y:
- [opt] Y insert position or offset
- xdir:
- [opt] horizontal speed of material pixel to be inserted
- ydir:
- [opt] vertical speed of material pixel to be inserted
- out_insertpos:
- [opt] If a writeable proplist is passed, members x and y are filled with the actual insertion position.
Remarks
If the target position already contains material of the same density as the inserted material, the engine will search upwards for a proper insertion position.
If the target position is outside the landscape (either because one of the parameters is outside the map or because insertion position search found such a position), no material is inserted. The function still returns success if the out-of-landscape position has the same or lower density than the inserted pixel. Out-of-landscape densities are controlled by *Open-parameters in the Scenario.txt [Landscape] section.
For the sake of material insertion calculations, all densities above C4M_Solid are considered the same.
See also: Material