forked from Mirrors/openclonk
fix missing construction site material info after loading game (#1740)
parent
3d1caffcf6
commit
c50d3b84a2
|
@ -17,6 +17,7 @@ public func IsContainer() { return !full_material; }
|
|||
// Disallow site cancellation. Useful e.g. for sites that are pre-placed for a game goal
|
||||
public func MakeUncancellable() { no_cancel = true; return true; }
|
||||
|
||||
|
||||
/*-- Testing / Development --*/
|
||||
|
||||
// Builds the construction even if the required materials isn't there.
|
||||
|
@ -27,6 +28,7 @@ public func ForceConstruct()
|
|||
StartConstructing();
|
||||
}
|
||||
|
||||
|
||||
/*-- Interaction --*/
|
||||
|
||||
public func HasInteractionMenu() { return true; }
|
||||
|
@ -114,6 +116,7 @@ public func OnInteractionControl(id symbol, string action, object clonk)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*-- Engine callbacks --*/
|
||||
|
||||
public func Deconstruct()
|
||||
|
@ -144,7 +147,7 @@ public func Construction()
|
|||
}
|
||||
|
||||
// Scenario saving
|
||||
func SaveScenarioObject(props)
|
||||
public func SaveScenarioObject(props)
|
||||
{
|
||||
if (!inherited(props, ...)) return false;
|
||||
props->Remove("Name");
|
||||
|
@ -178,6 +181,14 @@ public func Collection2(object obj)
|
|||
public func ContentsDestruction(object obj) { return UpdateStatus(); }
|
||||
public func Ejection(object obj) { return UpdateStatus(); }
|
||||
|
||||
public func OnSynchronized()
|
||||
{
|
||||
// Reinitialize permanent message showing components.
|
||||
ShowMissingComponents();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*-- Internals --*/
|
||||
|
||||
public func Set(id def, int dir, object stick)
|
||||
|
@ -225,7 +236,6 @@ private func SetConstructionSiteOverlayDefault(id def, int dir, object stick, in
|
|||
SetObjDrawTransform((1 - dir * 2) * 1000, 0, 0, 0, 1000, -h * 500, 2);
|
||||
}
|
||||
|
||||
|
||||
private func UpdateStatus(object item)
|
||||
{
|
||||
// Ignore any activity during construction
|
||||
|
@ -249,7 +259,6 @@ private func UpdateStatus(object item)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private func ShowMissingComponents()
|
||||
{
|
||||
if (definition == nil)
|
||||
|
@ -268,7 +277,6 @@ private func ShowMissingComponents()
|
|||
CustomMessage(msg, this, NO_OWNER, 0, dy);
|
||||
}
|
||||
|
||||
|
||||
private func GetMissingComponents()
|
||||
{
|
||||
if (definition == nil)
|
||||
|
@ -302,7 +310,6 @@ private func GetMissingComponents()
|
|||
return missing_material;
|
||||
}
|
||||
|
||||
|
||||
private func StartConstructing(int by_player)
|
||||
{
|
||||
if (!definition || !full_material)
|
||||
|
@ -359,7 +366,6 @@ private func CreateConstructionSite()
|
|||
return site;
|
||||
}
|
||||
|
||||
|
||||
private func StartConstructionEffect(object site, int by_player)
|
||||
{
|
||||
// Object provides custom construction effects?
|
||||
|
@ -373,7 +379,6 @@ private func StartConstructionEffect(object site, int by_player)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private func TakeConstructionMaterials(object from_clonk)
|
||||
{
|
||||
// Check for material
|
||||
|
@ -414,7 +419,6 @@ private func TakeConstructionMaterials(object from_clonk)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Gets the number of available components of a type.
|
||||
// This defaults to ContentsCount(), but can be overloaded
|
||||
// for implementations of the construction site.
|
||||
|
@ -423,7 +427,6 @@ private func GetAvailableComponentCount(id component)
|
|||
return ContentsCount(component);
|
||||
}
|
||||
|
||||
|
||||
// Find all objects on the bottom of the area that are not stuck
|
||||
private func GetObjectsLyingAround()
|
||||
{
|
||||
|
@ -432,7 +435,6 @@ private func GetObjectsLyingAround()
|
|||
return FindObjects(Find_Category(C4D_Vehicle | C4D_Object | C4D_Living), Find_AtRect(-wdt/2 - 2, -hgt, wdt + 2, hgt + 12), Find_OCF(OCF_InFree), Find_NoContainer());
|
||||
}
|
||||
|
||||
|
||||
// Clean up stuck objects
|
||||
private func EnsureObjectsLyingAround(array lying_around)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue