Exemple #1
0
func FxLaraWalkingTimer(object c, proplist fx, int time)
{
	var speed_factor = 50;
	// Interrupted by dialogue?
	if (FrameCounter() < this.anim_continue_frame) return FX_OK;
	// No player joined? Stay in place for proper scenario saving.
	if (!GetPlayerCount()) return FX_OK;
	// Busy lifting/dropping?
	if (GetEffect("IntLiftHeavy", c)) return FX_OK;
	if (GetEffect("IntDropHeavy", c)) return FX_OK;
	// Do we have something to carry?
	if (!fx.carry_obj)
	{
		// Relax for a random time...
		if (!Random(10))
			// ...and search new work after
			fx.carry_obj = fx.last_barrel = Lara_FindCarryObj(c, fx);
	}
	if (fx.carry_obj)
	{
		// need to pick it up?
		if (fx.carry_obj->Contained() != c)
		{
			// need to walk there?
			var dist = Abs(fx.carry_obj->GetX() - c->GetX());
			if (dist < 10)
			{
				// pick up!
				c->SetCommand("None");
				c->SetComDir(COMD_Stop);
				// short break - then pick up.
				if (c->GetXDir()) return FX_OK;
				c->SetXDir();
				fx.carry_obj->Enter(c);
				// find a target
				fx.target_pos = [[220+Random(11), 311], [495+Random(51),358]][fx.carry_obj->GetX() < 350];
			}
			else 
			{
				// we're close. slow down.
				if (dist < 40) speed_factor = 30;