forked from Mirrors/openclonk
decrease NoCollectDelay on handled controls
dont use up loam if bridge couldn't be startedstable-5.2
parent
71cdc8e681
commit
ff0c0a6c96
|
@ -19,17 +19,15 @@ func Hit()
|
|||
func ControlUse(object clonk, int x, int y)
|
||||
{
|
||||
// Clonk must stand on ground
|
||||
if(clonk->GetAction() == "Walk")
|
||||
{
|
||||
// Gfx
|
||||
clonk->SetAction("Bridge");
|
||||
clonk->SetComDir(COMD_None);
|
||||
clonk->SetXDir(0);
|
||||
clonk->SetYDir(0);
|
||||
last_x = BoundBy(x,-0,0)+GetX(); last_y = clonk->GetDefBottom()+3;
|
||||
last_frame = begin_frame = FrameCounter();
|
||||
}
|
||||
return true;
|
||||
if(clonk->GetAction() != "Walk") return false;
|
||||
|
||||
// Gfx
|
||||
clonk->SetAction("Bridge");
|
||||
clonk->SetComDir(COMD_None);
|
||||
clonk->SetXDir(0);
|
||||
clonk->SetYDir(0);
|
||||
last_x = BoundBy(x,-0,0)+GetX(); last_y = clonk->GetDefBottom()+3;
|
||||
last_frame = begin_frame = FrameCounter();
|
||||
}
|
||||
|
||||
func HoldingEnabled() { return true; }
|
||||
|
|
|
@ -32,7 +32,11 @@ global func PlayerControl(int plr, int ctrl, id spec_id, int x, int y, int stren
|
|||
// Overload by effect?
|
||||
if (cursor->Control2Effect(plr, ctrl, cursorX, cursorY, strength, repeat, release)) return true;
|
||||
|
||||
return cursor->ObjectControl(plr, ctrl, cursorX, cursorY, strength, repeat, release);
|
||||
if (cursor->ObjectControl(plr, ctrl, cursorX, cursorY, strength, repeat, release))
|
||||
{
|
||||
if (cursor && !release && !repeat) cursor->DoNoCollectDelay(-1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// No cursor? Nothing to handle control then
|
||||
return false;
|
||||
|
|
|
@ -5523,6 +5523,12 @@ static bool FnGetPlayerControlEnabled(C4AulContext *ctx, long iplr, long ctrl)
|
|||
return !plrctrl->IsControlDisabled(ctrl);
|
||||
}
|
||||
|
||||
static C4Void FnDoNoCollectDelay(C4AulObjectContext *ctx, int change)
|
||||
{
|
||||
ctx->Obj->NoCollectDelay = Max<int32_t>(ctx->Obj->NoCollectDelay + change, 0);
|
||||
return C4VNull;
|
||||
}
|
||||
|
||||
//=========================== C4Script Function Map ===================================
|
||||
|
||||
// defined function class
|
||||
|
@ -6013,6 +6019,7 @@ void InitFunctionMap(C4AulScriptEngine *pEngine)
|
|||
AddFunc(pEngine, "GetGravity", FnGetGravity);
|
||||
AddFunc(pEngine, "Exit", FnExit);
|
||||
AddFunc(pEngine, "Collect", FnCollect);
|
||||
AddFunc(pEngine, "DoNoCollectDelay", FnDoNoCollectDelay);
|
||||
|
||||
AddFunc(pEngine, "Translate", FnTranslate);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue