forked from Mirrors/openclonk
add editor button to place basement under a structure
parent
f9e3639d91
commit
85ce25fb0f
|
@ -25,6 +25,9 @@ protected func Construction()
|
|||
lib_structure.repair_materials = [];
|
||||
// Total value of the components - used to calculate the required material for repairing.
|
||||
lib_structure.total_component_value = nil;
|
||||
// Make a writable copy of the editor action.
|
||||
if (this.EditorActions == GetID().EditorActions)
|
||||
MakePropertyWritable("EditorActions");
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
|
@ -96,6 +99,10 @@ private func EjectContentsOnDestruction(int cause, int by_player)
|
|||
public func SetBasement(object to_basement)
|
||||
{
|
||||
lib_structure.basement = to_basement;
|
||||
if (lib_structure.basement)
|
||||
this.EditorActions.basement = nil;
|
||||
else
|
||||
this.EditorActions.basement = new GetID().EditorActions.basement {};
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -110,6 +117,14 @@ public func IsStructureWithoutBasement()
|
|||
return IsStructure() && !(lib_structure && lib_structure.basement);
|
||||
}
|
||||
|
||||
public func AddBasement()
|
||||
{
|
||||
var offset = this->~GetBasementOffset() ?? [0, 0];
|
||||
var basement = CreateObject(Basement, offset[0], GetBottom() + 4 + offset[1]);
|
||||
basement->SetParent(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*-- SolidMask --*/
|
||||
|
||||
|
@ -433,10 +448,9 @@ public func Flip()
|
|||
public func Definition(def, ...)
|
||||
{
|
||||
if (!def.EditorProps) def.EditorProps = {};
|
||||
if (!def.EditorActions) def.EditorActions = {};
|
||||
def.EditorActions.basement = { Name = "$Basement$", EditorHelp = "$BasementHelp$", Command = "AddBasement()" };
|
||||
if (!def->~NoConstructionFlip())
|
||||
{
|
||||
if (!def.EditorActions) def.EditorActions = {};
|
||||
def.EditorActions.flip = { Name="$Flip$", EditorHelp="$FlipHelp$", Command="Flip()" };
|
||||
}
|
||||
def.EditorActions.flip = { Name = "$Flip$", EditorHelp = "$FlipHelp$", Command = "Flip()" };
|
||||
return _inherited(def, ...);
|
||||
}
|
||||
|
|
|
@ -17,3 +17,5 @@ MsgNotFullyConstructed=%s ist noch nicht fertig gebaut.|Im Moment sind keine Int
|
|||
|
||||
Flip=Umdrehen
|
||||
FlipHelp=Spiegelt das Gebaeude.
|
||||
Basement=Fundament
|
||||
BasementHelp=Platziert ein Fundament unter dem Gebäude.
|
|
@ -17,3 +17,5 @@ MsgNotFullyConstructed=%s is not fully constructed yet.|There are no interaction
|
|||
|
||||
Flip=Flip
|
||||
FlipHelp=Mirrors the structure.
|
||||
Basement=Basement
|
||||
BasementHelp=Adds a basement to the structure.
|
|
@ -36,6 +36,8 @@ func Destruction()
|
|||
{
|
||||
// Cast a single rock.
|
||||
CastObjects(Rock, 1, 15, 0, -5);
|
||||
// Set basement to nil in parent.
|
||||
parent->~SetBasement(nil);
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue