forked from Mirrors/openclonk
Added simple construction-site-blocking check
parent
219bceefcd
commit
a687b0f85c
|
@ -4,4 +4,4 @@ Version=4,10,0,0
|
|||
Category=C4D_StaticBack
|
||||
Width=16
|
||||
Height=16
|
||||
Offset=-8,-16
|
||||
Offset=-8,-16
|
|
@ -217,6 +217,20 @@ func CreateConstructionSite(object clonk, id structure_id, int x, int y)
|
|||
//if(!(site = CreateConstruction(structure_id, x, y, Contained()->GetOwner(), 1, 1, 1)))
|
||||
//return false;
|
||||
|
||||
// intersection-check with all other construction sites... bah
|
||||
for(var other_site in FindObjects(Find_ID(ConstructionSite), Find_Exclude(site)))
|
||||
{
|
||||
if(!(other_site->GetLeftEdge() > site->GetRightEdge() ||
|
||||
other_site->GetRightEdge() < site->GetLeftEdge() ||
|
||||
other_site->GetTopEdge() > site->GetBottomEdge() ||
|
||||
other_site->GetBottomEdge() < site->GetTopEdge() ))
|
||||
{
|
||||
CustomMessage(Format("Construction blocked by %s",other_site->GetName()), this, clonk->GetOwner()); // todo: stringtable
|
||||
site->RemoveObject();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// check for material
|
||||
var comp, index = 0;
|
||||
var mat;
|
||||
|
|
Loading…
Reference in New Issue