Skip to content
Permalink
Browse files

fix some more structure vertices, also for asymmetric ones when flipp…

…ed (#1979)
  • Loading branch information
MDT-Maikel committed Jan 31, 2018
1 parent 18bb837 commit 9e01a861ce4322df8a63f1dcb84cd49ca76d37b9
@@ -453,8 +453,20 @@ public func OnRepairMenuHover(id symbol, string action, desc_menu_target, menu_i
public func Flip()
{
// Mirror structure
if (this->~NoConstructionFlip()) return false;
return SetDir(1-GetDir());
if (this->~NoConstructionFlip())
return false;
return SetDir(1 - GetDir());
}

private func FlipVertices()
{
// Flips all vertices around the Y = 0 axis, this can be used to flip the vertices of asymmetric structures.
for (var cnt = 0; cnt < GetVertexNum(); cnt++)
{
SetVertex(cnt, VTX_X, -GetVertex(cnt, VTX_X));
SetVertex(cnt, VTX_Y, GetVertex(cnt, VTX_Y));
}
return;
}


@@ -7,7 +7,7 @@ Height=20
Offset=-15,-10
Vertices=6
VertexX=0,-12,12,-15,15,0
VertexY=0,-4,-4,10,10,10
VertexY=0,-8,-8,10,10,10
VertexFriction=50, 50,50,100,100
Mass=100
Exclusive=1
@@ -6,7 +6,7 @@ Width=62
Height=66
Offset=-31,-33
Vertices=5
VertexX=-25,25,-5,-25,28
VertexX=-20,20,-5,-25,25
VertexY=-27,-27,32,32,32
VertexFriction=50,50,100,100,100
Mass=1500
@@ -28,6 +28,23 @@ public func Construction(object creator)

public func IsHammerBuildable() { return true; }

public func Initialize()
{
// Update vertices to fit shape of flipped building after construction is finished.
// Vertices are being reset when the construction is finished (i.e. on shape updates).
if (GetDir() == DIR_Right)
FlipVertices();
return _inherited(...);
}

public func SetDir(int dir)
{
// Update vertices to fit shape of flipped building when dir is changed.
if (GetDir() != dir)
FlipVertices();
return _inherited(dir, ...);
}


/*-- Production --*/

@@ -5,10 +5,10 @@ Category=C4D_Structure
Width=15
Height=32
Offset=-7,-16
Vertices=4
VertexX=-7,-7,7,7
VertexY=-10,15,-10,15
VertexFriction=50,100,50,100
Vertices=7
VertexX=-5,-7,5,7,0,-6,6
VertexY=-10,15,-10,15,-15,1,1
VertexFriction=50,100,50,100,50,50,50
Construction=1
Value=100
Mass=200
@@ -9,14 +9,32 @@ local hold_production;

public func LampPosition(id def) { return [GetCalcDir()*24,20]; }

func Construction(object creator)
public func Construction(object creator)
{
SetAction("Default");
return _inherited(creator, ...);
}

public func IsHammerBuildable() { return true; }

public func Initialize()
{
// Update vertices to fit shape of flipped building after construction is finished.
// Vertices are being reset when the construction is finished (i.e. on shape updates).
if (GetDir() == DIR_Right)
FlipVertices();
return _inherited(...);
}

public func SetDir(int dir)
{
// Update vertices to fit shape of flipped building when dir is changed.
if (GetDir() != dir)
FlipVertices();
return _inherited(dir, ...);
}


/*-- Production --*/

public func IsProduct(id product_id)
@@ -10,20 +10,33 @@ local meshAttach;

public func LampPosition(id def) { return [GetCalcDir()*-6,30]; }

func Initialize()
public func Initialize()
{
animWork = PlayAnimation("Work", 1, Anim_Const(0));
// Update vertices to fit shape of flipped building after construction is finished.
// Vertices are being reset when the construction is finished (i.e. on shape updates).
if (GetDir() == DIR_Right)
FlipVertices();
return _inherited(...);
}

func Construction(object creator)
public func Construction(object creator)
{
SetAction("Wait");
return _inherited(creator, ...);
}

public func IsHammerBuildable() { return true; }

public func SetDir(int dir)
{
// Update vertices to fit shape of flipped building when dir is changed.
if (GetDir() != dir)
FlipVertices();
return _inherited(dir, ...);
}


/*-- Production --*/

public func IsProduct(id product_id)
@@ -8,7 +8,7 @@ Offset=-25,-25
Vertices=6
VertexX=0,4,25,13,-20,-25
VertexY=0,-24,-3,25,21,-10
VertexFriction=100,100,100,100,100
VertexFriction=100,100,100,100,100,100
Rotate=1
NoStabilize=1
IncompleteActivity=1
@@ -5,10 +5,10 @@ Category=C4D_Structure
Width=50
Height=96
Offset=-25,-48
Vertices=7
VertexX=0,30,15,-15,-30,-5,5
VertexY=-10,-20,47,47,-20,47,47
VertexFriction=50,50,100,100,50,100,100
Vertices=8
VertexX=0,18,24,-24,-18,-8,8,0
VertexY=-10,-8,47,47,-8,47,47,-21
VertexFriction=50,50,100,100,50,100,100,50
Mass=2500
Exclusive=1
Construction=1
@@ -193,7 +193,7 @@ local ActMap = {
Name = "Default",
Procedure = DFA_NONE,
Directions = 2,
FlipDir = 1,
//FlipDir = 1,
Length = 1,
Delay = 0,
FacetBase = 1,

0 comments on commit 9e01a86

Please sign in to comment.
You can’t perform that action at this time.