예제 #1
0
protected func Initialize()
{
	// Show wealth in HUD.
	GUI_Controller->ShowWealth();
	
	// Rules: team account and buying at flagpole.
	CreateObject(Rule_TeamAccount);
	CreateObject(Rule_BuyAtFlagpole);
	
	// Goal: Sell Gems, amount depends on difficulty and initial availability.
	var gems = (4 * GetMaterialCount(Material("Ruby"))) / (5 * GetMaterialVal("Blast2ObjectRatio", "Material", Material("Ruby")));
	gems += (4 * GetMaterialCount(Material("Amethyst"))) / (5 * GetMaterialVal("Blast2ObjectRatio", "Material", Material("Amethyst")));
	var percentage = 55 + 15 * SCENPAR_Difficulty;
	var goal = CreateObject(Goal_SellGems);
	goal->SetTargetAmount((gems * percentage) / 100);
	
	// Initialize different parts of the scenario.
	InitEnvironment(SCENPAR_Difficulty);
	InitVegetation();
	InitAnimals();
	InitResources(SCENPAR_Difficulty);
	InitMainIsland(4 - SCENPAR_Difficulty);
	InitIslands(4 - SCENPAR_Difficulty);
		
	return;
}
예제 #2
0
파일: Script.c 프로젝트: lluchs/ClonkMars
global func CreateBurnMark(int iX, int iY, int iLevel, int Count) 
{
  var boom;
  if(!ObjectCount(BOOM)) boom = CreateObject(BOOM,0,0,-1);
  else boom = FindObject(BOOM);
  
  var angle=Random(360/Count); //variablen für die überprüfung
  var type;
  for(var z; z < Count; z++)
	{
    angle += Max(1,360/Count);

    // Check: Sky or Solid/Liquid
    var x = iX+Cos(angle,iLevel);
    var y = iY+Sin(angle,iLevel);
    if((GetMaterialVal("Density","Material",GetMaterial(x,y)) != 0) || (GetMaterial(x,y) == -1))
      continue;

    type = 1+Random(3);
    var size = BurnMarkCheck(angle,RandomX(iLevel/2,iLevel*2),iX,iY);
    var sin = Sin(angle,(size-iLevel)/2+iLevel+Random(3));
    var cos = Cos(angle,(size-iLevel)/2+iLevel+Random(3));

    CreateParticle("BurnMark",iX+cos,iY+sin,Cos(angle+RandomX(-5,5),50),Sin(angle+RandomX(-5,5),50),size*5+Random(25),RGBa(0,0,0,64),boom,1); 
  }
}
예제 #3
0
/** Removes a material pixel from the specified location, if the material is flammable
	@param x X coordinate. Offset if called in object context.
	@param y Y coordinate. Offset if called in object context.
	@return true if material was removed, false otherwise. */
global func FlameConsumeMaterial(int x, int y)
{
	var mat = GetMaterial(x, y);
	if (mat == -1)
		return false;
	if (!GetMaterialVal("Inflammable", "Material", mat))
		return false;
	return !!ExtractMaterialAmount(x, y, mat, 1);
}
예제 #4
0
/** Tries to remove amount material pixels from the specified location if the material is a liquid.
	@param x X coordinate
	@param y Y coordinate
	@param amount amount of liquid that should be extracted
	@param distant_first If true, extraction position takes largest horizontal distance from given offset at same height to a maximum value of MaxSlide. Useful to ensure that no floor of 1px of liquid remains.
	@return an array with the first position being the material index being extracted and the second the
			actual amount of pixels extracted OR nil if there was no liquid at all */
global func ExtractLiquidAmount(int x, int y, int amount, bool distant_first)
{
	var mat = GetMaterial(x, y);
	if(mat == -1)
		return nil;
	var density = GetMaterialVal("Density", "Material", mat);
	if (density < C4M_Liquid || density >= C4M_Solid)
		return nil;
	var extracted_amount = ExtractMaterialAmount(x, y, mat, amount, distant_first);
	if (extracted_amount <= 0)
		return nil;
	return [mat, extracted_amount];
}
예제 #5
0
파일: Script.c 프로젝트: lluchs/ClonkMars
global func BurnMarkCheck(int angle,int size, int iX, int iY)
{
  var sin = Sin(angle,size);
  var cos = Cos(angle,size);
  var x = cos, y = sin, i=100;

  while(GetMaterial(iX+x,iY+y) == -1 || GetMaterialVal("Density","Material",GetMaterial(iX+x,iY+y)) != 0)
	{
    x = cos*i/100;
    y = sin*i/100;
    if(i <= 0) return 0;
    i-=10;
  }

  return size;
}
예제 #6
0
func Rain(){
  var vx = GetWind(0, 3) / 10, vy = 150 - Min(GetMaterialVal("WindDrift", "Material", mat), 100)*3/2;
  InsertMaterial(mat, Random(LandscapeWidth()), 0, vx, vy);
  ScheduleCall(this, "Rain", RandomX(5, 10), 0);
}