diff --git a/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Structure.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Structure.ocd/Script.c index ec0dcb5c2..c51d04343 100644 --- a/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Structure.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Structures.ocd/Structure.ocd/Script.c @@ -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; } diff --git a/planet/Objects.ocd/Structures.ocd/Compensator.ocd/DefCore.txt b/planet/Objects.ocd/Structures.ocd/Compensator.ocd/DefCore.txt index d5ea2edb7..0a70215db 100644 --- a/planet/Objects.ocd/Structures.ocd/Compensator.ocd/DefCore.txt +++ b/planet/Objects.ocd/Structures.ocd/Compensator.ocd/DefCore.txt @@ -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 diff --git a/planet/Objects.ocd/Structures.ocd/Elevator.ocd/DefCore.txt b/planet/Objects.ocd/Structures.ocd/Elevator.ocd/DefCore.txt index a0cc221ae..3748daa71 100644 --- a/planet/Objects.ocd/Structures.ocd/Elevator.ocd/DefCore.txt +++ b/planet/Objects.ocd/Structures.ocd/Elevator.ocd/DefCore.txt @@ -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 diff --git a/planet/Objects.ocd/Structures.ocd/Foundry.ocd/Script.c b/planet/Objects.ocd/Structures.ocd/Foundry.ocd/Script.c index 8b160af57..8ffde290e 100644 --- a/planet/Objects.ocd/Structures.ocd/Foundry.ocd/Script.c +++ b/planet/Objects.ocd/Structures.ocd/Foundry.ocd/Script.c @@ -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 --*/ diff --git a/planet/Objects.ocd/Structures.ocd/Idol.ocd/DefCore.txt b/planet/Objects.ocd/Structures.ocd/Idol.ocd/DefCore.txt index 0de6c9ead..faf13a1b4 100644 --- a/planet/Objects.ocd/Structures.ocd/Idol.ocd/DefCore.txt +++ b/planet/Objects.ocd/Structures.ocd/Idol.ocd/DefCore.txt @@ -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 diff --git a/planet/Objects.ocd/Structures.ocd/InventorsLab.ocd/Script.c b/planet/Objects.ocd/Structures.ocd/InventorsLab.ocd/Script.c index 0e9586388..b1a03d6a5 100644 --- a/planet/Objects.ocd/Structures.ocd/InventorsLab.ocd/Script.c +++ b/planet/Objects.ocd/Structures.ocd/InventorsLab.ocd/Script.c @@ -9,7 +9,7 @@ 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, ...); @@ -17,6 +17,24 @@ 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 --*/ public func IsProduct(id product_id) diff --git a/planet/Objects.ocd/Structures.ocd/Shipyard.ocd/Script.c b/planet/Objects.ocd/Structures.ocd/Shipyard.ocd/Script.c index 666bae45c..2bfa5dbca 100644 --- a/planet/Objects.ocd/Structures.ocd/Shipyard.ocd/Script.c +++ b/planet/Objects.ocd/Structures.ocd/Shipyard.ocd/Script.c @@ -10,13 +10,17 @@ 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, ...); @@ -24,6 +28,15 @@ func Construction(object 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) diff --git a/planet/Objects.ocd/Structures.ocd/WindGenerator.ocd/Wheel.ocd/DefCore.txt b/planet/Objects.ocd/Structures.ocd/WindGenerator.ocd/Wheel.ocd/DefCore.txt index 1e1b60a7c..79d262fb9 100644 --- a/planet/Objects.ocd/Structures.ocd/WindGenerator.ocd/Wheel.ocd/DefCore.txt +++ b/planet/Objects.ocd/Structures.ocd/WindGenerator.ocd/Wheel.ocd/DefCore.txt @@ -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 diff --git a/planet/Objects.ocd/Structures.ocd/Windmill.ocd/DefCore.txt b/planet/Objects.ocd/Structures.ocd/Windmill.ocd/DefCore.txt index 0950f6694..10d31d77f 100644 --- a/planet/Objects.ocd/Structures.ocd/Windmill.ocd/DefCore.txt +++ b/planet/Objects.ocd/Structures.ocd/Windmill.ocd/DefCore.txt @@ -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 diff --git a/planet/Objects.ocd/Structures.ocd/Windmill.ocd/Script.c b/planet/Objects.ocd/Structures.ocd/Windmill.ocd/Script.c index cc977d0da..d8a38c506 100644 --- a/planet/Objects.ocd/Structures.ocd/Windmill.ocd/Script.c +++ b/planet/Objects.ocd/Structures.ocd/Windmill.ocd/Script.c @@ -193,7 +193,7 @@ local ActMap = { Name = "Default", Procedure = DFA_NONE, Directions = 2, - FlipDir = 1, + //FlipDir = 1, Length = 1, Delay = 0, FacetBase = 1,