fixed Clonkonauts old scripts, commented out Randrians inventory system :-(, implemented new inventory control (but without a display!)
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=CXCP
|
||||
Version=4,9,8,1
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,64,64
|
Before Width: | Height: | Size: 4.5 KiB |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "Symbol", def);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=CXCN
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,64,64
|
Before Width: | Height: | Size: 4.7 KiB |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "Symbol", def);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=CXCM
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,16,16
|
Before Width: | Height: | Size: 853 B |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "Symbol", def);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=CXTX
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,64,64
|
Before Width: | Height: | Size: 4.3 KiB |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "Symbol", def);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=DSCN
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,64,64
|
Before Width: | Height: | Size: 4.5 KiB |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "$Name$", def);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Name=Absteigen
|
|
@ -1 +0,0 @@
|
|||
Name=Descend
|
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=CXHM
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,64,64
|
Before Width: | Height: | Size: 4.5 KiB |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "Symbol", def);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=CXIN
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,32,32
|
Before Width: | Height: | Size: 1.5 KiB |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "Symbol", def);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=CXIV
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,64,64
|
|
@ -1 +0,0 @@
|
|||
Inventar wechseln.
|
|
@ -1 +0,0 @@
|
|||
Select active item.
|
Before Width: | Height: | Size: 7.6 KiB |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "$Name$", def);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Name=Inventar
|
|
@ -1 +0,0 @@
|
|||
Name=Inventory
|
|
@ -1,7 +0,0 @@
|
|||
[DefCore]
|
||||
id=CXRL
|
||||
Version=4,9,8
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
Picture=0,0,64,64
|
Before Width: | Height: | Size: 6.6 KiB |
|
@ -1,5 +0,0 @@
|
|||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "Symbol", def);
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=L_AP
|
||||
Version=4,10,0,0
|
||||
Name=Lib Auto Production
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
|
@ -8,16 +8,16 @@ public func ControlCommandAcquire(target, x, y, target2, def)
|
|||
var obj = GetAvailableObject (def, target2);
|
||||
if (obj) {
|
||||
AddEffect("IntNotAvailable", obj, 1, 5, this);
|
||||
AddCommand (this, "Get", obj, 0, 0, 0, 40);
|
||||
AddCommand ("Get", obj, 0, 0, 0, 40);
|
||||
return 1;
|
||||
}
|
||||
// Search for a building to produce the object
|
||||
if (obj = GetProducerOf (def)) {
|
||||
AddCommand (this (), "Call", this, 0, 0, 0, 0, "AutoProduction", 0, 1);
|
||||
AddCommand ( "Call", this, 0, 0, 0, 0, "AutoProduction", 0, 1);
|
||||
obj -> HowToProduce (this, def);
|
||||
return 1;
|
||||
}
|
||||
AddCommand (this, "Buy", 0, 0, 0, 0, 100, def, 0, C4CMD_Sub);
|
||||
AddCommand ("Buy", 0, 0, 0, 0, 100, def, 0, C4CMD_Sub);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -25,15 +25,15 @@ public func AutoProduction() { return 1; }
|
|||
|
||||
public func AutoProductionFailed()
|
||||
{
|
||||
var def = GetCommand (this (), 5, 1);
|
||||
var def = GetCommand (5, 1);
|
||||
if (!FindContents(def)) {
|
||||
var obj = GetAvailableObject (def, GetCommand (this (), 4, 1));
|
||||
var obj = GetAvailableObject (def, GetCommand ( 4, 1));
|
||||
if (obj) {
|
||||
AddEffect("IntNotAvailable", obj, 1, 5, this);
|
||||
AddCommand (this, "Get", obj,0,0,0,40);
|
||||
AddCommand ("Get", obj,0,0,0,40);
|
||||
return 1;
|
||||
}
|
||||
AddCommand (this, "Buy", 0, 0, 0, 0, 100, GetCommand(this, 5, 1), 0, C4CMD_Sub);
|
||||
AddCommand ("Buy", 0, 0, 0, 0, 100, GetCommand(5, 1), 0, C4CMD_Sub);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ public func FxIntNotAvailableTimer(target, number)
|
|||
{
|
||||
var clonk = EffectVar(0, target, number);
|
||||
// Check wether the clonk still wants to get the object
|
||||
for (var i = 0; GetCommand(clonk,0,i); ++i) {
|
||||
if (GetCommand(clonk, 0, i) == "Get" && GetCommand(clonk, 1, i) == target)
|
||||
for (var i = 0; clonk->GetCommand(0,i); ++i) {
|
||||
if (clonk->GetCommand(0, i) == "Get" && clonk->GetCommand(1, i) == target)
|
||||
return;
|
||||
}
|
||||
return FX_Execute_Kill;
|
||||
|
@ -56,5 +56,5 @@ public func FxIntNotAvailableTimer(target, number)
|
|||
|
||||
public func GetProducerOf(def)
|
||||
{
|
||||
return FindObject2(Find_InRect(-500,-250,1000,500), Find_Func("IsProducerOf", this, def), Sort_Distance());
|
||||
return FindObject(Find_InRect(-500,-250,1000,500), Find_Func("IsProducerOf", this, def), Sort_Distance());
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=L_CM
|
||||
Version=4,10,0,0
|
||||
Name=Lib Context Menu
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=CXCP
|
||||
Version=4,9,8,1
|
||||
Name=Symbol
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=CXCN
|
||||
Version=4,9,8
|
||||
Name=Symbol
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=CXCM
|
||||
Version=4,9,8
|
||||
Name=Symbol
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=CXTX
|
||||
Version=4,9,8
|
||||
Name=Symbol
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=DSCN
|
||||
Version=4,9,8
|
||||
Name=Descend
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=CXHM
|
||||
Version=4,9,8
|
||||
Name=Symbol
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=CXIN
|
||||
Version=4,9,8
|
||||
Name=Symbol
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=CXIV
|
||||
Version=4,9,8
|
||||
Name=InventorySymbol
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
[DefCore]
|
||||
id=CXRL
|
||||
Version=4,9,8
|
||||
Name=Symbol
|
||||
Category=C4D_StaticBack
|
||||
Width=1
|
||||
Height=1
|
||||
|
|
|
@ -11,23 +11,23 @@ protected func ControlSpecial2()
|
|||
if (Contained())
|
||||
if ((Contained()->GetCategory() & C4D_Structure) || (Contained()->GetCategory() & C4D_Vehicle))
|
||||
{
|
||||
SetCommand(this,"Context",0,0,0,Contained());
|
||||
SetCommand("Context",0,0,0,Contained());
|
||||
return ExecuteCommand();
|
||||
}
|
||||
// Is pushing an object: open context menu of the pushed object
|
||||
if (GetAction() == "Push")
|
||||
if (GetProcedure() == "PUSH")
|
||||
{
|
||||
SetCommand(this,"Context",0,0,0,GetActionTarget());
|
||||
SetCommand("Context",0,0,0,GetActionTarget());
|
||||
return ExecuteCommand();
|
||||
}
|
||||
// Carries an object: open context menu of the first carried object
|
||||
if (Contents(0))
|
||||
{
|
||||
SetCommand(this,"Context",0,0,0,Contents(0));
|
||||
SetCommand("Context",0,0,0,Contents(0));
|
||||
return ExecuteCommand();
|
||||
}
|
||||
// Open context menu of the clonk then
|
||||
SetCommand(this,"Context",0,0,0,this);
|
||||
SetCommand("Context",0,0,0,this);
|
||||
return ExecuteCommand();
|
||||
}
|
||||
|
||||
|
@ -63,14 +63,14 @@ public func ContextChop(pCaller)
|
|||
[$CtxChop$|Image=CXCP|Condition=AtTreeToChop]
|
||||
var pTree;
|
||||
if (pTree = FindTree())
|
||||
SetCommand(this, "Chop", pTree);
|
||||
SetCommand("Chop", pTree);
|
||||
return 1;
|
||||
}
|
||||
|
||||
public func ContextConstruction(pCaller)
|
||||
{
|
||||
[$CtxConstructionDesc$|Image=CXCN|Condition=HasConstructMenu]
|
||||
SetCommand(this, "Construct");
|
||||
SetCommand("Construct");
|
||||
ExecuteCommand();
|
||||
return 1;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public func ContextConstruction(pCaller)
|
|||
public func ContextHome(pCaller)
|
||||
{
|
||||
[$CtxHomeDesc$|Image=CXHM|Condition=HasBase]
|
||||
SetCommand(this, "Home");
|
||||
SetCommand("Home");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public func ContextDescend(pCaller)
|
|||
public func IsRiding() { return (WildcardMatch(GetAction(), "Ride*")); }
|
||||
public func HasConstructMenu() { return HasKnowledge() && GetPhysical("CanConstruct"); }
|
||||
public func HasKnowledge() { return GetPlrKnowledge(GetOwner(),nil,0,C4D_Structure); }
|
||||
public func HasBase() { return FindBase(GetOwner()) && GetBase(Contained()) != GetOwner(); }
|
||||
public func HasBase() { return FindBase(GetOwner()) && Contained()->GetBase() != GetOwner(); }
|
||||
public func ReleaseAllowed() { return ObjectCount(REAC); }
|
||||
public func AtConstructionSite() { return !Contained() && FindConstructionSite() && ObjectCount(CNMT); }
|
||||
public func AtEnergySite() { return !Contained() && FindEnergySite(); }
|
||||
|
@ -101,17 +101,17 @@ public func AtTreeToChop() { return !Contained() && FindTree() && GetPhysical("C
|
|||
|
||||
public func FindConstructionSite()
|
||||
{
|
||||
return FindObject2(Find_AtRect(-1,-16,2,32), Find_OCF(OCF_Construct), Find_Layer(GetObjectLayer()));
|
||||
return FindObject(Find_AtRect(-1,-16,2,32), Find_OCF(OCF_Construct), Find_Layer(GetObjectLayer()));
|
||||
}
|
||||
|
||||
public func FindEnergySite()
|
||||
{
|
||||
return FindObject2(Find_AtPoint(), Find_OCF(OCF_PowerConsumer), Find_NoContainer(), Find_Layer(GetObjectLayer()), Find_Func("NeedsEnergy"));
|
||||
return FindObject(Find_AtPoint(), Find_OCF(OCF_PowerConsumer), Find_NoContainer(), Find_Layer(GetObjectLayer()), Find_Func("NeedsEnergy"));
|
||||
}
|
||||
|
||||
public func FindTree()
|
||||
{
|
||||
return FindObject2(Find_AtPoint(), Find_OCF(OCF_Chop), Find_Layer(GetObjectLayer()));
|
||||
return FindObject(Find_AtPoint(), Find_OCF(OCF_Chop), Find_Layer(GetObjectLayer()));
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
|
@ -125,7 +125,7 @@ protected func ControlCommand(szCommand, pTarget, iTx, iTy, pTarget2, Data)
|
|||
// Other command when riding: descend (exception: Context)
|
||||
if (IsRiding() && szCommand != "Context")
|
||||
{
|
||||
SetComDir(COMD_Stop,GetActionTarget());
|
||||
GetActionTarget()->SetComDir(COMD_Stop);
|
||||
GetActionTarget()->~ControlDownDouble(this);
|
||||
}
|
||||
// RejectConstruction Callback when constructing via Drag'n'Drop from a building menu
|
||||
|
@ -146,7 +146,7 @@ public func ControlCommandConstruction(target, x, y, target2, def)
|
|||
// Construction prohibited?
|
||||
if(def->~RejectConstruction(x - GetX(), y - GetY(), this) )
|
||||
// Finish construction command
|
||||
return FinishCommand(this, false, 0) ;
|
||||
return FinishCommand(false, 0);
|
||||
}
|
||||
|
||||
// Called when selecting the "Descend" menu entry
|
||||
|
@ -158,7 +158,7 @@ public func DescendVehicle()
|
|||
if (Stuck()) if (pOldVehicle)
|
||||
{
|
||||
var x=GetX(), y=GetY();
|
||||
SetPosition(GetX(pOldVehicle), GetY(pOldVehicle));
|
||||
SetPosition(pOldVehicle->GetX(), pOldVehicle->GetY());
|
||||
if (Stuck())
|
||||
{
|
||||
// Vehicle is stuck as well? Back to the roots.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#strict 2
|
||||
|
||||
// Functions to handle player controls (i.e., input keys)
|
||||
|
||||
|
@ -8,7 +7,7 @@
|
|||
// Return whether handled
|
||||
global func PlayerControl(int plr, int ctrl, id spec_id, int x, int y, int strength, bool repeat, bool release)
|
||||
{
|
||||
Log("%d, %s, %i, %d, %d, %d, %v, %v", plr, GetPlayerControlName(ctrl), spec_id, x,y,strength, repeat, release);
|
||||
//Log("%d, %s, %i, %d, %d, %d, %v, %v", plr, GetPlayerControlName(ctrl), spec_id, x,y,strength, repeat, release);
|
||||
// Control handled by definition? Forward
|
||||
if (spec_id) return spec_id->PlayerControl(plr, ctrl, x, y, strength, repeat, release);
|
||||
|
||||
|
@ -113,44 +112,6 @@ global func Control2Effect(int ctrl, int x, int y, int strength, bool repeat, bo
|
|||
return false;
|
||||
}
|
||||
|
||||
// Control redirected to script
|
||||
global func Control2Script(int ctrl, int x, int y, int strength, bool repeat, bool release, string control, object obj)
|
||||
{
|
||||
// for the use command
|
||||
if (ctrl == CON_Use)
|
||||
{
|
||||
var handled = false;
|
||||
|
||||
if(!release && !repeat)
|
||||
handled = obj->Call(Format("~%sUse",control),this,x,y);
|
||||
else if(release)
|
||||
handled = obj->Call(Format("~%sUseStop",control),this,x,y);
|
||||
else
|
||||
handled = obj->Call(Format("~%sUseHolding",control),this,x,y);
|
||||
|
||||
return handled;
|
||||
}
|
||||
// overloads of movement commandos
|
||||
else if (ctrl == CON_Left || ctrl == CON_Right || ctrl == CON_Down || ctrl == CON_Up)
|
||||
{
|
||||
if (release)
|
||||
{
|
||||
// if any movement key has been released, ControlStop is called
|
||||
if (obj->Call(Format("~%sStop",control),this)) return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Control*
|
||||
if (ctrl == CON_Left) if (obj->Call(Format("~%sLeft",control),this)) return true;
|
||||
if (ctrl == CON_Right) if (obj->Call(Format("~%sRight",control),this)) return true;
|
||||
if (ctrl == CON_Up) if (obj->Call(Format("~%sUp",control),this)) return true;
|
||||
if (ctrl == CON_Down) if (obj->Call(Format("~%sDown",control),this)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ObjectControl
|
||||
// Called from PlayerControl when a control is issued to the cursor
|
||||
// Return whether handled
|
||||
|
@ -161,198 +122,38 @@ global func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
|
||||
// Any control resets a previously given command
|
||||
SetCommand("None");
|
||||
|
||||
// hotkeys (inventory, vehicle and structure control)
|
||||
var hot = 0;
|
||||
if (ctrl == CON_Hotkey0) hot = 10;
|
||||
if (ctrl == CON_Hotkey1) hot = 1;
|
||||
if (ctrl == CON_Hotkey2) hot = 2;
|
||||
if (ctrl == CON_Hotkey3) hot = 3;
|
||||
if (ctrl == CON_Hotkey4) hot = 4;
|
||||
if (ctrl == CON_Hotkey5) hot = 5;
|
||||
if (ctrl == CON_Hotkey6) hot = 6;
|
||||
if (ctrl == CON_Hotkey7) hot = 7;
|
||||
if (ctrl == CON_Hotkey8) hot = 8;
|
||||
if (ctrl == CON_Hotkey9) hot = 9;
|
||||
|
||||
if (hot > 0) return this->~ControlHotkey(hot-1);
|
||||
|
||||
var proc = GetProcedure();
|
||||
|
||||
// building, vehicle, contents control
|
||||
var house = Contained();
|
||||
var vehicle = GetActionTarget();
|
||||
var contents = nil;
|
||||
// TODO
|
||||
|
||||
if (house)
|
||||
{
|
||||
if (Control2Script(ctrl, x, y, strength, repeat, release, "Contained", house))
|
||||
return true;
|
||||
}
|
||||
else if (vehicle)
|
||||
{
|
||||
// control to grabbed vehicle or riding etc.
|
||||
if (proc == "PUSH" || proc == "ATTACH")
|
||||
if (Control2Script(ctrl, x, y, strength, repeat, release, "Control", vehicle))
|
||||
return true;
|
||||
}
|
||||
else if (contents)
|
||||
{
|
||||
// out of convencience we call Control2Script, even though it can handle
|
||||
// left, right, up and down, too. We don't want that, so this is why we
|
||||
// check that ctrl is Use.
|
||||
if (ctrl == CON_Use)
|
||||
if (Control2Script(ctrl, x, y, strength, repeat, release, "Control", contents))
|
||||
return true;
|
||||
}
|
||||
// clonk control
|
||||
else
|
||||
{
|
||||
// for standard controls
|
||||
if(Control2Script(ctrl, x, y, strength, repeat, release, "Control", this)) return true;
|
||||
// and a few more...
|
||||
if(ctrl == CON_Throw) if(this->~ControlThrow(this,x,y)) return true;
|
||||
if(ctrl == CON_Jump) if(this->~ControlJump(this)) return true;
|
||||
}
|
||||
|
||||
// everything down from here:
|
||||
// standard controls that are called if not overloaded via script
|
||||
|
||||
// Movement controls
|
||||
if (ctrl == CON_Left || ctrl == CON_Right || ctrl == CON_Up || ctrl == CON_Down || ctrl == CON_Jump)
|
||||
return ObjectControlMovement(plr, ctrl, strength, release);
|
||||
|
||||
// Push controls
|
||||
if (ctrl == CON_Grab || ctrl == CON_Ungrab || ctrl == CON_PushEnter || ctrl == CON_GrabPrevious || ctrl == CON_GrabNext)
|
||||
return ObjectControlPush(plr, ctrl);
|
||||
|
||||
// Entrance controls
|
||||
if (ctrl == CON_Enter || CON_Exit)
|
||||
return ObjectControlEntrance(plr,ctrl);
|
||||
|
||||
// Inventory control
|
||||
if (ctrl == CON_NextItem)
|
||||
{
|
||||
ShiftContents(false);
|
||||
return true;
|
||||
}
|
||||
if (ctrl == CON_PreviousItem)
|
||||
{
|
||||
ShiftContents(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// only if not in house, not grabbing a vehicle and an item selected
|
||||
if(!house && !vehicle && contents)
|
||||
{
|
||||
// throw
|
||||
if (ctrl == CON_Throw)
|
||||
{
|
||||
if (proc == "SCALE" || proc == "HANGLE")
|
||||
return PlayerObjectCommand(plr, false, "Drop");
|
||||
else
|
||||
return PlayerObjectCommand(plr, false, "Throw");
|
||||
}
|
||||
// drop
|
||||
if (ctrl == CON_Drop)
|
||||
{
|
||||
return PlayerObjectCommand(plr, false, "Drop");
|
||||
}
|
||||
}
|
||||
|
||||
// Unhandled control
|
||||
return false;
|
||||
}
|
||||
|
||||
// ObjectControlEntrance
|
||||
// Handles enter and exit
|
||||
global func ObjectControlEntrance(int plr, int ctrl)
|
||||
// Find an object with an entrance in front of this object whose entrance is at
|
||||
// the right position
|
||||
global func GetEntranceObject()
|
||||
{
|
||||
var proc = GetProcedure();
|
||||
if (!this) return nil;
|
||||
|
||||
// enter
|
||||
if (ctrl == CON_Enter)
|
||||
{
|
||||
// enter only if... one can
|
||||
if (proc != "WALK" && proc != "SWIM" && proc != "SCALE" &&
|
||||
proc != "HANGLE" && proc != "FLOAT" && proc != "FLIGHT") return false;
|
||||
// object with an entrance on target position
|
||||
var obj = FindObject(Find_OCF(OCF_Entrance), Find_AtPoint(0,0), Find_Exclude(this));
|
||||
if (!obj) return nil;
|
||||
|
||||
// a building with an entrance at right position is there?
|
||||
var obj = GetEntranceObject();
|
||||
if (!obj) return false;
|
||||
var x = obj->GetDefCoreVal("Entrance","DefCore",0) + obj->GetX();
|
||||
var y = obj->GetDefCoreVal("Entrance","DefCore",1) + obj->GetY();
|
||||
var wdt = obj->GetDefCoreVal("Entrance","DefCore",2);
|
||||
var hgt = obj->GetDefCoreVal("Entrance","DefCore",3);
|
||||
|
||||
PlayerObjectCommand(plr, false, "Enter", obj);
|
||||
return true;
|
||||
}
|
||||
// entrance is on the vehicle?
|
||||
if (!Inside(GetX(), x, x+wdt)) return nil;
|
||||
if (!Inside(GetY(), y, y+hgt)) return nil;
|
||||
|
||||
// exit
|
||||
if (ctrl == CON_Exit)
|
||||
{
|
||||
if (!Contained()) return false;
|
||||
|
||||
PlayerObjectCommand(plr, false, "Exit");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return obj;
|
||||
}
|
||||
|
||||
// ObjectControlPush
|
||||
// Handles push controls
|
||||
global func ObjectControlPush(int plr, int ctrl)
|
||||
{
|
||||
if (!this) return false;
|
||||
|
||||
var proc = GetProcedure();
|
||||
|
||||
// grabbing
|
||||
if (ctrl == CON_Grab)
|
||||
{
|
||||
// grab only if he walks
|
||||
if (proc != "WALK") return false;
|
||||
|
||||
// only if there is someting to grab
|
||||
var obj = FindObject(Find_OCF(OCF_Grab), Find_AtPoint(0,0), Find_Exclude(this));
|
||||
if (!obj) return false;
|
||||
|
||||
// grab
|
||||
PlayerObjectCommand(plr, false, "Grab", obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
// grab next/previous
|
||||
if (ctrl == CON_GrabNext)
|
||||
return ShiftVehicle(plr, false);
|
||||
if (ctrl == CON_GrabPrevious)
|
||||
return ShiftVehicle(plr, true);
|
||||
|
||||
// ungrabbing
|
||||
if (ctrl == CON_Ungrab)
|
||||
{
|
||||
// ungrab only if he pushes
|
||||
if (proc != "PUSH") return false;
|
||||
|
||||
PlayerObjectCommand(plr, false, "Ungrab");
|
||||
return true;
|
||||
}
|
||||
|
||||
// push into building
|
||||
if (ctrl == CON_PushEnter)
|
||||
{
|
||||
if (proc != "PUSH") return false;
|
||||
|
||||
// a building with an entrance at right position is there?
|
||||
var obj = GetActionTarget()->GetEntranceObject();
|
||||
if (!obj) return false;
|
||||
|
||||
PlayerObjectCommand(plr, false, "PushTo", obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ObjectControlMovement
|
||||
// Called when CON_Left/Right/Up/Down controls are issued/released
|
||||
// Return whether handled
|
||||
global func ObjectControlMovement(int plr, int ctrl, int strength, bool release)
|
||||
|
@ -389,7 +190,6 @@ global func ObjectControlMovement(int plr, int ctrl, int strength, bool release)
|
|||
return ObjectControlUpdateComdir(plr);
|
||||
}
|
||||
|
||||
// ObjectControlUpdateComdir
|
||||
// Updates ComDir of object based on current Con_*-directional controls
|
||||
// Return whether actual, effective direction of movement changed
|
||||
global func ObjectControlUpdateComdir(int plr)
|
||||
|
@ -439,7 +239,6 @@ global func ObjectControlUpdateComdir(int plr)
|
|||
}
|
||||
}
|
||||
|
||||
// ShiftCursor
|
||||
// selects the next/previous crew member (that is not disabled)
|
||||
global func ShiftCursor(int plr, bool back)
|
||||
{
|
||||
|
@ -481,72 +280,7 @@ global func ShiftCursor(int plr, bool back)
|
|||
return SetCursor(plr, GetCrew(plr,index));
|
||||
}
|
||||
|
||||
// ShiftVehicle
|
||||
// grabs the next/previous vehicle (if there is any)
|
||||
global func ShiftVehicle(int plr, bool back)
|
||||
{
|
||||
if (!this) return false;
|
||||
|
||||
if (GetProcedure() != "PUSH") return false;
|
||||
|
||||
var lorry = GetActionTarget();
|
||||
// get all grabbable objects
|
||||
var objs = FindObjects(Find_OCF(OCF_Grab), Find_AtPoint(0,0), Find_Exclude(this));
|
||||
|
||||
// nothing to switch to (there is no other grabbable object)
|
||||
if (GetLength(objs) <= 1) return false;
|
||||
|
||||
// find out at what index of the array objs the vehicle is located
|
||||
var index = 0;
|
||||
for(var obj in objs)
|
||||
{
|
||||
if (obj == lorry) break;
|
||||
index++;
|
||||
}
|
||||
|
||||
// get the next/previous vehicle
|
||||
if (back)
|
||||
{
|
||||
--index;
|
||||
if (index < 0) index = GetLength(objs)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
++index;
|
||||
if (index >= GetLength(objs)) index = 0;
|
||||
}
|
||||
|
||||
PlayerObjectCommand(plr, false, "Grab", objs[index]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// GetEntranceObject
|
||||
// Find an object with an entrance in front of this object whose entrance is at
|
||||
// the right position
|
||||
global func GetEntranceObject()
|
||||
{
|
||||
if (!this) return nil;
|
||||
|
||||
// object with an entrance on target position
|
||||
var obj = FindObject(Find_OCF(OCF_Entrance), Find_AtPoint(0,0), Find_Exclude(this));
|
||||
if (!obj) return nil;
|
||||
|
||||
var x = obj->GetDefCoreVal("Entrance","DefCore",0) + obj->GetX();
|
||||
var y = obj->GetDefCoreVal("Entrance","DefCore",1) + obj->GetY();
|
||||
var wdt = obj->GetDefCoreVal("Entrance","DefCore",2);
|
||||
var hgt = obj->GetDefCoreVal("Entrance","DefCore",3);
|
||||
|
||||
// entrance is on the vehicle?
|
||||
if (!Inside(GetX(), x, x+wdt)) return nil;
|
||||
if (!Inside(GetY(), y, y+hgt)) return nil;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
// Temporarily used for Debugging!
|
||||
// GetPlayerControlName
|
||||
// Helper function to turn CON_*-constants into strings
|
||||
global func GetPlayerControlName(int ctrl)
|
||||
{
|
||||
|
@ -601,7 +335,6 @@ global func GetPlayerControlName(int ctrl)
|
|||
return Format("Unknown(%d)", ctrl);
|
||||
}
|
||||
|
||||
// GetPlayerConDir
|
||||
// Return COMD_*-constant corresponding to current state of passed directional controls
|
||||
global func GetPlayerConDir(int plr, int con_left, int con_up, int con_right, int con_down)
|
||||
{
|
||||
|
@ -616,7 +349,6 @@ global func GetPlayerConDir(int plr, int con_left, int con_up, int con_right, in
|
|||
return dir_coms[y*3+x+4];
|
||||
}
|
||||
|
||||
// ComDir2XY
|
||||
// Returns coordinate directions associated with a COMD_Constant
|
||||
global func ComDir2XY(int comd, &x, &y)
|
||||
{
|
||||
|
@ -627,7 +359,6 @@ global func ComDir2XY(int comd, &x, &y)
|
|||
return true;
|
||||
}
|
||||
|
||||
// PlayerObjectCommand
|
||||
// Give a command to all selected Clonks of a player
|
||||
global func PlayerObjectCommand(int plr, bool exclude_cursor, string command, object target, int tx, int ty, object target2)
|
||||
{
|
||||
|
@ -642,18 +373,6 @@ global func PlayerObjectCommand(int plr, bool exclude_cursor, string command, ob
|
|||
return true;
|
||||
}
|
||||
|
||||
// ObjectComStop
|
||||
// Stop action and ComDir
|
||||
global func ObjectComStop()
|
||||
{
|
||||
SetComDir();
|
||||
SetAction("Idle");
|
||||
if (!SetAction("Walk")) return false;
|
||||
SetXDir(); SetYDir();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ObjectComLetGo
|
||||
// Let go from scaling or hangling
|
||||
global func ObjectComLetGo(int vx, int vy)
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
GUIName=Use
|
||||
GUIDesc=Use selected or controlled item
|
||||
Hold=1
|
||||
RepeatDelay=1
|
||||
RepeatDelay=5
|
||||
|
||||
[ControlDef]
|
||||
Identifier=Grab
|
||||
|
@ -310,13 +310,13 @@
|
|||
# MenuUp, Up, Jump x W
|
||||
# MenuDown, Down x S
|
||||
#
|
||||
# NextItem x Scrollwheel-Up (now: Down)
|
||||
# PreviousItem x Scrollwheel-Down (now: Up)
|
||||
# NextItem x Scrollwheel-Up (now: Up)
|
||||
# PreviousItem x Scrollwheel-Down (now: Unassigned)
|
||||
# Hotkey0-9 x (0-9)
|
||||
#
|
||||
# Use, Throw x Left mouse button (now: Left)
|
||||
# Throw x Shift+Left mouse button (now: X+Left)
|
||||
# Drop x S+Left mouse button (now: S+Left)
|
||||
# Throw x Shift+Left mouse button (now: Right)
|
||||
# Drop x S+Left mouse button (now: Down)
|
||||
#
|
||||
# PushEnter, GrabNext, Ungrab,
|
||||
# Grab, Exit, Enter x Space
|
||||
|
@ -511,12 +511,12 @@
|
|||
Key=End
|
||||
Control=PlayerMenu
|
||||
|
||||
[Assignment]
|
||||
Key=Up
|
||||
Control=PreviousItem
|
||||
#[Assignment]
|
||||
#Key=Up
|
||||
#Control=PreviousItem
|
||||
|
||||
[Assignment]
|
||||
Key=Down
|
||||
Key=Up
|
||||
Control=NextItem
|
||||
|
||||
[Assignment]
|
||||
|
@ -530,9 +530,9 @@
|
|||
Control=Throw
|
||||
|
||||
[Assignment]
|
||||
Key=X,Left
|
||||
Key=Right
|
||||
Control=Throw
|
||||
|
||||
[Assignment]
|
||||
Key=S,Left
|
||||
Key=Down
|
||||
Control=Drop
|
||||
|
|