diff --git a/planet/Objects.c4d/Items.c4d/Weapons.c4d/Bow.c4d/Script.c b/planet/Objects.c4d/Items.c4d/Weapons.c4d/Bow.c4d/Script.c index f77a98689..acb30c89e 100644 --- a/planet/Objects.c4d/Items.c4d/Weapons.c4d/Bow.c4d/Script.c +++ b/planet/Objects.c4d/Items.c4d/Weapons.c4d/Bow.c4d/Script.c @@ -103,15 +103,7 @@ public func ControlUseHolding(object clonk, int x, int y) } else { - // Turn clonk if aiming in the other direction and he isn't moving - if(!ClonkAimLimit(clonk,angle)) - if(clonk->GetComDir() == COMD_Stop && !clonk->GetXDir()) - { - if(clonk->GetDir() == 1 && angle < 0) clonk->SetDir(0); - else if(clonk->GetDir() == 0 && angle > 0) clonk->SetDir(1); - } if(Abs(angle) > 160) angle = 160; - // Adjust the aiming position var pos = clonk->GetAnimationPosition(iAnimLoad); pos += BoundBy(2000*Abs(angle)/180-pos, -100, 100); diff --git a/planet/Objects.c4d/Items.c4d/Weapons.c4d/Club.c4d/Script.c b/planet/Objects.c4d/Items.c4d/Weapons.c4d/Club.c4d/Script.c index 3f034293f..09030f1a7 100644 --- a/planet/Objects.c4d/Items.c4d/Weapons.c4d/Club.c4d/Script.c +++ b/planet/Objects.c4d/Items.c4d/Weapons.c4d/Club.c4d/Script.c @@ -61,12 +61,6 @@ public func ControlUseHolding(object clonk, int x, int y) clonk->SetAnimationWeight(iAimKnot, Anim_Const(Abs(angle)*1000/180)); - // Turn clonk if aiming in the other direction and he isn't moving - if(clonk->GetComDir() == COMD_Stop && !clonk->GetXDir()) - { - if(clonk->GetDir() == 1 && angle < 0) clonk->SetDir(0); - else if(clonk->GetDir() == 0 && angle > 0) clonk->SetDir(1); - } } protected func ControlUseStop(object clonk, int x, int y) diff --git a/planet/Objects.c4d/Items.c4d/Weapons.c4d/Javelin.c4d/Script.c b/planet/Objects.c4d/Items.c4d/Weapons.c4d/Javelin.c4d/Script.c index 442106ae6..c8d5d2a2c 100644 --- a/planet/Objects.c4d/Items.c4d/Weapons.c4d/Javelin.c4d/Script.c +++ b/planet/Objects.c4d/Items.c4d/Weapons.c4d/Javelin.c4d/Script.c @@ -70,11 +70,7 @@ protected func ControlUseHolding(object pClonk, int ix, int iy) var iPos = pClonk->GetAnimationPosition(iAim); iPos += BoundBy(iTargetPosition-iPos, -50, 50); pClonk->SetAnimationPosition(iAim, Anim_Const(iPos)); - if( (pClonk->GetComDir() == COMD_Stop && !pClonk->GetXDir()) || pClonk->GetAction() == "Jump") - { - if(pClonk->GetDir() == 1 && angle < 0) pClonk->SetDir(0); - else if(pClonk->GetDir() == 0 && angle > 0) pClonk->SetDir(1); - } + return 1; } diff --git a/planet/Objects.c4d/Items.c4d/Weapons.c4d/Musket.c4d/Script.c b/planet/Objects.c4d/Items.c4d/Weapons.c4d/Musket.c4d/Script.c index a1a48adf1..7cf349913 100644 --- a/planet/Objects.c4d/Items.c4d/Weapons.c4d/Musket.c4d/Script.c +++ b/planet/Objects.c4d/Items.c4d/Weapons.c4d/Musket.c4d/Script.c @@ -139,11 +139,6 @@ func ControlUseHolding(object pClonk, ix, iy) var iPos = pClonk->GetAnimationPosition(iAim); iPos += BoundBy(iTargetPosition-iPos, -50, 50); pClonk->SetAnimationPosition(iAim, Anim_Const(iPos)); - if( (pClonk->GetComDir() == COMD_Stop && !pClonk->GetXDir()) || pClonk->GetAction() == "Jump") - { - if(pClonk->GetDir() == 1 && angle < 0) pClonk->SetDir(0); - else if(pClonk->GetDir() == 0 && angle > 0) pClonk->SetDir(1); - } } return true; diff --git a/planet/Objects.c4d/Libraries.c4d/ClonkControl.c4d/Crosshair.c4d/Script.c b/planet/Objects.c4d/Libraries.c4d/ClonkControl.c4d/Crosshair.c4d/Script.c index 712d1cd04..77b8077f2 100644 --- a/planet/Objects.c4d/Libraries.c4d/ClonkControl.c4d/Crosshair.c4d/Script.c +++ b/planet/Objects.c4d/Libraries.c4d/ClonkControl.c4d/Crosshair.c4d/Script.c @@ -84,20 +84,6 @@ private func UpdatePosition() var x = +Sin(angle,CURSOR_Radius,10); var y = -Cos(angle,CURSOR_Radius,10); - if((crew->GetComDir() == COMD_Stop && crew->GetXDir() == 0) || crew->GetProcedure() == "FLIGHT") - { - if(crew->GetDir() == DIR_Left) - { - if(x > 0) - crew->SetDir(DIR_Right); - } - else - { - if(x < 0) - crew->SetDir(DIR_Left); - } - } - SetPosition(crew->GetX()+x,crew->GetY()+y); crew->UpdateVirtualCursorPos(); } diff --git a/planet/Objects.c4d/Libraries.c4d/ClonkControl.c4d/Script.c b/planet/Objects.c4d/Libraries.c4d/ClonkControl.c4d/Script.c index d1045904f..c52484336 100644 --- a/planet/Objects.c4d/Libraries.c4d/ClonkControl.c4d/Script.c +++ b/planet/Objects.c4d/Libraries.c4d/ClonkControl.c4d/Script.c @@ -673,6 +673,39 @@ private func HoldingUseControl(int ctrl, control, int x, int y, object obj) } //Message("%d,%d",this,mex,mey); + + // automatic adjustment of the position + // -------------------- + // if this is desired for ALL objects is the question, we will find out. + // For now, this is done for items and vehicles, not for buildings and + // mounts (naturally). If turning vehicles just liket hat without issuing + // a turning animation is the question. But after all, the clonk can turn + // by setting the dir too. + + + // not riding and not in building + if (GetProcedure() != "ATTACH" && !Contained()) + { + // pushing vehicle: object to turn is the vehicle + var dir_obj = GetActionTarget(); + + // otherwise, turn the clonk + if(!dir_obj) dir_obj = this; + + if ((dir_obj->GetComDir() == COMD_Stop && dir_obj->GetXDir() == 0) || dir_obj->GetProcedure() == "FLIGHT") + { + if (dir_obj->GetDir() == DIR_Left) + { + if (mex > 0) + dir_obj->SetDir(DIR_Right); + } + else + { + if (mex < 0) + dir_obj->SetDir(DIR_Left); + } + } + } var handled = obj->Call(Format("~%sUse%sHolding",control,estr),this,mex,mey);