forked from Mirrors/openclonk
make producer continue directly after production finishes
parent
135a7d8aff
commit
42c8dbc2c8
|
@ -458,7 +458,6 @@ public func GetQueue()
|
|||
return queue;
|
||||
}
|
||||
|
||||
|
||||
private func ProcessQueue()
|
||||
{
|
||||
// If target is currently producing, don't do anything.
|
||||
|
@ -529,7 +528,6 @@ private func Produce(id product, producing_player)
|
|||
|
||||
// Add production effect.
|
||||
AddEffect("ProcessProduction", this, 100, 2, this, nil, product, producing_player);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -715,7 +713,7 @@ protected func FxProcessProductionTimer(object target, proplist effect, int time
|
|||
protected func FxProcessProductionStop(object target, proplist effect, int reason, bool temp)
|
||||
{
|
||||
if (temp)
|
||||
return FX_OK;
|
||||
return FX_OK;
|
||||
|
||||
// No need to consume power anymore. Always unregister even if there's a queue left to
|
||||
// process, because OnNotEnoughPower relies on it and it gives other producers the chance
|
||||
|
@ -725,14 +723,17 @@ protected func FxProcessProductionStop(object target, proplist effect, int reaso
|
|||
|
||||
if (reason != 0)
|
||||
return FX_OK;
|
||||
|
||||
|
||||
// Callback to the producer.
|
||||
this->~OnProductionFinish(effect.Product);
|
||||
// Create product.
|
||||
var product = CreateObject(effect.Product);
|
||||
OnProductEjection(product);
|
||||
// Global callback
|
||||
if (product) GameCallEx("OnProductionFinished", product, effect.producing_player);
|
||||
// Global callback.
|
||||
if (product)
|
||||
GameCallEx("OnProductionFinished", product, effect.producing_player);
|
||||
// Try to process the queue immediately and don't wait for the timer to prevent pauses.
|
||||
ProcessQueue();
|
||||
return FX_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*--
|
||||
/**
|
||||
Foundry
|
||||
Authors: Ringwaul, Maikel
|
||||
|
||||
Melts iron ore to metal, using some sort of fuel.
|
||||
--*/
|
||||
|
||||
@authors Ringwaul, Maikel
|
||||
*/
|
||||
|
||||
#include Library_Structure
|
||||
#include Library_Ownable
|
||||
|
@ -11,23 +11,23 @@
|
|||
#include Library_LampPost
|
||||
#include Library_Tank
|
||||
|
||||
// does not need power
|
||||
|
||||
// Foundry does not need power.
|
||||
public func PowerNeed() { return 0; }
|
||||
|
||||
public func IsPowerConsumer() { return false; }
|
||||
|
||||
public func LampPosition(id def) { return [GetCalcDir()*-11,2]; }
|
||||
public func LampPosition(id def) { return [-11 * GetCalcDir(), 2]; }
|
||||
|
||||
public func Construction(object creator)
|
||||
{
|
||||
|
||||
//SetProperty("MeshTransformation",Trans_Rotate(RandomX(-40,20),0,1,0));
|
||||
SetAction("Default");
|
||||
AddTimer("CollectionZone", 1);
|
||||
return _inherited(creator, ...);
|
||||
}
|
||||
|
||||
public func IsHammerBuildable() { return true; }
|
||||
|
||||
|
||||
/*-- Production --*/
|
||||
|
||||
private func IgnoreKnowledge() { return true; }
|
||||
|
@ -58,18 +58,18 @@ public func OnProductionFinish(id product)
|
|||
}
|
||||
|
||||
// Timer, check for objects to collect in the designated collection zone
|
||||
func CollectionZone()
|
||||
public func CollectionZone()
|
||||
{
|
||||
if (GetCon() < 100) return;
|
||||
|
||||
for (var obj in FindObjects(Find_InRect(16 - 45 * GetDir(),3,13,13), Find_OCF(OCF_Collectible), Find_NoContainer(), Find_Layer(GetObjectLayer())))
|
||||
if (GetCon() < 100)
|
||||
return;
|
||||
for (var obj in FindObjects(Find_InRect(16 - 45 * GetDir(), 3, 13, 13), Find_OCF(OCF_Collectible), Find_NoContainer(), Find_Layer(GetObjectLayer())))
|
||||
Collect(obj, true);
|
||||
}
|
||||
|
||||
func Collection()
|
||||
public func Collection()
|
||||
{
|
||||
Sound("Objects::Clonk");
|
||||
return;
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
public func FxSmeltingTimer(object target, proplist effect, int time)
|
||||
|
@ -86,10 +86,10 @@ public func FxSmeltingTimer(object target, proplist effect, int time)
|
|||
Sound("Structures::Furnace::Loop", false, 100, nil, +1);
|
||||
|
||||
// Pour after some time.
|
||||
if(time == 244)
|
||||
if (time == 244)
|
||||
SetMeshMaterial("MetalFlow", 1);
|
||||
|
||||
//Molten metal hits cast... Sizzling sound
|
||||
// Molten metal hits cast... Sizzling sound.
|
||||
if (time == 256)
|
||||
Sound("Liquids::Sizzle");
|
||||
|
||||
|
@ -100,11 +100,11 @@ public func FxSmeltingTimer(object target, proplist effect, int time)
|
|||
if (time == 290)
|
||||
{
|
||||
SetMeshMaterial("Metal", 1);
|
||||
Sound("Structures::Furnace::Loop", false ,100, nil, -1);
|
||||
Sound("Structures::Furnace::Loop", false, 100, nil, -1);
|
||||
Sound("Structures::Furnace::Stop");
|
||||
return -1;
|
||||
return FX_Execute_Kill;
|
||||
}
|
||||
return 1;
|
||||
return FX_OK;
|
||||
}
|
||||
|
||||
public func OnProductEjection(object product)
|
||||
|
@ -189,22 +189,9 @@ public func OnPipeConnect(object pipe, string specific_pipe_state)
|
|||
|
||||
/*-- Properties --*/
|
||||
|
||||
local ActMap = {
|
||||
Default = {
|
||||
Prototype = Action,
|
||||
Name = "Default",
|
||||
Procedure = DFA_NONE,
|
||||
Directions = 2,
|
||||
FlipDir = 1,
|
||||
Length = 1,
|
||||
Delay = 0,
|
||||
FacetBase = 1,
|
||||
NextAction = "Default",
|
||||
},
|
||||
};
|
||||
|
||||
func Definition(def) {
|
||||
def.PictureTransformation = Trans_Mul(Trans_Translate(2000,0,7000),Trans_Rotate(-20,1,0,0),Trans_Rotate(30,0,1,0));
|
||||
public func Definition(proplist def)
|
||||
{
|
||||
def.PictureTransformation = Trans_Mul(Trans_Translate(2000, 0, 7000), Trans_Rotate(-20, 1, 0, 0), Trans_Rotate(30, 0, 1, 0));
|
||||
}
|
||||
|
||||
local Name = "$Name$";
|
||||
|
|
|
@ -142,7 +142,7 @@ global func FxIntTestControlTimer(object target, proplist effect)
|
|||
Log("Test %d not available, the previous test was the last test.", effect.testnr);
|
||||
Log("=====================================");
|
||||
Log("All tests have been successfully completed!");
|
||||
return -1;
|
||||
return FX_Execute_Kill;
|
||||
}
|
||||
effect.launched = true;
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ global func Test10_OnStart(int plr)
|
|||
|
||||
global func Test10_Completed()
|
||||
{
|
||||
if (ObjectCount(Find_ID(Wood)) >= 5)
|
||||
if (ObjectCount(Find_ID(Wood), Find_NoContainer()) >= 5)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue