forked from Mirrors/openclonk
Producer / construction sites handle chunks.
Added IsChunk() callback. Changed building material of various building to Chunk_Rock. Chunks enter producers via ForceEnterProducer(), producer will split chunks.heavy-resources
parent
9e1299f326
commit
f9e4cef0b2
|
@ -13,6 +13,7 @@ protected func Hit(x, y)
|
|||
|
||||
public func IsFuel() { return true; }
|
||||
public func GetFuelAmount() { return 400; }
|
||||
public func IsChunk() { return true; }
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(30,0,0,1),Trans_Rotate(-30,1,0,0),Trans_Scale(1300)),def);
|
||||
|
|
|
@ -11,8 +11,12 @@ protected func Hit(x, y)
|
|||
return true;
|
||||
}
|
||||
|
||||
public func IsFoundryIngredient() { return true; }
|
||||
public func IsValuable(){ return true; }
|
||||
public func ForceEnterProducer(id id)
|
||||
{
|
||||
if (id == Foundry) return true;
|
||||
}
|
||||
public func IsChunk() { return true; }
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(30,0,0,1),Trans_Rotate(-30,1,0,0),Trans_Scale(1300)),def);
|
||||
|
|
|
@ -11,7 +11,11 @@ protected func Hit(x, y)
|
|||
return true;
|
||||
}
|
||||
|
||||
public func IsFoundryIngredient() { return true; }
|
||||
public func ForceEnterProducer(id id)
|
||||
{
|
||||
if (id == Foundry) return true;
|
||||
}
|
||||
public func IsChunk() { return true; }
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(30,0,0,1),Trans_Rotate(-30,1,0,0),Trans_Scale(1300)),def);
|
||||
|
|
|
@ -11,6 +11,8 @@ protected func Hit(x, y)
|
|||
return true;
|
||||
}
|
||||
|
||||
public func IsChunk() { return true; }
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(30,0,0,1),Trans_Rotate(-30,1,0,0),Trans_Scale(1300)),def);
|
||||
}
|
||||
|
|
|
@ -165,6 +165,7 @@ func FxIntCarryHeavyStop(object clonk, proplist effect, int reason, bool temp)
|
|||
if (temp) return;
|
||||
clonk->EnableScale();
|
||||
clonk->EnableHangle();
|
||||
Log("hey");
|
||||
clonk.ThrowSpeed += effect.throw;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ public func ProductionCosts(id item_id)
|
|||
{
|
||||
var amount = GetComponent(comp_id, index, nil, item_id);
|
||||
comp_list[index] = [comp_id, amount];
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
return comp_list;
|
||||
}
|
||||
|
@ -347,8 +347,7 @@ private func Produce(id product)
|
|||
{
|
||||
// Already producing? Wait a little.
|
||||
if (IsProducing())
|
||||
return false;
|
||||
|
||||
return false;
|
||||
// Check if components are available.
|
||||
if (!CheckComponents(product))
|
||||
return false;
|
||||
|
@ -372,7 +371,7 @@ private func Produce(id product)
|
|||
CheckFuel(product, true);
|
||||
CheckLiquids(product, true);
|
||||
CheckMaterials(product, true);
|
||||
|
||||
|
||||
// Add production effect.
|
||||
AddEffect("ProcessProduction", this, 100, 2, this, nil, product);
|
||||
|
||||
|
@ -651,6 +650,15 @@ public func RequestObject(id obj_id, int amount)
|
|||
|
||||
/*-- Storage --*/
|
||||
|
||||
// Split chunks
|
||||
func Collection2(object obj)
|
||||
{
|
||||
if (obj->~IsChunk())
|
||||
Schedule(obj, "Split2Components()", 1);
|
||||
// 1 frame delay, so the chunk can trigger the appriopriate carry heavy ending calls
|
||||
// i.e. FxIntCarryHeavyStop
|
||||
}
|
||||
|
||||
protected func RejectCollect(id item, object obj)
|
||||
{
|
||||
// Just return RejectEntrance for this object.
|
||||
|
@ -663,10 +671,14 @@ protected func RejectEntrance(object obj)
|
|||
// Products itself may be collected.
|
||||
if (IsProduct(obj_id))
|
||||
return false;
|
||||
|
||||
// Components of products may be collected.
|
||||
|
||||
// Items may force themselves into containers (for whatever reason they choose)
|
||||
if (obj->~ForceEnterProducer(this->GetID()))
|
||||
return false;
|
||||
|
||||
for (var product in GetProducts())
|
||||
{
|
||||
// Components of products may be collected.
|
||||
var i = 0, comp_id;
|
||||
while (comp_id = GetComponent(nil, i, nil, product))
|
||||
{
|
||||
|
@ -674,27 +686,19 @@ protected func RejectEntrance(object obj)
|
|||
return false;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
// Fuel for products may be collected.
|
||||
if (obj->~IsFuel())
|
||||
{
|
||||
for (var product in GetProducts())
|
||||
if (FuelNeed(product) > 0)
|
||||
return false;
|
||||
}
|
||||
// Liquid containers may be collected if a product needs them.
|
||||
if (obj->~IsLiquidContainer())
|
||||
{
|
||||
for (var product in GetProducts())
|
||||
if (LiquidNeed(product))
|
||||
return false;
|
||||
}
|
||||
// Material containers may be collected if a product needs them.
|
||||
if (obj->~IsMaterialContainer())
|
||||
{
|
||||
for (var product in GetProducts())
|
||||
if (MaterialNeed(product))
|
||||
// Fuel for products may be collected.
|
||||
if (FuelNeed(product) > 0)
|
||||
if (obj->~IsFuel())
|
||||
return false;
|
||||
// Liquid containers may be collected if a product needs them.
|
||||
if (LiquidNeed(product))
|
||||
if (obj->~IsLiquidContainer())
|
||||
return false;
|
||||
// Material containers may be collected if a product needs them.
|
||||
if (MaterialNeed(product))
|
||||
if (obj->~IsMaterialContainer())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-17,-25,-14,25,25,25
|
|||
VertexFriction=50,50,50,100,100,100
|
||||
Value=200
|
||||
Mass=4500
|
||||
Components=Rock=4;Wood=2;
|
||||
Components=Chunk_Rock=1;Wood=2;
|
||||
Exclusive=1
|
||||
Construction=1
|
||||
ContainBlast=1
|
||||
|
|
|
@ -69,7 +69,7 @@ func CollectionZone()
|
|||
func Collection()
|
||||
{
|
||||
Sound("Clonk");
|
||||
return;
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func FxSmeltingTimer(object target, proplist effect, int time)
|
||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-17,-25,-14,25,25,25
|
|||
VertexFriction=50,50,50,100,100,100
|
||||
Value=200
|
||||
Mass=4500
|
||||
Components=Wood=3;Rock=2;Metal=1
|
||||
Components=Wood=3;Chunk_Rock=1;Metal=1
|
||||
Exclusive=1
|
||||
Construction=1
|
||||
ContainBlast=1
|
||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-4,-3,14,14
|
|||
VertexFriction=50,50,100,100
|
||||
Value=100
|
||||
Mass=1000
|
||||
Components=Wood=3;Metal=1;Rock=1
|
||||
Components=Wood=3;Metal=1;Chunk_Rock=1
|
||||
Exclusive=1
|
||||
Construction=1
|
||||
ContainBlast=1
|
||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-14,-13,14,-13,14,14
|
|||
VertexFriction=50,50,100,50,100,100
|
||||
Value=50
|
||||
Mass=1500
|
||||
Components=Rock=4;Wood=1;
|
||||
Components=Chunk_Rock=1;Wood=1;
|
||||
Exclusive=1
|
||||
Construction=1
|
||||
ContainBlast=1
|
||||
|
|
|
@ -122,6 +122,7 @@ func CollectionZone()
|
|||
protected func Collection()
|
||||
{
|
||||
Sound("Clonk");
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func FxSawingTimer(object target, proplist effect, int time)
|
||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-4,-4,24,24,24
|
|||
VertexFriction=50,50,100,100
|
||||
Value=180
|
||||
Mass=4000
|
||||
Components=Rock=6;Metal=3
|
||||
Components=Chunk_Rock=2;Metal=3
|
||||
Collection=-33,7,12,12
|
||||
Exclusive=1
|
||||
Construction=1
|
||||
|
|
|
@ -12,5 +12,5 @@ VertexCNAT=4,8
|
|||
SolidMask=0,0,8,40,0,0
|
||||
Value=10
|
||||
Mass=1000
|
||||
Components=Rock=10;
|
||||
Components=Chunk_Rock=3;
|
||||
HorizontalFix=1
|
|
@ -11,7 +11,7 @@ VertexY=-10,-20,47,47,-20
|
|||
VertexFriction=50,50,100,100,50
|
||||
Value=150
|
||||
Mass=2500
|
||||
Components=Rock=6;Wood=2;
|
||||
Components=Chunk_Rock=1;Wood=2;
|
||||
Exclusive=1
|
||||
Construction=1
|
||||
ContainBlast=1
|
||||
|
|
|
@ -106,7 +106,7 @@ func CollectionZone()
|
|||
protected func Collection()
|
||||
{
|
||||
Sound("Clonk");
|
||||
return;
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func FxCrushingTimer(object target, proplist effect, int time)
|
||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-7,-6,19,19,4,19,-4,19
|
|||
VertexFriction=50,50,100,100
|
||||
Value=200
|
||||
Mass=4000
|
||||
Components=Wood=5;Rock=4
|
||||
Components=Wood=5;Chunk_Rock=1
|
||||
Entrance=-12,0,13,20
|
||||
Exclusive=1
|
||||
Construction=1
|
||||
|
|
Loading…
Reference in New Issue