forked from Mirrors/openclonk
Merge default into rope
commit
c9f91af4d2
|
@ -1289,6 +1289,14 @@ endif()
|
|||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
# CMake support for MSVC 2010 is broken. Change the .sln file to avoid
|
||||
# millions of "reload X project?" dialog boxes.
|
||||
# For best results, also change CMake's ReloadProjects macro to only
|
||||
# call StopBuild().
|
||||
if(MSVC_VERSION EQUAL 1600)
|
||||
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln" "\n# reload me\n")
|
||||
endif()
|
||||
|
||||
############################################################################
|
||||
# installation
|
||||
############################################################################
|
||||
|
|
|
@ -35,9 +35,9 @@ public func OnProjectileHit()
|
|||
public func Burst()
|
||||
{
|
||||
DrawParticleLine("Straw",0,0,AbsX(gate->GetX()),AbsY(gate->GetY()),6,80,RGB(255,255,255),RGB(255,150,200));
|
||||
RemoveObject();
|
||||
gate->OpenDoor();
|
||||
CastParticles("Straw",130,30,0,-3,30,40,RGB(255,255,255),RGB(255,120,200));
|
||||
RemoveObject();
|
||||
}
|
||||
|
||||
public func Hit()
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/*--
|
||||
Flag Mesh
|
||||
Author: Mimmo_O
|
||||
|
||||
Special flag graphics.
|
||||
--*/
|
||||
|
||||
|
||||
#appendto Goal_Flag
|
||||
|
||||
public func SetTeam(int to_team)
|
||||
{
|
||||
if (to_team == 1)
|
||||
SetMeshMaterial("FlagLeft");
|
||||
else if (to_team == 2)
|
||||
SetMeshMaterial("FlagRight");
|
||||
return _inherited(to_team);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
Name=Flagge
|
||||
|
||||
MsgBeamFlag=Teleportiere die Flagge in deine Basis.
|
||||
MsgGrabFlag=Schnapp dir die Flagge und bring sie in deine Basis.
|
||||
|
||||
MsgFlagStolen=%s hat die Flagge von %s geklaut.
|
||||
MsgFlagBeamed=%s hat die Flagge in ihre Basis zurueckgebeamt.
|
||||
MsgFlagCaptured=%s hat erfolgreich die Flagge geklaut, und damit fuer sein Team einen Punkt gemacht.
|
||||
MsgFlagRestored=Die Flagge von %s wurde zurueckgesetzt.
|
|
@ -1,9 +0,0 @@
|
|||
Name=Flag
|
||||
|
||||
MsgBeamFlag=Beam the flag to your base.
|
||||
MsgGrabFlag=Grab the flag and carry it to your base.
|
||||
|
||||
MsgFlagStolen=%s stole the flag of %s.
|
||||
MsgFlagBeamed=%s beamed the flag to their base.
|
||||
MsgFlagCaptured=%s successfully captured a flag, and scored a point.
|
||||
MsgFlagRestored=The flag of %s got restored.
|
|
@ -0,0 +1,18 @@
|
|||
/*--
|
||||
Flag Mesh
|
||||
Author: Mimmo_O
|
||||
|
||||
Special flag graphics.
|
||||
--*/
|
||||
|
||||
|
||||
#appendto Goal_Flag
|
||||
|
||||
public func SetTeam(int to_team)
|
||||
{
|
||||
if (to_team == 1)
|
||||
SetMeshMaterial("FlagLeft");
|
||||
else if (to_team == 2)
|
||||
SetMeshMaterial("FlagRight");
|
||||
return _inherited(to_team);
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
/*--
|
||||
Flag Mesh
|
||||
Author: Mimmo_O
|
||||
|
||||
Special flag graphics.
|
||||
--*/
|
||||
|
||||
|
||||
#appendto Goal_Flag
|
||||
|
||||
public func SetTeam(int to_team)
|
||||
{
|
||||
if (to_team == 1)
|
||||
SetMeshMaterial("FlagLeft");
|
||||
else if (to_team == 2)
|
||||
SetMeshMaterial("FlagRight");
|
||||
return _inherited(to_team);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
Name=Flagge
|
||||
|
||||
MsgBeamFlag=Teleportiere die Flagge in deine Basis.
|
||||
MsgGrabFlag=Schnapp dir die Flagge und bring sie in deine Basis.
|
||||
|
||||
MsgFlagStolen=%s hat die Flagge von %s geklaut.
|
||||
MsgFlagBeamed=%s hat die Flagge in ihre Basis zurueckgebeamt.
|
||||
MsgFlagCaptured=%s hat erfolgreich die Flagge geklaut, und damit fuer sein Team einen Punkt gemacht.
|
||||
MsgFlagRestored=Die Flagge von %s wurde zurueckgesetzt.
|
|
@ -1,9 +0,0 @@
|
|||
Name=Flag
|
||||
|
||||
MsgBeamFlag=Beam the flag to your base.
|
||||
MsgGrabFlag=Grab the flag and carry it to your base.
|
||||
|
||||
MsgFlagStolen=%s stole the flag of %s.
|
||||
MsgFlagBeamed=%s beamed the flag to their base.
|
||||
MsgFlagCaptured=%s successfully captured a flag, and scored a point.
|
||||
MsgFlagRestored=The flag of %s got restored.
|
|
@ -0,0 +1,18 @@
|
|||
/*--
|
||||
Flag Mesh
|
||||
Author: Mimmo_O
|
||||
|
||||
Special flag graphics.
|
||||
--*/
|
||||
|
||||
|
||||
#appendto Goal_Flag
|
||||
|
||||
public func SetTeam(int to_team)
|
||||
{
|
||||
if (to_team == 1)
|
||||
SetMeshMaterial("FlagLeft");
|
||||
else if (to_team == 2)
|
||||
SetMeshMaterial("FlagRight");
|
||||
return _inherited(to_team);
|
||||
}
|
|
@ -14,7 +14,7 @@ protected func Initialize()
|
|||
CreateObject(Chest, 261, 163, NO_OWNER);
|
||||
CreateObject(Rule_ObjectFade)->DoFadeTime(5 * 36);
|
||||
CreateObject(Rule_KillLogs);
|
||||
AddEffect("IntFillChests", nil, 100, 70, this);
|
||||
AddEffect("IntFillChests", nil, 100, 70);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ protected func Initialize()
|
|||
CreateObject(Chest, 668, 336, NO_OWNER);
|
||||
CreateObject(Chest, 320, 440, NO_OWNER);
|
||||
CreateObject(Chest, 48, 256, NO_OWNER);
|
||||
AddEffect("IntFillChests", nil, 100, 5 * 36, this);
|
||||
AddEffect("IntFillChests", nil, 100, 5 * 36);
|
||||
|
||||
// Moving bricks.
|
||||
var brick;
|
||||
|
|
|
@ -14,7 +14,7 @@ protected func Initialize()
|
|||
|
||||
// Chests with weapons.
|
||||
CreateObject(Chest, 108, 248, NO_OWNER);
|
||||
AddEffect("IntFillChests", nil, 100, 3 * 36, this);
|
||||
AddEffect("IntFillChests", nil, 100, 3 * 36);
|
||||
|
||||
// Objects fade after 5 seconds.
|
||||
CreateObject(Rule_ObjectFade)->DoFadeTime(7 * 36);
|
||||
|
|
|
@ -17,6 +17,7 @@ private func OpenWeaponMenu(object clonk)
|
|||
else menu->AddItem(weapon);
|
||||
}
|
||||
menu->Show();
|
||||
menu->SetUncloseable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ protected func Initialize()
|
|||
CreateObject(Column,160,304)->SetClrModulation(RGB(255,100,80));
|
||||
CreateObject(Column,448,272)->SetClrModulation(RGB(255,100,80));
|
||||
|
||||
AddEffect("RandomMeteor", nil, 100, 36-Min(GetPlayerCount()*3,20), this);
|
||||
AddEffect("RemoveCorpses", nil, 100, 1, this);
|
||||
AddEffect("RandomMeteor", nil, 100, 36-Min(GetPlayerCount()*3,20));
|
||||
AddEffect("RemoveCorpses", nil, 100, 1);
|
||||
// Smooth brick edges.
|
||||
PlaceEdges();
|
||||
PlaceGras();
|
||||
|
|
|
@ -24,6 +24,7 @@ protected func FxFlightTimer(object pTarget, effect, int iEffectTime)
|
|||
if(fuel<=0)
|
||||
{
|
||||
DoFireworks();
|
||||
return;
|
||||
}
|
||||
|
||||
var ignition = iEffectTime % 15;
|
||||
|
|
|
@ -19,6 +19,7 @@ protected func FxFlightTimer(object pTarget, effect, int iEffectTime)
|
|||
if(fuel<=0)
|
||||
{
|
||||
DoFireworks();
|
||||
return;
|
||||
}
|
||||
|
||||
var ignition = iEffectTime % 10;
|
||||
|
@ -96,7 +97,7 @@ func Launch(int angle)
|
|||
SetComDir(COMD_None);
|
||||
|
||||
Exit();
|
||||
AddEffect("Flight",this,150,1,this,this);
|
||||
AddEffect("Flight",this,150,1,this);
|
||||
//AddEffect("HitCheck", this, 1,1, nil,nil, 0, 0);
|
||||
|
||||
SetR(angle);
|
||||
|
|
|
@ -82,7 +82,7 @@ func FxIntTurnTimer(pTarget, effect, iTime)
|
|||
{
|
||||
// Check wether the clonk wants to turn (Not when he wants to stop)
|
||||
var iRot = effect.rot;
|
||||
if( (effect.dir != GetDirection() && GetAction() != "Jump") || effect.turn_type != lAnim.turnType)
|
||||
if( (effect.dir != GetDirection() && (GetAction() != "Jump") || this->~IsAiming()) || effect.turn_type != lAnim.turnType)
|
||||
{
|
||||
effect.dir = GetDirection();
|
||||
if(effect.dir == COMD_Right)
|
||||
|
@ -713,17 +713,20 @@ func StartJump()
|
|||
UpdateAttach();
|
||||
// Set proper turn type
|
||||
SetTurnType(0);
|
||||
//Dive jump
|
||||
var flight = SimFlight(AbsX(GetX()), AbsY(GetY()), GetXDir()*2, GetYDir()*2, 25); //I have no clue why the dirs must be doubled... but it seems to fix it
|
||||
if(GBackLiquid(flight[0] - GetX(), flight[1] - GetY()) && GBackLiquid(flight[0] - GetX(), flight[1] + GetDefHeight() / 2 - GetY()))
|
||||
{
|
||||
PlayAnimation("JumpDive", 5, Anim_Linear(0, 0, GetAnimationLength("JumpDive"), 60, ANIM_Hold), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
|
||||
return 1;
|
||||
}
|
||||
//Dive jump (only if not aiming)
|
||||
if(!this->~IsAiming())
|
||||
{
|
||||
var flight = SimFlight(AbsX(GetX()), AbsY(GetY()), GetXDir()*2, GetYDir()*2, 25); //I have no clue why the dirs must be doubled... but it seems to fix it
|
||||
if(GBackLiquid(flight[0] - GetX(), flight[1] - GetY()) && GBackLiquid(flight[0] - GetX(), flight[1] + GetDefHeight() / 2 - GetY()))
|
||||
{
|
||||
PlayAnimation("JumpDive", 5, Anim_Linear(0, 0, GetAnimationLength("JumpDive"), 60, ANIM_Hold), Anim_Linear(0, 0, 1000, 5, ANIM_Remove));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(!GetEffect("Fall", this))
|
||||
AddEffect("Fall",this,1,1,this);
|
||||
RemoveEffect("WallKick",this);
|
||||
if(!GetEffect("Fall", this))
|
||||
AddEffect("Fall",this,1,1,this);
|
||||
RemoveEffect("WallKick",this);
|
||||
}
|
||||
|
||||
func FxFallEffect(string new_name, object target)
|
||||
|
|
|
@ -145,10 +145,12 @@ protected func Death(int killed_by)
|
|||
if (GetAlive())
|
||||
return;
|
||||
|
||||
// Some effects on dying.
|
||||
if(gender == 0)
|
||||
Sound("Die");
|
||||
else
|
||||
Sound("FDie");
|
||||
CloseEyes(1);
|
||||
|
||||
DeathAnnounce();
|
||||
return;
|
||||
|
|
Binary file not shown.
|
@ -115,16 +115,18 @@ func DoPoint(int player, int count)
|
|||
player_points[player] = Max(player_points[player] + count, 0);
|
||||
}
|
||||
|
||||
protected func InitializePlayer(plr)
|
||||
protected func InitializePlayer(int plr, int x, int y, object base, int team)
|
||||
{
|
||||
ScheduleCall(this, "RefreshScoreboard", 1);
|
||||
player_suicides[plr]=0;
|
||||
return Goal_Melee->InitializePlayer(plr, ...); // TODO
|
||||
|
||||
Goal_Melee->MakeHostileToAll(plr, team);
|
||||
return inherited(plr, x, y, base, team, ...);
|
||||
}
|
||||
|
||||
public func IsFulfilled()
|
||||
{
|
||||
return Goal_Melee->IsFulfilled(); // TODO
|
||||
return Goal_Melee->IsFulfilled(); // the same condition as a normal melee
|
||||
}
|
||||
|
||||
func OnClonkDeath(object clonk, int killer)
|
||||
|
|
|
@ -13,6 +13,8 @@ local menu;
|
|||
local hold;
|
||||
local has_selected;
|
||||
|
||||
local crew;
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
time = 36 * 10;
|
||||
|
@ -37,9 +39,15 @@ public func StartRelaunch(object clonk)
|
|||
{
|
||||
if (!clonk)
|
||||
return;
|
||||
// only 1 clonk can be inside
|
||||
if(crew)
|
||||
return;
|
||||
// save clonk for later use
|
||||
crew = clonk;
|
||||
clonk->Enter(this);
|
||||
ScheduleCall(this, "OpenWeaponMenu", 36, 0, clonk);
|
||||
AddEffect("IntTimeLimit", this, 100, 36, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,7 +71,7 @@ private func OpenWeaponMenu(object clonk)
|
|||
|
||||
func FxIntTimeLimitTimer(object target, effect, int fxtime)
|
||||
{
|
||||
var clonk = Contents();
|
||||
var clonk = crew;
|
||||
if (!clonk)
|
||||
{
|
||||
RemoveObject();
|
||||
|
@ -92,6 +100,9 @@ public func Selected(object menu, object selector, bool alt)
|
|||
GiveWeapon(selector->GetSymbol(), alt);
|
||||
|
||||
has_selected = true;
|
||||
// Close menu manually, to prevent selecting more weapons.
|
||||
if (menu)
|
||||
menu->Close(true);
|
||||
|
||||
if (!hold)
|
||||
RelaunchClonk();
|
||||
|
@ -100,7 +111,7 @@ public func Selected(object menu, object selector, bool alt)
|
|||
|
||||
private func RelaunchClonk()
|
||||
{
|
||||
var clonk = Contents();
|
||||
var clonk = crew;
|
||||
clonk->Exit();
|
||||
GameCall("OnClonkLeftRelaunch", clonk);
|
||||
if (menu)
|
||||
|
@ -117,7 +128,7 @@ private func GiveWeapon(id weapon_id, bool alt)
|
|||
newobj->CreateContents(Arrow);
|
||||
if (weapon_id == Musket)
|
||||
newobj->CreateContents(LeadShot);
|
||||
Contents()->Collect(newobj, nil, alt);
|
||||
crew->Collect(newobj, nil, alt);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Premade goal for simple melees with relaunches.
|
||||
Callbacks made to scenario script:
|
||||
* OnPlrRelaunch(int plr) made when the player is relaunched and at game start plr init.
|
||||
* OnPlayerRelaunch(int plr) made when the player is relaunched and at game start plr init.
|
||||
* RelaunchCount() should return the number of relaunches.
|
||||
* KillsToRelaunch() should return how many kills will earn the player an extra relaunch.
|
||||
--*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include Library_Goal
|
||||
|
||||
protected func InitializePlayer(int newplr, int x, int y, object base, int team)
|
||||
func MakeHostileToAll(int newplr, int team)
|
||||
{
|
||||
// If the player is in a team, don't change hostility.
|
||||
if (team) return;
|
||||
|
@ -16,6 +16,11 @@ protected func InitializePlayer(int newplr, int x, int y, object base, int team)
|
|||
SetHostility(newplr, plr, true, true);
|
||||
SetHostility(plr, newplr, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
protected func InitializePlayer(int newplr, int x, int y, object base, int team)
|
||||
{
|
||||
MakeHostileToAll(newplr, team);
|
||||
return inherited(newplr, x, y, base, team, ...);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,8 @@ func FxIntBridgeTimer(object clonk, proplist effect, int time)
|
|||
|
||||
// bridge speed: Build in smaller steps when briding upwards so Clonk moves up with bridge
|
||||
var min_dt = 3;
|
||||
if (effect.TargetY < -20 && !Abs(effect.TargetX*5/effect.TargetX)) min_dt=2;
|
||||
if (effect.TargetY < -20 && !Abs(effect.TargetX*5/effect.TargetY))
|
||||
min_dt = 2;
|
||||
|
||||
// bridge speed by dig physical
|
||||
var speed = clonk.ActMap.Dig.Speed/6;
|
||||
|
@ -151,13 +152,12 @@ private func LoamDone(object clonk)
|
|||
clonk->SetAction("Walk");
|
||||
clonk->SetComDir(COMD_Stop);
|
||||
}
|
||||
// Remove loam object if most of it has been consumed
|
||||
if (loamused > LOAM_Bridge_Amount - 10)
|
||||
{
|
||||
RemoveObject();
|
||||
}
|
||||
// Remove Effect
|
||||
RemoveEffect("IntBridge", clonk);
|
||||
// Remove loam object if most of it has been consumed
|
||||
if (loamused > LOAM_Bridge_Amount - 10)
|
||||
RemoveObject();
|
||||
return;
|
||||
}
|
||||
|
||||
public func IsFoundryProduct() { return true; }
|
||||
|
|
|
@ -39,10 +39,10 @@ private func DeflateEffect()
|
|||
private func Pack()
|
||||
{
|
||||
RemoveEffect("NoDrop",parent);
|
||||
RemoveObject();
|
||||
rider->SetAction("Jump");
|
||||
rider->SetSpeed(GetXDir(),GetYDir());
|
||||
rider->SetComDir(COMD_Down);
|
||||
RemoveObject();
|
||||
}
|
||||
|
||||
func ControlLeft()
|
||||
|
|
|
@ -77,7 +77,7 @@ func FxIntFusingTimer()
|
|||
if( (fuse_vertex == 0 && fuse_dir == -1) || (fuse_vertex == GetVertexNum()-1 && fuse_dir == +1))
|
||||
{
|
||||
fuse_call->~OnFuseFinished(this);
|
||||
RemoveObject(this);
|
||||
RemoveObject();
|
||||
return -1;
|
||||
}
|
||||
fuse_x = GetVertex(fuse_vertex, 0)*10;
|
||||
|
|
|
@ -81,6 +81,8 @@ func SetTurnType () { return _inherited(...); }
|
|||
func SetTurnForced() { return _inherited(...); }
|
||||
func SetBackwardsSpeed() { return _inherited(...); }
|
||||
|
||||
func IsAiming() { return !!GetEffect("IntAim", this); }
|
||||
|
||||
func FxIntAimCheckProcedureStart(target, effect, tmp)
|
||||
{
|
||||
if(tmp) return;
|
||||
|
@ -255,7 +257,7 @@ public func StartAim(object weapon, int angle)
|
|||
func FxIntAimTimer(target, effect, time)
|
||||
{
|
||||
var angle, delta_angle, length;
|
||||
var speed = aim_set["AimSpeed"];;
|
||||
var speed = aim_set["AimSpeed"];
|
||||
if(speed == nil) speed = 50;
|
||||
else speed *= 10;
|
||||
if(aim_angle < 0) SetTurnForced(DIR_Left);
|
||||
|
|
|
@ -60,6 +60,13 @@ func FxIntLiftHeavyStart(object clonk, proplist effect, bool tmp)
|
|||
if(tmp) return;
|
||||
if(!clonk) return -1;
|
||||
if(Contained() != clonk) return -1;
|
||||
|
||||
// if the clonk is inside, we can skip the animation
|
||||
if(clonk->Contained())
|
||||
{
|
||||
AddEffect("IntCarryHeavy", clonk, 1, 1, this);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Stop the clonk from moving, and tell the clonk's control library
|
||||
//it now has a hand action
|
||||
|
@ -147,6 +154,10 @@ func FxIntDropHeavyStart(object clonk, proplist effect, bool tmp)
|
|||
if(clonk->GetEffect("IntCarryHeavy"))
|
||||
clonk->RemoveEffect("IntCarryHeavy");
|
||||
|
||||
// if the clonk is inside, we don't play the animation
|
||||
if(clonk->Contained())
|
||||
return -1;
|
||||
|
||||
clonk->SetTurnForced(clonk->GetDir());
|
||||
clonk->SetHandAction(1);
|
||||
clonk->SetAction("Stand");
|
||||
|
@ -232,7 +243,7 @@ protected func Entrance(object obj)
|
|||
if(obj->~GetCarryHeavy() == this)
|
||||
{
|
||||
liftheavy_carrier = obj;
|
||||
if(obj->GetAction() == "Walk")
|
||||
if(obj->GetAction() == "Walk" && !obj->Contained())
|
||||
DoLift();
|
||||
else
|
||||
AddEffect("IntCarryHeavy",obj, 1, 1, this);
|
||||
|
|
|
@ -101,7 +101,7 @@ public func GetHandItem(int i)
|
|||
/** Set the 'hand'th use-item to the 'inv'th slot */
|
||||
public func SetHandItemPos(int hand, int inv)
|
||||
{
|
||||
// indices are in range?
|
||||
// indices are in range?
|
||||
if(hand >= HandObjects() || inv >= MaxContentsCount())
|
||||
return nil;
|
||||
if(hand < 0 || inv < 0) return nil;
|
||||
|
@ -110,6 +110,15 @@ public func SetHandItemPos(int hand, int inv)
|
|||
if(IsCarryingHeavy())
|
||||
return nil;
|
||||
|
||||
// changing slots cancels using, if the slot with the used object is contained
|
||||
if(using)
|
||||
{
|
||||
var used_slot = GetItemPos(using);
|
||||
if(used_slot != nil)
|
||||
if(used_slot == GetHandItemPos(hand) || used_slot == inv)
|
||||
CancelUseControl(0,0);
|
||||
}
|
||||
|
||||
// If the item is already selected, we can't hold it in another one too.
|
||||
var hand2 = GetHandPosByItemPos(inv);
|
||||
if(hand2 != nil)
|
||||
|
@ -248,7 +257,7 @@ public func Collect(object item, bool ignoreOCF, int pos, bool force)
|
|||
{
|
||||
force_collection = force;
|
||||
var success = false;
|
||||
if (pos == nil)
|
||||
if (pos == nil || item->~IsCarryHeavy())
|
||||
{
|
||||
success = _inherited(item,ignoreOCF);
|
||||
force_collection = false;
|
||||
|
|
|
@ -4,4 +4,5 @@ Version=4,10,0,0
|
|||
Category=C4D_StaticBack
|
||||
Width=16
|
||||
Height=16
|
||||
Offset=-8,-16
|
||||
Offset=-8,-16
|
||||
ClosedContainer=2
|
|
@ -18,12 +18,20 @@ protected func Construction()
|
|||
/*-- Contents --*/
|
||||
|
||||
public func IsContainer() { return true; }
|
||||
public func IsInteractable() { return true; }
|
||||
|
||||
private func MaxContentsCount()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
||||
// Open contentsmenu via interaction
|
||||
public func Interact(object clonk, int mode)
|
||||
{
|
||||
clonk->CreateContentsMenus();
|
||||
}
|
||||
|
||||
protected func RejectCollect()
|
||||
{
|
||||
if (ContentsCount() >= MaxContentsCount())
|
||||
|
|
|
@ -9,46 +9,61 @@
|
|||
|
||||
|
||||
// fire drawing modes
|
||||
static const C4Fx_FireMode_Default = 0; // determine mode by category
|
||||
static const C4Fx_FireMode_LivingVeg = 2 ;// C4D_Living and C4D_StaticBack
|
||||
static const C4Fx_FireMode_StructVeh = 1; // C4D_Structure and C4D_Vehicle
|
||||
static const C4Fx_FireMode_Object = 3; // other (C4D_Object and no bit set (magic))
|
||||
static const C4Fx_FireMode_Last = 3; // largest valid fire mode
|
||||
static const C4Fx_FireMode_Default = 0; // determine mode by category
|
||||
static const C4Fx_FireMode_LivingVeg = 2; // C4D_Living and C4D_StaticBack
|
||||
static const C4Fx_FireMode_StructVeh = 1; // C4D_Structure and C4D_Vehicle
|
||||
static const C4Fx_FireMode_Object = 3; // other (C4D_Object and no bit set (magic))
|
||||
static const C4Fx_FireMode_Last = 3; // largest valid fire mode
|
||||
|
||||
|
||||
// Returns whether the object is burning.
|
||||
global func OnFire()
|
||||
{
|
||||
if(!this) return false;
|
||||
if (!this)
|
||||
return false;
|
||||
var effect;
|
||||
if(!(effect=GetEffect("Fire", this))) return false;
|
||||
if (!(effect=GetEffect("Fire", this)))
|
||||
return false;
|
||||
return effect.strength;
|
||||
}
|
||||
|
||||
// Extinguishes the calling object with specified strength.
|
||||
global func Extinguish(strength)
|
||||
{
|
||||
if(!this) return false;
|
||||
if(strength == nil) strength=100;
|
||||
else if(!strength) return false;
|
||||
if (!this)
|
||||
return false;
|
||||
if (strength == nil)
|
||||
strength = 100;
|
||||
else if (!strength)
|
||||
return false;
|
||||
|
||||
var effect=GetEffect("Fire", this);
|
||||
if(!effect) return false;
|
||||
var effect = GetEffect("Fire", this);
|
||||
if (!effect)
|
||||
return false;
|
||||
effect.strength = BoundBy(effect.strength - strength, 0, 100);
|
||||
if(effect.strength == 0) RemoveEffect(nil, this, effect);
|
||||
if (effect.strength == 0)
|
||||
RemoveEffect(nil, this, effect);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Incinerates the calling object with specified strength.
|
||||
global func Incinerate(strength, int caused_by, blasted, incinerating_object)
|
||||
{
|
||||
if(!this) return false;
|
||||
if(strength == nil) strength=100;
|
||||
else if(!strength) return false;
|
||||
if (!this)
|
||||
return false;
|
||||
if (strength == nil)
|
||||
strength = 100;
|
||||
else if (!strength)
|
||||
return false;
|
||||
|
||||
var effect=GetEffect("Fire", this);
|
||||
if(effect) {effect.strength = BoundBy(effect.strength + strength, 0, 100); return true;}
|
||||
else AddEffect("Fire", this, 100, 2, this, nil, caused_by, !!blasted, incinerating_object, strength);
|
||||
var effect = GetEffect("Fire", this);
|
||||
if (effect)
|
||||
{
|
||||
effect.strength = BoundBy(effect.strength + strength, 0, 100);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
AddEffect("Fire", this, 100, 2, this, nil, caused_by, !!blasted, incinerating_object, strength);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -83,7 +98,7 @@ global func FxIntNonFlammableEffect(string new_name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
global func FxFireStart(object target, effect, bool temp, int caused_by, bool blasted, object incinerating_object, strength)
|
||||
global func FxFireStart(object target, proplist effect, int temp, int caused_by, bool blasted, object incinerating_object, strength)
|
||||
{
|
||||
// safety
|
||||
if (!target) return -1;
|
||||
|
@ -101,30 +116,35 @@ global func FxFireStart(object target, effect, bool temp, int caused_by, bool bl
|
|||
var burn_to = target.BurnTo;
|
||||
var mat;
|
||||
if (MaterialName(mat = GetMaterial(target->GetX(), target->GetY())))
|
||||
if (GetMaterialVal("Extinguisher", "[Material]", mat, 0))
|
||||
if (GetMaterialVal("Extinguisher", "[Material]", mat))
|
||||
{
|
||||
// blasts should changedef in water, too!
|
||||
if (blasted) if(burn_to != nil) target->ChangeDef(burn_to);
|
||||
if (blasted)
|
||||
if (burn_to != nil)
|
||||
target->ChangeDef(burn_to);
|
||||
// no fire caused
|
||||
fire_caused = false;
|
||||
}
|
||||
// BurnTurnTo
|
||||
if (fire_caused) if(burn_to != nil) target->ChangeDef(burn_to);
|
||||
if (fire_caused)
|
||||
if (burn_to != nil)
|
||||
target->ChangeDef(burn_to);
|
||||
|
||||
// eject contents
|
||||
var obj;
|
||||
if (!target->GetDefCoreVal("IncompleteActivity", "DefCore") && !target.NoBurnDecay)
|
||||
{
|
||||
for(var i=target->ContentsCount(); obj=target->Contents(--i);)
|
||||
for (var i = target->ContentsCount(); obj = target->Contents(--i);)
|
||||
{
|
||||
if(target->Contained()) obj->Enter(target->Contained());
|
||||
else obj->Exit();
|
||||
}
|
||||
|
||||
if (target->Contained())
|
||||
obj->Enter(target->Contained());
|
||||
else
|
||||
obj->Exit();
|
||||
}
|
||||
// Detach attached objects
|
||||
for(obj in FindObjects(Find_ActionTarget(target)))
|
||||
for (obj in FindObjects(Find_ActionTarget(target)))
|
||||
{
|
||||
if(obj->GetProcedure() == "ATTACH")
|
||||
if (obj->GetProcedure() == "ATTACH")
|
||||
obj->SetAction(nil);
|
||||
}
|
||||
}
|
||||
|
@ -132,14 +152,14 @@ global func FxFireStart(object target, effect, bool temp, int caused_by, bool bl
|
|||
// fire caused?
|
||||
if (!fire_caused)
|
||||
{
|
||||
// if object was blasted but not incinerated (i.e., inside extinguisher)
|
||||
// do a script callback
|
||||
if (blasted) target->~IncinerationEx(caused_by);
|
||||
// if object was blasted but not incinerated (i.e., inside extinguisher), do a script callback
|
||||
if (blasted)
|
||||
target->~IncinerationEx(caused_by);
|
||||
return -1;
|
||||
}
|
||||
// determine fire appearance
|
||||
var fire_mode;
|
||||
if (!(fire_mode=target->~GetFireMode()))
|
||||
if (!(fire_mode = target->~GetFireMode()))
|
||||
{
|
||||
// set default fire modes
|
||||
var cat = target->GetCategory();
|
||||
|
@ -165,8 +185,10 @@ global func FxFireStart(object target, effect, bool temp, int caused_by, bool bl
|
|||
|
||||
// Set values
|
||||
//target->FirePhase=Random(MaxFirePhase);
|
||||
if((target->GetDefCoreVal("Width", "DefCore") * target->GetDefCoreVal("Height", "DefCore")) > 500) target->Sound("Inflame", false, 100);
|
||||
if(target->GetMass() >= 100) target->Sound("Fire", false, 100, 0, true);
|
||||
if ((target->GetDefCoreVal("Width", "DefCore") * target->GetDefCoreVal("Height", "DefCore")) > 500)
|
||||
target->Sound("Inflame", false, 100);
|
||||
if (target->GetMass() >= 100)
|
||||
target->Sound("Fire", false, 100, 0, true);
|
||||
|
||||
// callback
|
||||
target->~Incineration(effect.caused_by);
|
||||
|
@ -186,24 +208,30 @@ global func FxFireTimer(object target, effect, int time)
|
|||
// strength changes over time
|
||||
if(time % 4 == 0)
|
||||
{
|
||||
if(effect.strength < 50){ if(time % 8 == 0) effect.strength=Max(effect.strength-1, 0); if(effect.strength <= 0) return FX_Execute_Kill;}
|
||||
else effect.strength=Min(effect.strength+1, 100);
|
||||
if (effect.strength < 50)
|
||||
{
|
||||
if (time % 8 == 0)
|
||||
effect.strength = Max(effect.strength - 1, 0);
|
||||
if (effect.strength <= 0)
|
||||
return FX_Execute_Kill;
|
||||
}
|
||||
else
|
||||
effect.strength = Min(effect.strength + 1, 100);
|
||||
}
|
||||
|
||||
var width=target->GetDefCoreVal("Width", "DefCore")/2;
|
||||
var height=target->GetDefCoreVal("Height", "DefCore")/2;
|
||||
var width = target->GetDefCoreVal("Width", "DefCore") / 2;
|
||||
var height = target->GetDefCoreVal("Height", "DefCore") / 2;
|
||||
|
||||
// target is in liquid?
|
||||
if(time % 24 == 0)
|
||||
{
|
||||
|
||||
if (time % 24 == 0)
|
||||
{
|
||||
var mat;
|
||||
if(mat = GetMaterial())
|
||||
if(GetMaterialVal("Extinguisher", "Material", mat))
|
||||
if (mat = GetMaterial())
|
||||
if (GetMaterialVal("Extinguisher", "Material", mat))
|
||||
return FX_Execute_Kill;
|
||||
|
||||
// check spreading of fire
|
||||
if(effect.strength > 10)
|
||||
if (effect.strength > 10)
|
||||
{
|
||||
// If contained only incinerate objects inside the same container and the container itself.
|
||||
var container = target->Contained(), inc_objs;
|
||||
|
@ -220,13 +248,17 @@ global func FxFireTimer(object target, effect, int time)
|
|||
// Loop through the selected set of objects and check contact incinerate.
|
||||
for (var obj in inc_objs)
|
||||
{
|
||||
if(obj->GetCategory() & C4D_Living) if(!obj->GetAlive()) continue;
|
||||
if (obj->GetCategory() & C4D_Living)
|
||||
if (!obj->GetAlive())
|
||||
continue;
|
||||
|
||||
var inf = obj.ContactIncinerate;
|
||||
if(!inf) continue;
|
||||
var amount = (effect.strength/3) / Max(1, inf);
|
||||
if (!inf)
|
||||
continue;
|
||||
var amount = (effect.strength / 3) / Max(1, inf);
|
||||
|
||||
if(!amount) continue;
|
||||
if (!amount)
|
||||
continue;
|
||||
obj->Incinerate(Max(10, amount), effect.caused_by, false, effect.incinerating_obj);
|
||||
}
|
||||
}
|
||||
|
@ -235,23 +267,26 @@ global func FxFireTimer(object target, effect, int time)
|
|||
//if(time % 20 == 0)target->Message(Format("<c ee0000>%d</c>", effect.strength));
|
||||
// causes on object
|
||||
//target->ExecFire(effect_number, caused_by);
|
||||
if(target->GetAlive())
|
||||
if (target->GetAlive())
|
||||
{
|
||||
target->DoEnergy(-effect.strength*4, true, FX_Call_EngFire, effect.caused_by);
|
||||
}
|
||||
else
|
||||
{
|
||||
if((time*10) % 100 <= effect.strength)
|
||||
if ((time*10) % 100 <= effect.strength)
|
||||
{
|
||||
target->DoDamage(2, true, FX_Call_DmgFire, effect.caused_by);
|
||||
if(target) if(!Random(2)) if(!effect.no_burn_decay) target->DoCon(-1);
|
||||
if (target && !Random(2) && !effect.no_burn_decay)
|
||||
target->DoCon(-1);
|
||||
}
|
||||
}
|
||||
if(!target) return FX_Execute_Kill;
|
||||
if (!target)
|
||||
return FX_Execute_Kill;
|
||||
//if(!(time % 2 == 0)) return FX_OK;
|
||||
|
||||
//if(!target->OnFire()) {return FX_Execute_Kill;}
|
||||
if(target->Contained()) return FX_OK;
|
||||
if (target->Contained())
|
||||
return FX_OK;
|
||||
|
||||
// particles
|
||||
//var smoke;//, sparks, bright;
|
||||
|
@ -261,10 +296,16 @@ global func FxFireTimer(object target, effect, int time)
|
|||
if(time % 4 == 0)
|
||||
{
|
||||
var size = BoundBy(10*Max(width, height), 50, 800);
|
||||
if(size > 300) if(time % 8 == 0) return;
|
||||
if (size > 300)
|
||||
if (time % 8 == 0)
|
||||
return;
|
||||
|
||||
var wind=BoundBy(GetWind(target->GetX(), target->GetY()), -5, 5);
|
||||
var smoke_color; if(effect.strength < 50) smoke_color=RGBa(255,255,255, 50); else smoke_color=RGBa(100, 100, 100, 50);
|
||||
var wind = BoundBy(GetWind(target->GetX(), target->GetY()), -5, 5);
|
||||
var smoke_color;
|
||||
if(effect.strength < 50)
|
||||
smoke_color = RGBa(255,255,255, 50);
|
||||
else
|
||||
smoke_color = RGBa(100, 100, 100, 50);
|
||||
|
||||
CreateParticle("ExploSmoke", RandomX(-width, width), RandomX(-height, height), wind, -effect.strength/8, size, smoke_color);
|
||||
}
|
||||
|
@ -285,14 +326,16 @@ global func FxFireTimer(object target, effect, int time)
|
|||
global func FxFireStop(object target, int effect_number, int reason, bool temp)
|
||||
{
|
||||
// safety
|
||||
if (!target) return false;
|
||||
if (!target)
|
||||
return false;
|
||||
// only if real removal is done
|
||||
if (temp)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// stop sound
|
||||
if (target->GetMass() >=100) target->Sound("Fire", false, 1, 0, false);
|
||||
if (target->GetMass() >= 100)
|
||||
target->Sound("Fire", false, 1, 0, false);
|
||||
// done, success
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,14 @@ global func TutArrowShowPos(int x, int y, int angle, int dist)
|
|||
*/
|
||||
global func TutArrowShowTarget(object target, int angle, int dist)
|
||||
{
|
||||
var container = target->Contained(), index;
|
||||
if (container &&
|
||||
container.Prototype == Clonk &&
|
||||
(index = GetIndexOf(container.inventory, target)) != -1) // Is the object inventory in a clonk?
|
||||
{
|
||||
var itemslot = container.HUDcontroller.inventory[index];
|
||||
return TutArrowShowGUIPos(itemslot->GetX(), itemslot->GetY(), -90, itemslot->GetDefHeight() / 2);
|
||||
}
|
||||
if (angle == nil)
|
||||
angle = 135;
|
||||
if (dist == nil)
|
||||
|
|
|
@ -29,8 +29,8 @@ public func OnProjectileHit()
|
|||
|
||||
public func Burst()
|
||||
{
|
||||
RemoveObject();
|
||||
CastParticles("Straw",130,30,0,-3,30,40,RGB(255,255,255),RGB(255,255,255));
|
||||
RemoveObject();
|
||||
}
|
||||
|
||||
public func Hit()
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
|
@ -0,0 +1,30 @@
|
|||
[Head]
|
||||
Icon=6
|
||||
Title=TutorialSettlement
|
||||
Version=5,2,0,0
|
||||
MaxPlayer=1
|
||||
Difficulty=5
|
||||
|
||||
[Definitions]
|
||||
Definition1=Objects.ocd
|
||||
|
||||
[Player1]
|
||||
Crew=Clonk=1
|
||||
Knowledge=Foundry=1;Lorry=1;Pickaxe=1;Axe=1;Hammer=1;Shovel=1;Firestone=1;Barrel=1;Dynamite=1;DynamiteBox=1;Loam=1;
|
||||
|
||||
[Landscape]
|
||||
Sky=Clouds2
|
||||
MapZoom=10
|
||||
TopOpen=1
|
||||
BottomOpen=0
|
||||
SkyScrollMode=2
|
||||
Vegetation=Tree_Coniferous=1
|
||||
VegetationLevel=90
|
||||
InEarth=Firestone=3;Loam=2
|
||||
InEarthLevel=40
|
||||
|
||||
[Weather]
|
||||
Climate=0,0,0,100
|
||||
StartSeason=0,0,0,100
|
||||
YearSpeed=0,0,0,100
|
||||
Wind=1,100,-100,100
|
|
@ -0,0 +1,276 @@
|
|||
/*--
|
||||
Tutorial 05
|
||||
Author: Caesar
|
||||
|
||||
Basic settlement tutorial: Foundry, Flagpole, Windmill
|
||||
--*/
|
||||
|
||||
static guide; // guide object
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
// Environment.
|
||||
PlaceGrass(85);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected func InitializePlayer(int plr)
|
||||
{
|
||||
var clonk = GetCrew(plr, 0);
|
||||
clonk->SetPosition(300, -150);
|
||||
clonk->Fling(0, 0);
|
||||
clonk->SetDir(DIR_Right);
|
||||
clonk->CreateContents(Shovel);
|
||||
clonk->CreateContents(Hammer);
|
||||
clonk->CreateContents(Axe);
|
||||
var effect = AddEffect("ClonkRestore", clonk, 100, 10);
|
||||
effect.var1 = 300;
|
||||
effect.var2 = -10;
|
||||
|
||||
// Create tutorial guide, add messages, show first.
|
||||
guide = CreateTutorialGuide(plr);
|
||||
guide->AddGuideMessage("@$MsgTutIntro0$");
|
||||
guide->ShowGuideMessage(0);
|
||||
AddEffect("TutorialIntro1", nil, 1, 36 * 5);
|
||||
AddEffect("TutorialFoundrySite", nil, 1, 18);
|
||||
AddEffect("TutorialFoundryMaterialUse", nil, 1, 18);
|
||||
return;
|
||||
}
|
||||
|
||||
/*-- Guide Messages --*/
|
||||
// Finds when the Clonk has done 'X', and changes the message.
|
||||
|
||||
global func FxTutorialIntro1Stop()
|
||||
{
|
||||
guide->AddGuideMessage("@$MsgTutIntro1$");
|
||||
guide->ShowGuideMessage(1);
|
||||
AddEffect("TutorialIntro2", nil, 1, 36 * 6);
|
||||
return 0;
|
||||
}
|
||||
|
||||
global func FxTutorialIntro2Stop()
|
||||
{
|
||||
guide->AddGuideMessage("@$MsgTutIntro2$");
|
||||
guide->ShowGuideMessage(2);
|
||||
AddEffect("TutorialIntro3", nil, 1, 36 * 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
global func FxTutorialIntro3Stop()
|
||||
{
|
||||
guide->AddGuideMessage("$MsgTutIntro3$");
|
||||
guide->ShowGuideMessage(3);
|
||||
guide->AddGuideMessage("$MsgTutFoundrySite$");
|
||||
return 1;
|
||||
}
|
||||
|
||||
global func FxTutorialFoundrySiteTimer(object target, effect, int timer)
|
||||
{
|
||||
if (FindObject(Find_ID(ConstructionSite)))
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFoundrySiteStop(object target, effect, int timer)
|
||||
{
|
||||
while (GetEffect("TutorialIntro*"))
|
||||
RemoveEffect("TutorialIntro*");
|
||||
guide->ClearGuideMessage();
|
||||
guide->AddGuideMessage("$MsgTutFoundryChopTree$");
|
||||
AddEffect("TutorialFoundryChopTree", nil, 1, 18);
|
||||
return 0;
|
||||
}
|
||||
|
||||
global func FxTutorialFoundryChopTreeTimer(object target, effect, int timer)
|
||||
{
|
||||
if (FindObject(Find_ID(Tree_Coniferous), Find_Not(Find_Category(C4D_StaticBack))))
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFoundryChopTreeStop(object target, effect, int timer)
|
||||
{
|
||||
guide->AddGuideMessage("$MsgTutFoundryHackTree$");
|
||||
AddEffect("TutorialFoundryHackTree", nil, 1, 18);
|
||||
}
|
||||
|
||||
global func FxTutorialFoundryHackTreeTimer(object target, effect, int timer)
|
||||
{
|
||||
if (ObjectCount(Find_ID(Wood)) >= 2)
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFoundryHackTreeStop(object target, effect, int timer)
|
||||
{
|
||||
guide->AddGuideMessage("$MsgTutFoundryStoneBlast$");
|
||||
AddEffect("TutorialFoundryStoneBlast", nil, 1, 18);
|
||||
}
|
||||
|
||||
global func FxTutorialFoundryStoneBlastTimer(object target, effect, int timer)
|
||||
{
|
||||
if (ObjectCount(Find_ID(Rock)) >= 4)
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFoundryStoneBlastStop(object target, effect, int timer)
|
||||
{
|
||||
guide->AddGuideMessage("$MsgTutFoundryMaterialUse$");
|
||||
AddEffect("TutorialFoundryMaterialUse", nil, 1, 18);
|
||||
}
|
||||
|
||||
global func FxTutorialFoundryMaterialUseTimer(object target, effect, int timer)
|
||||
{
|
||||
if (FindObject(Find_ID(Foundry)))
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFoundryMaterialUseStop(object target, effect, int timer)
|
||||
{
|
||||
guide->AddGuideMessage("$MsgTutFlagpoleSite$");
|
||||
for(var i=0; i<GetPlayerCount(); ++i) // probably overkill to loop
|
||||
SetPlrKnowledge(GetPlayerByIndex(i), Flagpole);
|
||||
RemoveEffect("TutorialFoundrySite");
|
||||
RemoveEffect("TutorialFoundryChopTree");
|
||||
RemoveEffect("TutorialFoundryHackTree");
|
||||
RemoveEffect("TutorialFoundryStoneBlast");
|
||||
AddEffect("TutorialFlagpoleSite", nil, 1, 18);
|
||||
AddEffect("TutorialFlagpoleBuild", nil, 1, 18);
|
||||
}
|
||||
|
||||
global func FxTutorialFlagpoleSiteTimer(object target, effect, int timer)
|
||||
{
|
||||
for(var site in FindObjects(Find_ID(ConstructionSite)))
|
||||
if (site.definition == Flagpole)
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFlagpoleSiteStop(object tg, e, int tm)
|
||||
{
|
||||
guide->AddGuideMessage("$MsgTutFlagpoleIronComponents$");
|
||||
AddEffect("TutorialFlagpoleIronComponents", nil, 1, 18);
|
||||
}
|
||||
|
||||
global func FxTutorialFlagpoleIronComponentsTimer(object target, effect, int timer)
|
||||
{
|
||||
if (ObjectCount(Find_ID(Coal)) >= 1 && ObjectCount(Find_ID(Ore)))
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFlagpoleIronComponentsStop(object target, effect, int timer)
|
||||
{
|
||||
guide->AddGuideMessage("$MsgTutFlagpoleIronSmelt$");
|
||||
AddEffect("TutorialFlagpoleIronSmelt", nil, 1, 18);
|
||||
}
|
||||
|
||||
global func FxTutorialFlagpoleIronSmeltTimer(object target, effect, int timer)
|
||||
{
|
||||
if (ObjectCount(Find_ID(Metal)) >= 1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFlagpoleIronSmeltStop(object target, effect, int timer)
|
||||
{
|
||||
guide->AddGuideMessage("$MsgTutFlagpoleIronPraise$");
|
||||
AddEffect("TutorialFlagpoleBuild", nil, 1, 18);
|
||||
}
|
||||
|
||||
global func FxTutorialFlagpoleBuildTimer(object target, effect, int timer)
|
||||
{
|
||||
if (FindObject(Find_ID(Flagpole)))
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialFlagpoleBuildStop(object target, effect, int timer)
|
||||
{
|
||||
RemoveEffect("TutorialFlagpoleSite");
|
||||
RemoveEffect("TutorialFlagpoleIronComponents");
|
||||
RemoveEffect("TutorialFlagpoleIronSmelt");
|
||||
for(var i=0; i<GetPlayerCount(); ++i) // probably overkill
|
||||
SetPlrKnowledge(GetPlayerByIndex(i), WindGenerator);
|
||||
guide->AddGuideMessage("$MsgTutEnergy$");
|
||||
AddEffect("TutorialEnergy", nil, 1, 18);
|
||||
}
|
||||
|
||||
|
||||
global func FxTutorialEnergyTimer(object tg, e, tm) {
|
||||
for (var wg in FindObjects(Find_ID(Flagpole)))
|
||||
if (wg.lflag && wg.lflag.power_helper && (wg.lflag.power_helper.power_balance > 0))
|
||||
return -1;
|
||||
}
|
||||
|
||||
global func FxTutorialEnergyStop(object tg, e, tm) {
|
||||
for(var building in [SteamEngine, ToolsWorkshop, Sawmill, Elevator, Pump, Compensator, Windmill, WoodenCabin])
|
||||
for(var i = GetPlayerCount(); i--;)
|
||||
SetPlrKnowledge(GetPlayerByIndex(i), building);
|
||||
guide->ClearGuideMessage();
|
||||
GameOver();
|
||||
}
|
||||
|
||||
|
||||
protected func OnGuideMessageShown(int plr, int index)
|
||||
{
|
||||
// Show where the guide is located in the HUD.
|
||||
if (index == 3)
|
||||
TutArrowShowGUIPos(guide->GetX(), guide->GetY() / 2, 0, 10+guide->GetDefHeight());
|
||||
// Show the tools
|
||||
if (index == 2) //show shovel
|
||||
TutArrowShowTarget(FindObject(Find_ID(Shovel)));
|
||||
if (index == 2 || index == 4) // show hammer
|
||||
TutArrowShowTarget(FindObject(Find_ID(Hammer)));
|
||||
if (index == 2 || index == 5) // show axe
|
||||
TutArrowShowTarget(FindObject(Find_ID(Axe)));
|
||||
// Show a tree, a chopped one if possible
|
||||
if (index == 6)
|
||||
{
|
||||
var tree = FindObject(Find_ID(Tree_Coniferous), Find_Not(Find_Category(C4D_StaticBack)));
|
||||
if (!tree) tree = FindObject(Find_ID(Tree_Coniferous), Sort_Distance(GetCursor(plr)->GetX(),GetCursor(plr)->GetY()));
|
||||
if (tree) TutArrowShowTarget(tree, 225, 25);
|
||||
}
|
||||
// Show foundry
|
||||
if (index == 14)
|
||||
TutArrowShowTarget(FindObject(Find_ID(Foundry)), 225, 30);
|
||||
// Show stone vein and flint close to it
|
||||
if (index == 7)
|
||||
{
|
||||
TutArrowShowPos(200, 430, 225);
|
||||
TutArrowShowTarget(FindObject(Find_ID(Firestone), Sort_Distance(200,350/*y arbitrary*/)), 0);
|
||||
}
|
||||
// Show ore/coal vein and flint close to it
|
||||
if (index == 12)
|
||||
{
|
||||
TutArrowShowPos(540, 450, 135);
|
||||
TutArrowShowTarget(FindObject(Find_ID(Firestone), Sort_Distance(540,350/*y arbitrary*/)), 0);
|
||||
}
|
||||
// Show crafted metal bar
|
||||
if (index == 16 && FindObject(Find_ID(Metal)))
|
||||
TutArrowShowTarget(FindObject(Find_ID(Metal)), 225);
|
||||
}
|
||||
|
||||
protected func OnGuideMessageRemoved(int plr, int index)
|
||||
{
|
||||
TutArrowClear();
|
||||
return;
|
||||
}
|
||||
|
||||
/*-- Clonk restoring --*/
|
||||
|
||||
// Relaunches the clonk, from death or removal.
|
||||
global func FxClonkRestoreStop(object target, effect, int reason, bool temporary)
|
||||
{
|
||||
if (reason == 3 || reason == 4)
|
||||
{
|
||||
var restorer = CreateObject(ObjectRestorer, 0, 0, NO_OWNER);
|
||||
var x = BoundBy(target->GetX(), 0, LandscapeWidth());
|
||||
var y = BoundBy(target->GetY(), 0, LandscapeHeight());
|
||||
restorer->SetPosition(x, y);
|
||||
var to_x = effect.var1;
|
||||
var to_y = effect.var2;
|
||||
// Respawn new clonk.
|
||||
var plr = target->GetOwner();
|
||||
var clonk = CreateObject(Clonk, 0, 0, plr);
|
||||
clonk->GrabObjectInfo(target);
|
||||
SetCursor(plr, clonk);
|
||||
clonk->DoEnergy(100000);
|
||||
restorer->SetRestoreObject(clonk, nil, to_x, to_y, "ClonkRestore");
|
||||
}
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
MsgTutIntro0=Wilkommen zum Siedlungstutorial von OpenClonk.
|
||||
MsgTutIntro1=Ich habe dich in diese idyllische Landschaft katapultiert, um dir die ersten Schritte des Siedlungsbaus zu zeigen.
|
||||
MsgTutIntro2=Alles was du brauchen wirst sind die Grundwerkzeuge, die du bereits bei dir hast.
|
||||
MsgTutIntro3=Wenn du an einer Stelle einen Tipp brauchst, klicke auf mein Bildchen in der oberen linken Ecke des Bildschirms. Klicke nochmal, um den Tipp wieder zu schließen.
|
||||
MsgTutFoundrySite=Das erste Gebäude, das wir brauchen, ist der Hochofen. Benutze deinen Hammer um eine Baustelle zu errichten!
|
||||
MsgTutFoundryChopTree=Wie du siehst braucht der Hochofen 4 Stein und 2 Holz. Nimm dir deine Axt und fang damit an einen Baum umzuhacken!
|
||||
MsgTutFoundryHackTree=Du hast den Baum schon gefällt, jetzt musst du ihn noch in kleine Stücke zerhacken. Schwing einfach schön weiter deine Axt!
|
||||
MsgTutFoundryStoneBlast=Nun brauchen wir noch Stein. Dazu gräbst du einen Feuerstein aus und sprengst damit etwas vom Vorkommen unten links ab.
|
||||
MsgTutFoundryMaterialUse=Gut. Nimm nun das ganze Material und befördere es in die Baustelle. Du kannst es mit [S] aufnehmen wenn du stehst und mit [E] in der Baustelle ablegen. Bau den Hochofen fertig.
|
||||
MsgTutFlagpoleSite=Das nächste Gebäude, das wir brauchen, ist ein Flaggenmast. Such dir einen schönen Platz dafür aus und errichte eine Baustelle!
|
||||
MsgTutFlagpoleIronComponents=Wie du siehst braucht die Flagge 4 Holz und 1 Eisen. Um das Eisen herzustellen musst du aus der rechten Ader Eisenerz freisprengen, wie bei den Steinen, und Kohle ausgraben.
|
||||
MsgTutFlagpoleIronSmelt=Nun da du Kohle und Erz hast, bringe sie in den Hochofen. (Hinenlegen mit [E]) Mit [Leertaste] öffnest du das Produktionsmenü. Wähle das Metallstück aus und warte.
|
||||
MsgTutFlagpoleIronPraise=Sehr gut. So wie hier funktioniert jeder Produktionsvorgang in OpenClonk!||Nun musst du nur noch ein wenig Holz fällen um die Flagge fertig zu bauen.
|
||||
MsgTutEnergy=Wie du siehst überspannt der Flaggenmast ein gewisses Gebiet. Darin können Gegner nicht bauen und Gebäude versorgen sich gegenseitig mit Energie.|Meine letzte Aufgabe für dich ist: Baue ein Windrad, das den Flaggenmast versorgt. Danach kannst du ausprobieren was du willst, ein Sägewerk oder eine Werkstätte vielleicht?
|
|
@ -0,0 +1,21 @@
|
|||
# Dialogue options
|
||||
MsgNextTutorial=&Next tutorial
|
||||
MsgNextTutorialDesc=Start the next tutorial scenario.
|
||||
MsgRepeatRound=&Repeat this round
|
||||
MsgRepeatRoundDesc=Restart this scenario.
|
||||
|
||||
# Tutorial messages
|
||||
MsgTutIntro0=Welcome to the settlement tutorial of OpenClonk!
|
||||
MsgTutIntro1=I've thrown you into this idyllic landscape to teach you the basic steps of creating a settlement.
|
||||
MsgTutIntro2=All you need are the three basic tools you were given.
|
||||
MsgTutIntro3=If at any time you need help, click on my icon in the upper right corner of the screen. Once you're done reading, click again on the icon to hide the message.
|
||||
MsgTutFoundrySite=The first thing we are going to do is creating a construction site for a foundry. To do that, use the hammer and position the building somewhere to your liking.
|
||||
MsgTutFoundryChopTree=As you can see, the the foundry requires 2 wood logs and 4 stones to be constructed. Take your axe and start by chopping down a tree with your axe to obtain wood.
|
||||
MsgTutFoundryHackTree=Now that you chopped down the tree, you will have to chop it to pieces, just continue swinging your axe.
|
||||
MsgTutFoundryStoneBlast=Now you will have to get some stones. Try using a firestone to mine some from the stone vein on the left side.
|
||||
MsgTutFoundryMaterialUse=Good! Now, collect the materials and carry them to the foundry's site.||Finish the construction either by just inserting the stones via contents menu [E] or selecting construction via [Space]+[Number].
|
||||
MsgTutFlagpoleSite=The next step is building a flagpole. Again, use the hammer to create a construction site, but make sure to select the flagpole from the menu.
|
||||
MsgTutFlagpoleIronComponents=As you can see, the flag pole requires 4 wood and one metal. Start by digging out some coal and blasting free some chucks of ore from the vein on the right.
|
||||
MsgTutFlagpoleIronSmelt=Now, place the coal and the iron in the foundry (contents menu with [E]) and select the iron bar in the production menu, which can be opened by pressing [Space] when standing in front of the foundry.
|
||||
MsgTutFlagpoleIronPraise=Very good, you've produced the first good. All other goods production works the exact same way!||Now, process two trees for the remaining 4 wood you need and build the flagpole.
|
||||
MsgTutEnergy=As you can see, the flagpole spans a certain area. Within this area, buildings power each other and enemies can't build. My last assignment for you is building a windmill, which will power further buildings like a tools workshop or a sawmill.
|
|
@ -0,0 +1,2 @@
|
|||
DE:Siedlungsbau
|
||||
US:Settlement
|
|
@ -0,0 +1,3 @@
|
|||
src/script/C4Script.cpp
|
||||
src/gamescript/C4GameScript.cpp
|
||||
src/object/C4ObjectScript.cpp
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <StdFile.h>
|
||||
#include <StdRegistry.h>
|
||||
#include <StdGL.h>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "ClonkAppDelegate.h"
|
||||
|
|
|
@ -42,7 +42,12 @@
|
|||
// activate to switch to classic fixed-point math
|
||||
#define C4REAL_USE_FIXNUM 1
|
||||
#define inline ALWAYS_INLINE
|
||||
#define FIXED_EMULATE_64BIT
|
||||
|
||||
// gcc 4.6 generates better code for FIXED_EMULATE_64BIT disablen for both
|
||||
// 32 and 64 bit. It properly recognizes that the 32,32->64 multiplication
|
||||
// instruction of the x86 is the right choice for the job whereas the more
|
||||
// complicated FIXED_EMULATE_64BIT version requires multiple multiplications
|
||||
//#define FIXED_EMULATE_64BIT
|
||||
|
||||
// note: C4Fixed has to be defined even though it isn't used
|
||||
// any more. It is used to convert old-format fixed values
|
||||
|
@ -148,11 +153,11 @@ public:
|
|||
#ifndef FIXED_EMULATE_64BIT
|
||||
val = int32_t( (int64_t(val) * fVal2.val) / FIXED_FPF );
|
||||
#else
|
||||
int32_t x0 = val & (FIXED_FPF - 1),
|
||||
x1 = val >> FIXED_SHIFT;
|
||||
int32_t y0 = fVal2.val & (FIXED_FPF - 1),
|
||||
y1 = fVal2.val >> FIXED_SHIFT;
|
||||
val = x0*y0/FIXED_FPF + x0*y1 + x1*y0 + x1*y1*FIXED_FPF;
|
||||
uint32_t x0 = val & (FIXED_FPF - 1);
|
||||
int32_t x1 = val >> FIXED_SHIFT;
|
||||
uint32_t y0 = fVal2.val & (FIXED_FPF - 1);
|
||||
int32_t y1 = fVal2.val >> FIXED_SHIFT;
|
||||
val = int32_t(x0*y0/FIXED_FPF) + int32_t(x0)*y1 + x1*int32_t(y0) + x1*y1*FIXED_FPF;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -781,7 +781,7 @@ void C4Object::SetOCF()
|
|||
if (OnFire)
|
||||
OCF|=OCF_OnFire;
|
||||
// OCF_Inflammable: Is not burning and is inflammable
|
||||
if (!OnFire && Def->GetPropertyInt(P_ContactIncinerate) > 0)
|
||||
if (!OnFire && GetPropertyInt(P_ContactIncinerate) > 0)
|
||||
OCF|=OCF_Inflammable;
|
||||
// OCF_FullCon: Is fully completed/grown
|
||||
if (Con>=FullCon)
|
||||
|
@ -967,7 +967,7 @@ bool C4Object::ExecLife()
|
|||
if (!::Game.iTick10)
|
||||
if (InMat!=MNone)
|
||||
if (::MaterialMap.Map[InMat].Incindiary)
|
||||
if (Def->GetPropertyInt(P_ContactIncinerate) > 0)
|
||||
if (GetPropertyInt(P_ContactIncinerate) > 0)
|
||||
{
|
||||
C4AulFunc *pCallFunc = GetFunc(PSF_OnInIncendiaryMaterial);
|
||||
if (pCallFunc)
|
||||
|
@ -1254,8 +1254,8 @@ void C4Object::Blast(int32_t iLevel, int32_t iCausedBy)
|
|||
// Energy (alive objects)
|
||||
if (Alive) DoEnergy(-iLevel/3,false,C4FxCall_EngBlast, iCausedBy);
|
||||
// Incinerate
|
||||
if (Def->GetPropertyInt(P_BlastIncinerate))
|
||||
if (Damage >= Def->GetPropertyInt(P_BlastIncinerate))
|
||||
if (GetPropertyInt(P_BlastIncinerate))
|
||||
if (Damage >= GetPropertyInt(P_BlastIncinerate))
|
||||
{
|
||||
C4AulFunc *pCallFunc = GetFunc(PSF_OnBlastIncinerationDamage);
|
||||
if (pCallFunc)
|
||||
|
|
|
@ -110,6 +110,8 @@ void C4AulExec::LogCallStack()
|
|||
|
||||
void C4AulExec::ClearPointers(C4Object * obj)
|
||||
{
|
||||
#if 0
|
||||
// FIXME: reactivate this code and remove the checks from Call once scripts are fixed
|
||||
for (C4AulScriptContext *pCtx = pCurCtx; pCtx >= Contexts; pCtx--)
|
||||
{
|
||||
if (pCtx->Obj == obj)
|
||||
|
@ -117,6 +119,7 @@ void C4AulExec::ClearPointers(C4Object * obj)
|
|||
if (pCtx->Def == obj)
|
||||
pCtx->Def = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
C4Value C4AulExec::Exec(C4AulScriptFunc *pSFunc, C4PropList * p, C4Value *pnPars, bool fPassErrors, bool fTemporaryScript)
|
||||
|
@ -826,6 +829,8 @@ C4AulBCC *C4AulExec::Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4
|
|||
// Push a new context
|
||||
C4AulScriptContext ctx;
|
||||
ctx.Obj = pContext ? pContext->GetObject() : 0;
|
||||
if (ctx.Obj && !ctx.Obj->Status)
|
||||
throw new C4AulExecError(ctx.Obj, "using removed object");
|
||||
ctx.Def = pContext;
|
||||
ctx.Caller = pCurCtx;
|
||||
ctx.Return = pReturn;
|
||||
|
@ -851,6 +856,8 @@ C4AulBCC *C4AulExec::Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4
|
|||
// Create new context
|
||||
C4AulContext ctx;
|
||||
ctx.Obj = pContext ? pContext->GetObject() : 0;
|
||||
if (ctx.Obj && !ctx.Obj->Status)
|
||||
throw new C4AulExecError(ctx.Obj, "using removed object");
|
||||
ctx.Def = pContext;
|
||||
ctx.Caller = pCurCtx;
|
||||
|
||||
|
|
Loading…
Reference in New Issue