forked from Mirrors/openclonk
fix some more structure vertices, also for asymmetric ones when flipped (#1979)
parent
85d9c2c410
commit
c46b66002c
|
@ -453,8 +453,20 @@ public func OnRepairMenuHover(id symbol, string action, desc_menu_target, menu_i
|
||||||
public func Flip()
|
public func Flip()
|
||||||
{
|
{
|
||||||
// Mirror structure
|
// Mirror structure
|
||||||
if (this->~NoConstructionFlip()) return false;
|
if (this->~NoConstructionFlip())
|
||||||
return SetDir(1-GetDir());
|
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
|
Offset=-15,-10
|
||||||
Vertices=6
|
Vertices=6
|
||||||
VertexX=0,-12,12,-15,15,0
|
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
|
VertexFriction=50, 50,50,100,100
|
||||||
Mass=100
|
Mass=100
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
|
|
|
@ -6,7 +6,7 @@ Width=62
|
||||||
Height=66
|
Height=66
|
||||||
Offset=-31,-33
|
Offset=-31,-33
|
||||||
Vertices=5
|
Vertices=5
|
||||||
VertexX=-25,25,-5,-25,28
|
VertexX=-20,20,-5,-25,25
|
||||||
VertexY=-27,-27,32,32,32
|
VertexY=-27,-27,32,32,32
|
||||||
VertexFriction=50,50,100,100,100
|
VertexFriction=50,50,100,100,100
|
||||||
Mass=1500
|
Mass=1500
|
||||||
|
|
|
@ -28,6 +28,23 @@ public func Construction(object creator)
|
||||||
|
|
||||||
public func IsHammerBuildable() { return true; }
|
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 --*/
|
/*-- Production --*/
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ Category=C4D_Structure
|
||||||
Width=15
|
Width=15
|
||||||
Height=32
|
Height=32
|
||||||
Offset=-7,-16
|
Offset=-7,-16
|
||||||
Vertices=4
|
Vertices=7
|
||||||
VertexX=-7,-7,7,7
|
VertexX=-5,-7,5,7,0,-6,6
|
||||||
VertexY=-10,15,-10,15
|
VertexY=-10,15,-10,15,-15,1,1
|
||||||
VertexFriction=50,100,50,100
|
VertexFriction=50,100,50,100,50,50,50
|
||||||
Construction=1
|
Construction=1
|
||||||
Value=100
|
Value=100
|
||||||
Mass=200
|
Mass=200
|
||||||
|
|
|
@ -9,7 +9,7 @@ local hold_production;
|
||||||
|
|
||||||
public func LampPosition(id def) { return [GetCalcDir()*24,20]; }
|
public func LampPosition(id def) { return [GetCalcDir()*24,20]; }
|
||||||
|
|
||||||
func Construction(object creator)
|
public func Construction(object creator)
|
||||||
{
|
{
|
||||||
SetAction("Default");
|
SetAction("Default");
|
||||||
return _inherited(creator, ...);
|
return _inherited(creator, ...);
|
||||||
|
@ -17,6 +17,24 @@ func Construction(object creator)
|
||||||
|
|
||||||
public func IsHammerBuildable() { return true; }
|
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 --*/
|
/*-- Production --*/
|
||||||
|
|
||||||
public func IsProduct(id product_id)
|
public func IsProduct(id product_id)
|
||||||
|
|
|
@ -10,13 +10,17 @@ local meshAttach;
|
||||||
|
|
||||||
public func LampPosition(id def) { return [GetCalcDir()*-6,30]; }
|
public func LampPosition(id def) { return [GetCalcDir()*-6,30]; }
|
||||||
|
|
||||||
func Initialize()
|
public func Initialize()
|
||||||
{
|
{
|
||||||
animWork = PlayAnimation("Work", 1, Anim_Const(0));
|
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(...);
|
return _inherited(...);
|
||||||
}
|
}
|
||||||
|
|
||||||
func Construction(object creator)
|
public func Construction(object creator)
|
||||||
{
|
{
|
||||||
SetAction("Wait");
|
SetAction("Wait");
|
||||||
return _inherited(creator, ...);
|
return _inherited(creator, ...);
|
||||||
|
@ -24,6 +28,15 @@ func Construction(object creator)
|
||||||
|
|
||||||
public func IsHammerBuildable() { return true; }
|
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 --*/
|
/*-- Production --*/
|
||||||
|
|
||||||
public func IsProduct(id product_id)
|
public func IsProduct(id product_id)
|
||||||
|
|
|
@ -8,7 +8,7 @@ Offset=-25,-25
|
||||||
Vertices=6
|
Vertices=6
|
||||||
VertexX=0,4,25,13,-20,-25
|
VertexX=0,4,25,13,-20,-25
|
||||||
VertexY=0,-24,-3,25,21,-10
|
VertexY=0,-24,-3,25,21,-10
|
||||||
VertexFriction=100,100,100,100,100
|
VertexFriction=100,100,100,100,100,100
|
||||||
Rotate=1
|
Rotate=1
|
||||||
NoStabilize=1
|
NoStabilize=1
|
||||||
IncompleteActivity=1
|
IncompleteActivity=1
|
||||||
|
|
|
@ -5,10 +5,10 @@ Category=C4D_Structure
|
||||||
Width=50
|
Width=50
|
||||||
Height=96
|
Height=96
|
||||||
Offset=-25,-48
|
Offset=-25,-48
|
||||||
Vertices=7
|
Vertices=8
|
||||||
VertexX=0,30,15,-15,-30,-5,5
|
VertexX=0,18,24,-24,-18,-8,8,0
|
||||||
VertexY=-10,-20,47,47,-20,47,47
|
VertexY=-10,-8,47,47,-8,47,47,-21
|
||||||
VertexFriction=50,50,100,100,50,100,100
|
VertexFriction=50,50,100,100,50,100,100,50
|
||||||
Mass=2500
|
Mass=2500
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
Construction=1
|
Construction=1
|
||||||
|
|
|
@ -193,7 +193,7 @@ local ActMap = {
|
||||||
Name = "Default",
|
Name = "Default",
|
||||||
Procedure = DFA_NONE,
|
Procedure = DFA_NONE,
|
||||||
Directions = 2,
|
Directions = 2,
|
||||||
FlipDir = 1,
|
//FlipDir = 1,
|
||||||
Length = 1,
|
Length = 1,
|
||||||
Delay = 0,
|
Delay = 0,
|
||||||
FacetBase = 1,
|
FacetBase = 1,
|
||||||
|
|
Loading…
Reference in New Issue