forked from Mirrors/openclonk
Constructor library: Changed to search through all available knowledge and filter using an overloadable function.
The hammer will now only construct definitions that have the callback "IsHammerBuidable". This will exclude all C4D_Structure objects that are not buildings and can't be build in a meaningful way. Also, with the carry heavy branch I want to test adhoc built lorries (lorries as construction sites). Sven suggested this.qteditor
parent
19395b23ae
commit
b6ca10d11a
|
@ -12,6 +12,8 @@ public func Construction()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
func Initialize()
|
||||
{
|
||||
return _inherited(...);
|
||||
|
|
|
@ -15,6 +15,12 @@ public func GetCarryTransform() { return Trans_Rotate(-90,1,0,0); }
|
|||
public func IsTool() { return true; }
|
||||
public func IsToolProduct() { return true; }
|
||||
|
||||
func CanBuild(id construction_plan)
|
||||
{
|
||||
if (!construction_plan) return false;
|
||||
if (construction_plan->~IsHammerBuildable()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*-- Properties --*/
|
||||
|
||||
|
|
|
@ -41,11 +41,26 @@ public func GetConstructionPlans(int plr)
|
|||
{
|
||||
var construction_plans = [];
|
||||
var construct_id, index = 0;
|
||||
while (construct_id = GetPlrKnowledge(plr, nil, index++, C4D_Structure))
|
||||
construction_plans[index-1] = construct_id;
|
||||
while (construct_id = GetPlrKnowledge(plr, nil, index++, C4D_Structure)) // Structures
|
||||
if (CanBuild(construct_id))
|
||||
construction_plans[GetLength(construction_plans)] = construct_id;
|
||||
index = 0;
|
||||
while (construct_id = GetPlrKnowledge(plr, nil, index++, C4D_Vehicle)) // Vehicles
|
||||
if (CanBuild(construct_id))
|
||||
construction_plans[GetLength(construction_plans)] = construct_id;
|
||||
index = 0;
|
||||
while (construct_id = GetPlrKnowledge(plr, nil, index++, C4D_Object)) // Objects
|
||||
if (CanBuild(construct_id))
|
||||
construction_plans[GetLength(construction_plans)] = construct_id;
|
||||
return construction_plans;
|
||||
}
|
||||
|
||||
// Checks whether a certain construction plans can be built by this constructor.
|
||||
// Overload as seem fit.
|
||||
func CanBuild(id construction_plan)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-- Construction preview --*/
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@ func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
/*-- Production --*/
|
||||
|
||||
public func IsProduct(id product_id)
|
||||
|
|
|
@ -17,6 +17,8 @@ protected func Construction()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
var wdt = GetObjWidth();
|
||||
|
|
|
@ -15,6 +15,8 @@ func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
/*-- Production --*/
|
||||
|
||||
public func IsProduct(id product_id)
|
||||
|
|
|
@ -22,6 +22,8 @@ protected func Construction()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
/*-- Contents --*/
|
||||
|
||||
public func IsContainer() { return true; }
|
||||
|
|
|
@ -30,6 +30,8 @@ protected func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
leftcharge = CreateObjectAbove(Compensator_ChargeShower, 7 * GetCalcDir(), 10, NO_OWNER);
|
||||
|
|
|
@ -78,6 +78,8 @@ private func Construction()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
private func Initialize()
|
||||
{
|
||||
SetCategory(C4D_StaticBack);
|
||||
|
|
|
@ -33,6 +33,8 @@ protected func Construction()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
public func NoConstructionFlip() { return true; }
|
||||
|
||||
/*-- Interaction --*/
|
||||
|
|
|
@ -26,6 +26,8 @@ public func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
/*-- Production --*/
|
||||
|
||||
private func IgnoreKnowledge() { return true; }
|
||||
|
|
|
@ -6,4 +6,6 @@ local Description = "$Description$";
|
|||
local Touchable = 1;
|
||||
local Components = {GoldBar = 3};
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
public func NoConstructionFlip() { return true; }
|
|
@ -15,6 +15,8 @@ func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
/*-- Production --*/
|
||||
|
||||
public func IsProduct(id product_id)
|
||||
|
|
|
@ -15,6 +15,8 @@ func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
/*-- Production --*/
|
||||
|
||||
func IsProduct(id product_id)
|
||||
|
|
|
@ -22,6 +22,8 @@ func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
/*-- Production --*/
|
||||
|
||||
public func IsProduct(id product_id)
|
||||
|
|
|
@ -48,6 +48,8 @@ func Construction()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
func Initialize()
|
||||
{
|
||||
switched_on = true;
|
||||
|
|
|
@ -19,6 +19,8 @@ public func Construction()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
public func Initialize()
|
||||
{
|
||||
this.SpinAnimation = PlayAnimation("work", 10, Anim_Const(0));
|
||||
|
|
|
@ -22,6 +22,8 @@ func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
/*-- Production --*/
|
||||
|
||||
public func IsProduct(id product_id)
|
||||
|
|
|
@ -27,8 +27,9 @@ protected func Initialize()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsContainer() { return true; }
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
public func IsContainer() { return true; }
|
||||
|
||||
protected func RejectCollect(id item, object obj)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,8 @@ public func Construction(object creator)
|
|||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
public func Initialize()
|
||||
{
|
||||
hold_production = false;
|
||||
|
|
|
@ -31,6 +31,8 @@ protected func Construction()
|
|||
return;
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
// First initialize the libraries (especially the flag library).
|
||||
|
|
|
@ -24,6 +24,8 @@ protected func Construction()
|
|||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
// Create a helper object for the wheel.
|
||||
|
|
Loading…
Reference in New Issue