Merge remote-tracking branch 'master' into liquid_container

liquid_container
Mark 2016-02-20 21:17:59 +01:00
commit af6a31c489
11 changed files with 80 additions and 40 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -480,17 +480,7 @@ private func Death()
this.BorderBound = 0;
this.ContactCalls = false;
// Decay the dead bat.
AddTimer(this.Decaying, 100);
return;
}
private func Decaying()
{
if (GetCon() < 20)
return RemoveObject();
DoCon(-1);
return;
Decay();
}

View File

@ -93,7 +93,7 @@ func Death()
this.MeshTransformation = Trans_Rotate(160 + Random(41), 1, 0, 0);
if (base_transform) this.MeshTransformation = Trans_Mul(base_transform, this.MeshTransformation);
StopAnimation(swim_animation);
AddTimer(this.Decaying, 500);
Decay();
this.Collectible = true;
// maybe respawn a new fish if roe is near
@ -104,12 +104,6 @@ func Death()
return _inherited(...);
}
func Decaying()
{
if (GetCon()<20) RemoveObject(); else DoCon(-5);
return true;
}
protected func ControlUse(object clonk, int iX, int iY)
{
clonk->Eat(this);

View File

@ -136,7 +136,7 @@ public func Death()
{
RemoveTimer(this.UpdateSwim);
RemoveTimer(this.Activity);
AddTimer(this.Decaying, 500);
Decay();
this.Collectible = true;
this.MeshTransformation = base_transform;
@ -155,12 +155,6 @@ public func CatchBlow()
DoInk();
}
private func Decaying()
{
if (GetCon()<20) RemoveObject(); else DoCon(-5);
return true;
}
public func ControlUse(object clonk, int iX, int iY)
{
clonk->Eat(this);

View File

@ -742,7 +742,16 @@ func SetPortrait(proplist custom_portrait)
return true;
}
public func CommandFailure() { return PlaySoundDoubt(); } // Callback from the engine when a command failed
// Callback from the engine when a command failed.
public func CommandFailure(string command, object target)
{
// Don't play a sound when an exit command fails (this is a hotfix, because exiting fails all the time).
if (command == "Exit")
return;
// Otherwise play a sound that the clonk is doubting this command.
PlaySoundDoubt();
return;
}
/* Magic */

View File

@ -10,15 +10,17 @@ local attached_mesh;
local last_free;
local mat_color;
public func Place(int amount, proplist area)
public func Place(int amount, proplist area, proplist settings)
{
area = area ?? Shape->LandscapeRectangle();
var diamond_sockets = [];
var failsafe = amount * 100;
while((amount > 0) && (--failsafe > 0))
{
// select cluster
var c_size = Min(5 + RandomX(-1, 1), amount);
var c_size = Min(RandomX(4, 6), amount);
if (settings != nil && settings.cluster_size != nil)
c_size = Min(settings.cluster_size, amount);
// look for random in-earth position
var failsafe2 = 500;
@ -27,11 +29,12 @@ public func Place(int amount, proplist area)
{
if (!area->GetRandomPoint(pt)) break;
if(!GBackSolid(pt.x, pt.y)) continue;
if (!GBackSolid(pt.x, pt.y)) continue;
// must be diggable
var mat = GetMaterial(pt.x, pt.y);
if(!GetMaterialVal("DigFree","Material",mat)) continue;
if (!GetMaterialVal("DigFree","Material",mat))
continue;
break;
}
@ -58,10 +61,12 @@ public func Place(int amount, proplist area)
++i;
var socket = CreateObject(this, mx, my, NO_OWNER);
socket->Set(r2, g2, b2);
PushBack(diamond_sockets, socket);
}
amount -= i;
}
return diamond_sockets;
}
public func Construction()

View File

@ -155,7 +155,8 @@ public func ControlUseHolding(object clonk, ix, iy)
if(target_object)
{
if(Distance(target_object->GetX(), target_object->GetY(), clonk->GetX() + ix, clonk->GetY() + iy) > radius ||
Distance(target_object->GetX(), target_object->GetY(), clonk->GetX(), clonk->GetY()) > GetTeleGloveReach())
Distance(target_object->GetX(), target_object->GetY(), clonk->GetX(), clonk->GetY()) > GetTeleGloveReach() ||
target_object->~RejectTeleGloveControl(this))
{
LostTargetObject(target);
target_object = nil;
@ -169,6 +170,7 @@ public func ControlUseHolding(object clonk, ix, iy)
Find_Category(C4D_Object),
Find_And(Find_Distance(radius, ix, iy),
Find_Distance(GetTeleGloveReach() - 15)),
Find_Not(Find_Func("RejectTeleGloveControl", this)),
Sort_Distance(ix,iy));
if(target)

View File

@ -0,0 +1,26 @@
/**
Animals can use Decay() in their Death() function so they will slowly decay and spawn a few temporary flies.
*/
global func Decay()
{
AddEffect("Decaying", this, 1, 500);
if (!GBackSemiSolid())
{
var rnd = Random(4);
for (var i = 0; i < rnd; i++)
{
var mos = CreateObject(Mosquito);
ScheduleCall(mos, "RemoveObject", 9000 + Random(300));
}
}
}
global func FxDecayingTimer(object target)
{
if (target->GetCon() < 20)
target->RemoveObject();
else
target->DoCon(-5);
return true;
}

View File

@ -1070,6 +1070,22 @@ global func Test57_OnStart(object victim, object killer, object fake_killer)
return true;
}
global func Test58_Log() { return "K uses bomb arrow to shoot V out of map"; }
global func Test58_OnStart(object victim, object killer, object fake_killer)
{
DrawMaterialQuad("Sky:Sky", 100, 0, LandscapeWidth(), 0, LandscapeWidth(), LandscapeHeight(), 100, LandscapeHeight());
ClearFreeRect(100, 0, LandscapeWidth() - 100, LandscapeHeight());
victim->SetPosition(96, 150);
ScheduleCall(victim, "ControlJump", 8, 0);
var bow = killer->CreateContents(Bow);
bow->CreateContents(BombArrow);
bow->ControlUseStart(killer, 20, -20);
bow->ControlUseStop(killer, 20, -20);
return true;
}
/*-- Wiki Overview Table --*/

View File

@ -34,10 +34,10 @@ const int32_t C4StartupScenSel_DefaultIcon_Scenario = 14,
C4StartupScenSel_DefaultIcon_WinFolder = 44,
C4StartupScenSel_DefaultIcon_OldIconBG = 18,
C4StartupScenSel_IconCount = 45,
C4StartupScenSel_TitlePictureWdt = 200,
C4StartupScenSel_TitlePictureHgt = 150,
C4StartupScenSel_TitlePictureWdt = 640,
C4StartupScenSel_TitlePictureHgt = 480,
C4StartupScenSel_TitlePicturePadding = 10,
C4StartupScenSel_TitleOverlayMargin = 10, // number of pixels to each side of title overlay picture
C4StartupScenSel_TitleOverlayMargin = 20, // number of pixels to each side of title overlay picture
C4StartupScenSel_MaxAchievements = 3; // maximum number of achievements shown next to entry
// a list of loaded scenarios

View File

@ -895,12 +895,16 @@ void C4Command::Drop()
void C4Command::Jump()
{
// Already in air and target position given
if (cObj->GetProcedure()==DFA_FLIGHT && Tx._getInt())
// Already in air?
if (cObj->GetProcedure()==DFA_FLIGHT)
{
if (cObj->GetX()<Tx._getInt()) cObj->Action.ComDir=COMD_Right;
else if (cObj->GetX()>Tx._getInt()) cObj->Action.ComDir=COMD_Left;
else cObj->Action.ComDir=COMD_Stop;
// Check whether target position is given
if (Tx._getInt())
{
if (cObj->GetX()<Tx._getInt()) cObj->Action.ComDir=COMD_Right;
else if (cObj->GetX()>Tx._getInt()) cObj->Action.ComDir=COMD_Left;
else cObj->Action.ComDir=COMD_Stop;
}
}
else
{