예제 #1
0
func InitializePlayer(int plr)
{
	// Harsh zoom range
	for (var flag in [PLRZOOM_LimitMax, PLRZOOM_Direct])
		SetPlayerZoomByViewRange(plr,500,350,flag);
	SetPlayerViewLock(plr, true);
	// First player init base
	if (!g_was_player_init)
	{
		InitBase(plr);
		g_was_player_init = true;
	}
	// Position and materials
	var i, crew;
	for (i=0; crew=GetCrew(plr,i); ++i)
	{
		crew->SetPosition(100+Random(80), 192-10);
		crew->CreateContents(Shovel);
		if (!i)
		{
			crew->CreateContents(Hammer);
		}
		else if (i==1)
		{
			crew->CreateContents(Axe);
		}
	}
	return true;
}
예제 #2
0
func Initialize()
{
	if (g_camera) FatalError("OMG two cameras!");
	g_camera = this;
	// Make action modifyable
	this.ActMap = {Prototype = Camera.ActMap };
	this.ActMap.Fly = {Prototype = Camera.ActMap.Fly };
	SetAction("Fly");
	for (var i=0; i<GetPlayerCount(C4PT_User); ++i)
		SetPlrView(GetPlayerByIndex(i, C4PT_User), this);
	SetPlayerViewLock(NO_OWNER, true);
}
예제 #3
0
파일: Script.c 프로젝트: 772/openclonk
func InitializePlayer(int plr)
{
	// Players only
	if (GetPlayerType(plr)!=C4PT_User) return;
	// Scenario init
	if (!g_is_initialized) g_is_initialized = DoInit(plr);
	// Harsh zoom range
	for (var flag in [PLRZOOM_LimitMax, PLRZOOM_Direct])
		SetPlayerZoomByViewRange(plr,400,250,flag);
	SetPlayerViewLock(plr, true);
	// Create per-player-counted tools
	if (g_max_player_num < GetPlayerCount(C4PT_User))
	{
		++g_max_player_num;
		for (var obj in FindObjects(Find_ID(Chest)))
			if (obj.tool_spawn)
				obj->CreateContents(obj.tool_spawn);
	}
예제 #4
0
파일: Script.c 프로젝트: 772/openclonk
func InitializePlayer(int plr)
{
	// Players only
	if (GetPlayerType(plr)!=C4PT_User) return;
	// Scenario init
	if (!g_is_initialized) g_is_initialized = DoInit(plr);
	// Harsh zoom range
	for (var flag in [PLRZOOM_LimitMax, PLRZOOM_Direct])
		SetPlayerZoomByViewRange(plr,400,250,flag);
	SetPlayerViewLock(plr, true);
	// Initial join
	var crew = GetCrew(plr);
	crew->SetPosition(35 + Random(10) , 1140);
	crew->SetDir(DIR_Right);
	crew->CreateContents(Shovel);
	crew->CreateContents(Hammer);
	crew->CreateContents(Axe);
	return true;
}
예제 #5
0
파일: Intro.c 프로젝트: Fulgen301/openclonk
global func IntroAddPlayer(int plr)
{
	var effect = GetEffect("IntIntro");
	if(!effect) return false;
	if(effect.Time > 30) return false;

	var crew;
	for(var index = 0; crew = GetCrew(plr, index); ++index)
	{
	        var skin = crew->GetCrewExtraData("Skin");
        	if (skin == nil) skin = GetPlrClonkSkin(plr);

		var container = effect.Cabin->CreateContents(Clonk);
		container->SetOwner(plr);
		if(skin != nil) container->SetSkin(skin);
		container->SetName(crew->GetName());
		container->SetAction("Walk");
		crew->Enter(container);

		container.ActMap = { Prototype = Clonk.ActMap };
		container.ActMap.Walk = { Prototype = Clonk.ActMap.Walk, Decel = 100 };
		container.ActMap.Jump = { Prototype = Clonk.ActMap.Jump, Speed = 0, Accel = 0 };
		container.JumpSpeed = 0;

		SetPlrView(plr, crew);
		SetPlayerViewLock(plr, true);
		SetPlayerZoomByViewRange(plr, 320, 240);

		container->SetCommand("None", container);
		crew->SetCommand("None", crew);

		// Give everyone but the first player a shovel -- the first
		// player's shovel can be found in the valley
		if(GetLength(effect.Players) != 0)
			crew->CreateContents(Shovel);

		effect.Players[GetLength(effect.Players)] = crew;
	}

	return true;
}