forked from Mirrors/openclonk
added Place()-function to sea weed
parent
fb1ee2f88f
commit
fe04a0fe79
|
@ -2,6 +2,24 @@
|
|||
|
||||
#include Library_Plant
|
||||
|
||||
|
||||
func Place(int amount, proplist rectangle, proplist settings)
|
||||
{
|
||||
var max_tries = 2 * amount;
|
||||
var loc_area = nil;
|
||||
if (rectangle) loc_area = Loc_InRect(rectangle);
|
||||
|
||||
while ((amount > 0) && (--max_tries > 0))
|
||||
{
|
||||
var spot = FindLocation(Loc_Material("Water"), Loc_Wall(CNAT_Bottom), loc_area);
|
||||
if (!spot) continue;
|
||||
|
||||
var f = CreateObject(this, spot.x, spot.y, NO_OWNER);
|
||||
--amount;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private func Initialize()
|
||||
{
|
||||
SetAction("Sway");
|
||||
|
|
Loading…
Reference in New Issue