From aac6a3ee2ee219b6c320c7ebccb2ac10e7e16485 Mon Sep 17 00:00:00 2001 From: Mittendrein Markus Date: Wed, 14 Dec 2016 19:22:31 +0100 Subject: Update --- System.c4g/DTSelectionContext.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/System.c4g/DTSelectionContext.c b/System.c4g/DTSelectionContext.c index 794029c..998c6f5 100644 --- a/System.c4g/DTSelectionContext.c +++ b/System.c4g/DTSelectionContext.c @@ -52,7 +52,7 @@ func FxIntShowSelectionTimer(object target, int effectNumber) else { var obj = selectionObjects[GetMenuSelection(target)]; - if(!obj) + if(!obj || (GetType(obj) == C4V_Array && !obj[0])) { if(selectMark) { @@ -227,16 +227,29 @@ func AtObjectWithLines() return !Contained() && FindConnections(true); } +global func HasLine(bool lineCheck, object target) +{ + if(lineCheck) + { + return GetProcedure() == "CONNECT" && (GetActionTarget(0) == target || GetActionTarget(1) == target); + } + else + { + return FindObject2(Find_Func("HasLine", true, this)); + } +} + func FindConnections(bool single) { - var targets = FindObjects(Find_OCF(OCF_LineConstruct), Find_AtPoint(), Find_Exclude(this)); + var targets = FindObjects(Find_AtPoint(), Find_Exclude(this), Find_Or(Find_OCF(OCF_LineConstruct), Find_Func("HasLine"))); var connections = []; for(var target in targets) { var lines = FindObjects(Find_Action("Connect"), Find_Or(Find_ActionTarget(target), Find_ActionTarget2(target))); for(var line in lines) { - if(GetID(GetActionTarget(0, line)) == LNKT || GetID(GetActionTarget(1, line)) == LNKT) // not connected on the other side + var kit = line->~KitID() || LNKT; + if(GetID(GetActionTarget(0, line)) == kit || GetID(GetActionTarget(1, line)) == kit) // not connected on the other side { continue; } @@ -346,7 +359,7 @@ func RemoveLineEntry(id id, int pos) return false; } - var lnkt = CreateObject(LNKT, 0, 0, GetOwner()); + var lnkt = CreateObject(connection[1]->~KitID() || LNKT, 0, 0, GetOwner()); Collect(lnkt); Sound("Connect"); if(GetActionTarget(0, connection[1]) == connection[0]) @@ -366,14 +379,15 @@ func ControlDigDouble() var ret = _inherited(...); if(!ret) { - if((GetProcedure() == "WALK" || GetProcedure() == "DIG" || GetProcedure() == "SWIM")) + if(GetProcedure() == "WALK" || GetProcedure() == "DIG" || GetProcedure() == "SWIM") { if(Contents() && Contents()->~Activate(this)) { return true; } - else if((AtTreeToChop() && GetProcedure() != "SWIM") && ContextChop()) + else if(AtTreeToChop() && GetProcedure() != "SWIM") { + SetAllCursorsCommand(GetController(this), "Chop", FindTree()); return true; } else if(AtObjectWithLines()) -- cgit v1.2.3-54-g00ecf