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 IsFuel() { return true; }
|
||||||
public func GetFuelAmount() { return 400; }
|
public func GetFuelAmount() { return 400; }
|
||||||
|
public func IsChunk() { return true; }
|
||||||
|
|
||||||
func Definition(def) {
|
func Definition(def) {
|
||||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(30,0,0,1),Trans_Rotate(-30,1,0,0),Trans_Scale(1300)),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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public func IsFoundryIngredient() { return true; }
|
|
||||||
public func IsValuable(){ 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) {
|
func Definition(def) {
|
||||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(30,0,0,1),Trans_Rotate(-30,1,0,0),Trans_Scale(1300)),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;
|
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) {
|
func Definition(def) {
|
||||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(30,0,0,1),Trans_Rotate(-30,1,0,0),Trans_Scale(1300)),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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func IsChunk() { return true; }
|
||||||
|
|
||||||
func Definition(def) {
|
func Definition(def) {
|
||||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(30,0,0,1),Trans_Rotate(-30,1,0,0),Trans_Scale(1300)),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;
|
if (temp) return;
|
||||||
clonk->EnableScale();
|
clonk->EnableScale();
|
||||||
clonk->EnableHangle();
|
clonk->EnableHangle();
|
||||||
|
Log("hey");
|
||||||
clonk.ThrowSpeed += effect.throw;
|
clonk.ThrowSpeed += effect.throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public func ProductionCosts(id item_id)
|
||||||
{
|
{
|
||||||
var amount = GetComponent(comp_id, index, nil, item_id);
|
var amount = GetComponent(comp_id, index, nil, item_id);
|
||||||
comp_list[index] = [comp_id, amount];
|
comp_list[index] = [comp_id, amount];
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
return comp_list;
|
return comp_list;
|
||||||
}
|
}
|
||||||
|
@ -347,8 +347,7 @@ private func Produce(id product)
|
||||||
{
|
{
|
||||||
// Already producing? Wait a little.
|
// Already producing? Wait a little.
|
||||||
if (IsProducing())
|
if (IsProducing())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check if components are available.
|
// Check if components are available.
|
||||||
if (!CheckComponents(product))
|
if (!CheckComponents(product))
|
||||||
return false;
|
return false;
|
||||||
|
@ -372,7 +371,7 @@ private func Produce(id product)
|
||||||
CheckFuel(product, true);
|
CheckFuel(product, true);
|
||||||
CheckLiquids(product, true);
|
CheckLiquids(product, true);
|
||||||
CheckMaterials(product, true);
|
CheckMaterials(product, true);
|
||||||
|
|
||||||
// Add production effect.
|
// Add production effect.
|
||||||
AddEffect("ProcessProduction", this, 100, 2, this, nil, product);
|
AddEffect("ProcessProduction", this, 100, 2, this, nil, product);
|
||||||
|
|
||||||
|
@ -651,6 +650,15 @@ public func RequestObject(id obj_id, int amount)
|
||||||
|
|
||||||
/*-- Storage --*/
|
/*-- 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)
|
protected func RejectCollect(id item, object obj)
|
||||||
{
|
{
|
||||||
// Just return RejectEntrance for this object.
|
// Just return RejectEntrance for this object.
|
||||||
|
@ -663,10 +671,14 @@ protected func RejectEntrance(object obj)
|
||||||
// Products itself may be collected.
|
// Products itself may be collected.
|
||||||
if (IsProduct(obj_id))
|
if (IsProduct(obj_id))
|
||||||
return false;
|
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())
|
for (var product in GetProducts())
|
||||||
{
|
{
|
||||||
|
// Components of products may be collected.
|
||||||
var i = 0, comp_id;
|
var i = 0, comp_id;
|
||||||
while (comp_id = GetComponent(nil, i, nil, product))
|
while (comp_id = GetComponent(nil, i, nil, product))
|
||||||
{
|
{
|
||||||
|
@ -674,27 +686,19 @@ protected func RejectEntrance(object obj)
|
||||||
return false;
|
return false;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
// Fuel for products may be collected.
|
||||||
// Fuel for products may be collected.
|
if (FuelNeed(product) > 0)
|
||||||
if (obj->~IsFuel())
|
if (obj->~IsFuel())
|
||||||
{
|
return false;
|
||||||
for (var product in GetProducts())
|
// Liquid containers may be collected if a product needs them.
|
||||||
if (FuelNeed(product) > 0)
|
if (LiquidNeed(product))
|
||||||
return false;
|
if (obj->~IsLiquidContainer())
|
||||||
}
|
return false;
|
||||||
// Liquid containers may be collected if a product needs them.
|
// Material containers may be collected if a product needs them.
|
||||||
if (obj->~IsLiquidContainer())
|
if (MaterialNeed(product))
|
||||||
{
|
if (obj->~IsMaterialContainer())
|
||||||
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))
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-17,-25,-14,25,25,25
|
||||||
VertexFriction=50,50,50,100,100,100
|
VertexFriction=50,50,50,100,100,100
|
||||||
Value=200
|
Value=200
|
||||||
Mass=4500
|
Mass=4500
|
||||||
Components=Rock=4;Wood=2;
|
Components=Chunk_Rock=1;Wood=2;
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
Construction=1
|
Construction=1
|
||||||
ContainBlast=1
|
ContainBlast=1
|
||||||
|
|
|
@ -69,7 +69,7 @@ func CollectionZone()
|
||||||
func Collection()
|
func Collection()
|
||||||
{
|
{
|
||||||
Sound("Clonk");
|
Sound("Clonk");
|
||||||
return;
|
return _inherited(...);
|
||||||
}
|
}
|
||||||
|
|
||||||
public func FxSmeltingTimer(object target, proplist effect, int time)
|
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
|
VertexFriction=50,50,50,100,100,100
|
||||||
Value=200
|
Value=200
|
||||||
Mass=4500
|
Mass=4500
|
||||||
Components=Wood=3;Rock=2;Metal=1
|
Components=Wood=3;Chunk_Rock=1;Metal=1
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
Construction=1
|
Construction=1
|
||||||
ContainBlast=1
|
ContainBlast=1
|
||||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-4,-3,14,14
|
||||||
VertexFriction=50,50,100,100
|
VertexFriction=50,50,100,100
|
||||||
Value=100
|
Value=100
|
||||||
Mass=1000
|
Mass=1000
|
||||||
Components=Wood=3;Metal=1;Rock=1
|
Components=Wood=3;Metal=1;Chunk_Rock=1
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
Construction=1
|
Construction=1
|
||||||
ContainBlast=1
|
ContainBlast=1
|
||||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-14,-13,14,-13,14,14
|
||||||
VertexFriction=50,50,100,50,100,100
|
VertexFriction=50,50,100,50,100,100
|
||||||
Value=50
|
Value=50
|
||||||
Mass=1500
|
Mass=1500
|
||||||
Components=Rock=4;Wood=1;
|
Components=Chunk_Rock=1;Wood=1;
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
Construction=1
|
Construction=1
|
||||||
ContainBlast=1
|
ContainBlast=1
|
||||||
|
|
|
@ -122,6 +122,7 @@ func CollectionZone()
|
||||||
protected func Collection()
|
protected func Collection()
|
||||||
{
|
{
|
||||||
Sound("Clonk");
|
Sound("Clonk");
|
||||||
|
return _inherited(...);
|
||||||
}
|
}
|
||||||
|
|
||||||
public func FxSawingTimer(object target, proplist effect, int time)
|
public func FxSawingTimer(object target, proplist effect, int time)
|
||||||
|
|
|
@ -11,7 +11,7 @@ VertexY=-4,-4,24,24,24
|
||||||
VertexFriction=50,50,100,100
|
VertexFriction=50,50,100,100
|
||||||
Value=180
|
Value=180
|
||||||
Mass=4000
|
Mass=4000
|
||||||
Components=Rock=6;Metal=3
|
Components=Chunk_Rock=2;Metal=3
|
||||||
Collection=-33,7,12,12
|
Collection=-33,7,12,12
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
Construction=1
|
Construction=1
|
||||||
|
|
|
@ -12,5 +12,5 @@ VertexCNAT=4,8
|
||||||
SolidMask=0,0,8,40,0,0
|
SolidMask=0,0,8,40,0,0
|
||||||
Value=10
|
Value=10
|
||||||
Mass=1000
|
Mass=1000
|
||||||
Components=Rock=10;
|
Components=Chunk_Rock=3;
|
||||||
HorizontalFix=1
|
HorizontalFix=1
|
|
@ -11,7 +11,7 @@ VertexY=-10,-20,47,47,-20
|
||||||
VertexFriction=50,50,100,100,50
|
VertexFriction=50,50,100,100,50
|
||||||
Value=150
|
Value=150
|
||||||
Mass=2500
|
Mass=2500
|
||||||
Components=Rock=6;Wood=2;
|
Components=Chunk_Rock=1;Wood=2;
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
Construction=1
|
Construction=1
|
||||||
ContainBlast=1
|
ContainBlast=1
|
||||||
|
|
|
@ -106,7 +106,7 @@ func CollectionZone()
|
||||||
protected func Collection()
|
protected func Collection()
|
||||||
{
|
{
|
||||||
Sound("Clonk");
|
Sound("Clonk");
|
||||||
return;
|
return _inherited(...);
|
||||||
}
|
}
|
||||||
|
|
||||||
public func FxCrushingTimer(object target, proplist effect, int time)
|
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
|
VertexFriction=50,50,100,100
|
||||||
Value=200
|
Value=200
|
||||||
Mass=4000
|
Mass=4000
|
||||||
Components=Wood=5;Rock=4
|
Components=Wood=5;Chunk_Rock=1
|
||||||
Entrance=-12,0,13,20
|
Entrance=-12,0,13,20
|
||||||
Exclusive=1
|
Exclusive=1
|
||||||
Construction=1
|
Construction=1
|
||||||
|
|
Loading…
Reference in New Issue