forked from Mirrors/openclonk
Content menu opens now for "IsContainer"
parent
4645592fb6
commit
7371d37325
|
@ -44,6 +44,9 @@ protected func Initialize()
|
|||
var wind = CreateConstruction(WindGenerator, 480, FindHeight(480), NO_OWNER, 100, true);
|
||||
var line = CreateObject(PowerLine);
|
||||
line->SetActionTargets(wind, workshop);
|
||||
var sawmill = CreateConstruction(Sawmill, 520, FindHeight(520), NO_OWNER, 100, true);
|
||||
var line = CreateObject(PowerLine);
|
||||
line->SetActionTargets(wind, sawmill);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -15,10 +15,11 @@ global func CreateContentsMenus()
|
|||
|
||||
var controller = CreateObject(GUI_Contents_Controller);
|
||||
controller->SetMenuObject(this);
|
||||
this->SetMenu(controller);
|
||||
|
||||
var objs = FindObjects( Find_Or(
|
||||
Find_Not(Find_Exclude(this)),
|
||||
Find_And(Find_AtPoint(0,0), Find_NoContainer(), Find_OCF(OCF_Container))),
|
||||
Find_And(Find_AtPoint(0,0), Find_NoContainer(), Find_Func("IsContainer"))),
|
||||
Sort_Func("SortInventoryObjs"));
|
||||
|
||||
var i = 0;
|
||||
|
@ -57,18 +58,21 @@ func Close() {
|
|||
RemoveObject();
|
||||
}
|
||||
|
||||
func Destruction() {
|
||||
func Destruction()
|
||||
{
|
||||
// remove all menu objects
|
||||
for(var prop in circ_menus)
|
||||
prop.Menu->RemoveObject();
|
||||
}
|
||||
|
||||
func Show() {
|
||||
func Show()
|
||||
{
|
||||
for(var prop in circ_menus)
|
||||
prop.Menu->Show();
|
||||
}
|
||||
|
||||
func Hide() {
|
||||
func Hide()
|
||||
{
|
||||
for(var prop in circ_menus)
|
||||
prop.Menu->Hide();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ public func SetCommander(object commander)
|
|||
public func SetMenuObject(object menuobject)
|
||||
{
|
||||
menu_object = menuobject;
|
||||
menuobject->SetMenu(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -224,6 +224,7 @@ func Close()
|
|||
|
||||
func Destruction()
|
||||
{
|
||||
|
||||
for(var menu_icon in menu_icons)
|
||||
menu_icon->RemoveObject();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,9 @@ protected func Initialize()
|
|||
|
||||
/*-- Player interface --*/
|
||||
|
||||
// All producers are accessible.
|
||||
public func IsContainer() { return true; }
|
||||
|
||||
public func IsInteractable() { return GetCon() >= 100; }
|
||||
|
||||
public func GetInteractionMetaInfo(object clonk)
|
||||
|
@ -155,9 +158,20 @@ public func RemoveFromQueue(int pos)
|
|||
return;
|
||||
}
|
||||
|
||||
public func ClearQueue()
|
||||
/** Clears the complete production queue.
|
||||
@param abort determines whether to abort the current production process.
|
||||
@return \c nil.
|
||||
*/
|
||||
public func ClearQueue(bool abort)
|
||||
{
|
||||
// TODO: Implement
|
||||
if (abort)
|
||||
{
|
||||
queue = [];
|
||||
return;
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -236,8 +250,10 @@ private func Produce(id product)
|
|||
|
||||
// Everything available? Start production.
|
||||
// Remove needed components, fuel and liquid.
|
||||
// Power will be substracted during the production process.
|
||||
CheckComponents(product, true);
|
||||
CheckFuel(product, true);
|
||||
CheckLiquids(product, true);
|
||||
|
||||
// Add production effect.
|
||||
AddEffect("ProcessProduction", this, 100, 2, this, nil, product);
|
||||
|
@ -442,10 +458,36 @@ protected func RejectCollect(id item, object obj)
|
|||
|
||||
protected func RejectEntrance(object obj)
|
||||
{
|
||||
// Check if item is either a raw material needed or an item that can be produced.
|
||||
if (IsProduct(obj->GetID()))
|
||||
return false;
|
||||
if (NeedsRawMaterial(obj->GetID()))
|
||||
var obj_id = obj->GetID();
|
||||
// Products itself may be collected.
|
||||
if (IsProduct(obj_id))
|
||||
return false;
|
||||
|
||||
// Components of products may be collected.
|
||||
var index = 0, product;
|
||||
while (product = GetDefinition(index))
|
||||
{
|
||||
var i = 0, comp_id;
|
||||
while (comp_id = GetComponent(nil, i, nil, product))
|
||||
{
|
||||
if (comp_id == obj_id)
|
||||
return false;
|
||||
i++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
// Fuel for products may be collected.
|
||||
if (obj->~IsFuel())
|
||||
{
|
||||
index = 0;
|
||||
while (product = GetDefinition(index))
|
||||
{
|
||||
if (product->~FuelNeed() > 0)
|
||||
return false;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -101,13 +101,6 @@ public func OnProductEjection(object product)
|
|||
return;
|
||||
}
|
||||
|
||||
protected func RejectCollect(id id_def, object collect)
|
||||
{
|
||||
if(collect->~IsFoundryIngredient() || collect->~IsFuel()) return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Translate(2000,0,7000),Trans_Rotate(-20,1,0,0),Trans_Rotate(30,0,1,0)), def);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ public func IsLorry() { return true; }
|
|||
|
||||
public func IsToolProduct() { return true; }
|
||||
|
||||
public func IsContainer() { return true; }
|
||||
|
||||
local drive_anim;
|
||||
local tremble_anim;
|
||||
|
||||
|
|
Loading…
Reference in New Issue