func Place(int amount, proplist area, proplist settings) { var max_tries = 2 * amount; var loc_area = nil; if (area) loc_area = Loc_InArea(area); while ((amount > 0) && (--max_tries > 0)) { var spot = FindLocation(Loc_Material("Water"), Loc_Wall(CNAT_Bottom), loc_area); if (!spot) continue; var f = CreateObjectAbove(this, spot.x, spot.y, NO_OWNER); --amount; } return true; }
func Place(int amount, proplist area, proplist settings) { var max_tries = 2 * amount; var loc_area = nil; if (area) loc_area = Loc_InArea(area); while ((amount > 0) && (--max_tries > 0)) { var spot = FindLocation(Loc_Material("Water"), Loc_Wall(CNAT_Bottom | CNAT_Top | CNAT_Left | CNAT_Right), loc_area); if (!spot) continue; var plant = CreateObject(this, spot.x, spot.y, NO_OWNER); plant->SetClrModulation(HSL(Random(255), 255, 200)); plant->AddFork(nil, true); --amount; } return true; }