Ejemplo n.º 1
0
func FxCheckComDirTimer(target, fx, time)
{
	if (GetPlayerControlState(GetOwner(), CON_Left) && (GetComDir() != COMD_Left) && !GetContact(-1, CNAT_Left))
	{
		SetComDir(COMD_Left);
		return -1;
	}
	if (GetPlayerControlState(GetOwner(), CON_Right) && (GetComDir() != COMD_Right) && !GetContact(-1, CNAT_Right))
	{
		SetComDir(COMD_Right);
		return -1;
	}
}
Ejemplo n.º 2
0
private func Activity() {
  var pBait;
  // Ein Köder in der Nähe?
  if (pBait=FindObject(0,-1000,-1250,2000,1500, OCF_InLiquid(), "Bait" ) )
    // Schwarze Fische sind nicht wählerisch
    SetCommand(this(),"Follow",pBait);

  // Schwimmverhalten
  if (!GBackLiquid (0, -8)) return (SetComDir (COMD_Down ()));
  if (Random(2)) return(1);
  if (SEqual(GetAction(),"Walk")) WalkDir();
  if (Not( SEqual(GetAction(),"Swim") )) return(1);
  if (Random(2)) return(TurnRight(),SetComDir(COMD_Right()));
  return(TurnLeft(),SetComDir(COMD_Left()));
}
Ejemplo n.º 3
0
// Player pressed da button.
func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool repeat, bool release)
{
	if (release) return true;
	var xdir=0, ydir=0, comd;
	if (ctrl == CON_Up)
		{ ydir = -1; comd = COMD_Up; }
	else if (ctrl == CON_Down)
		{ ydir = +1; comd = COMD_Down; }
	else if (ctrl == CON_Left)
		{ xdir = -1; comd = COMD_Left; }
	else if (ctrl == CON_Right)
		{ xdir = +1; comd = COMD_Right; }
	else
		return true; // block anything else
	var is_drawing = (GetAction() == "Draw");
	// No direct turnaround
	if (is_drawing && xdir * GetXDir() + ydir * GetYDir() < 0) { Sound("GIDL_Clonk::GIDLTurnError", true, 100, plr); return true; }
	Sound("GIDL_Clonk::GIDLTurn");
	var speed = ActMap.Draw.Speed / 10;
	if (is_drawing) Drawing();
	SetComDir(comd);
	if (is_drawing) { SetXDir(xdir*speed); SetYDir(ydir*speed); }
	SetR(Angle(0,0,xdir, ydir));
	return true;
}
Ejemplo n.º 4
0
func Completion()
{
  Sound("Fire");
  SetAction("Burn1");
  SetPhase(Random(14));
  SetComDir(COMD_Down());
  return(1);
}
Ejemplo n.º 5
0
func Activate()
{
  SetComDir(COMD_Stop(),Contained());
  CreateMenu(NANO,Contained(),0,0,0,0,1);
  AddMenuItem("Selbst Injekzieren","Inject",GetID(Contained()),Contained());
  
  if(FindObject2(Find_Distance(15),Find_Exclude(Contained()),Find_OCF(OCF_Alive())))
  {
   for(next in FindObjects(Find_Distance(15),Find_Exclude(Contained()),Find_OCF(OCF_Alive())))
   {
    AddMenuItem(Format("%s von %s Injekzieren",GetName(next),GetPlayerName(GetOwner(next))),"OtherInject",GetID(next),Contained(),0,next,"Naniten Injekzieren");
   }
   return(1);
  }
  return(1);
}
Ejemplo n.º 6
0
func Construction()
{
	// general stuff	
	StartGrowth(15);
	current_angle = Random(360);
	current_speed = RandomX(SwimMaxSpeed/5, SwimMaxSpeed);
	
	var len = GetAnimationLength("Swim");
	swim_animation = PlayAnimation("Swim", 5, Anim_Linear(0, 0, len, 100, ANIM_Loop), Anim_Const(500));
	UpdateSwim();
	
	SetAction("Swim");
	SetComDir(COMD_None);
	ScheduleCall(this, this.InitActivity,  1 + Random(10), 0);
	AddTimer(this.UpdateSwim, 2);
	InitFuzzyRules();
	
	return _inherited(...);
}
Ejemplo n.º 7
0
func Initialize()
{
	SetCategory(0);
	
	AddTimer("SwimAround", 15);
	SetAction("Swim");
	SetComDir(COMD_None);
	
	var particles = 
	{
		Size = PV_Sin(PV_Step(PV_Random(1, 2)), PV_Random(0, 1), PV_Random(1,2)),
		Attach = ATTACH_MoveRelative,
		Alpha = 100
	};
	particles = Particles_Colored(particles, HSL(Random(255), 100, 75));
	
	var amount = RandomX(5, 10);
	CreateParticle("SphereSpark", PV_Random(-3, 3), PV_Random(-3, 3), 0, 0, 0, particles, amount);
}
Ejemplo n.º 8
0
protected func Initialize() {
  SetAction("Walk");
  SetComDir(COMD_Stop());
}
Ejemplo n.º 9
0
protected func Initialize()
{
	SetAction("Door");
	SetComDir(COMD_Stop);
	return;
}
Ejemplo n.º 10
0
func FxCheckComDirStart(target, fx, temp)
{
	if (temp) return;
	SetComDir(COMD_None);
}
Ejemplo n.º 11
0
func Initialize()
{
	SetAction("Fly");
	SetComDir(COMD_None);
}
Ejemplo n.º 12
0
// Called by the elevator
func Connect(object connect_to)
{
	elevator = connect_to;
	SetComDir(COMD_None);
	SetAction("DriveIdle");
}