forked from Mirrors/openclonk
fixed scripted base behaviour, removed player hud
parent
708376f310
commit
d47100ae78
|
@ -36,7 +36,7 @@ protected func Construction()
|
|||
|
||||
// wealth display
|
||||
wealth = CreateObject(WEAL,0,0,GetOwner());
|
||||
wealth->SetPosition(-16-WEAL->GetDefHeight()/2,16+WEAL->GetDefHeight()/2);
|
||||
wealth->SetPosition(-16-WEAL->GetDefHeight()/2,8+WEAL->GetDefHeight()/2);
|
||||
wealth->Update();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@ public func Update()
|
|||
{
|
||||
var val = GetWealth(GetOwner());
|
||||
|
||||
CustomMessage(Format("@%d",val), this, GetOwner(), 0, 80);
|
||||
CustomMessage(Format("@%d",val), this, GetOwner(), 0, 75);
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
/*--- The Base ---*/
|
||||
|
||||
#strict 2
|
||||
|
||||
func Definition(def) {
|
||||
SetProperty("Name", "$Name$", def);
|
||||
}
|
||||
|
@ -10,7 +8,6 @@ func Initialize()
|
|||
{
|
||||
var iPlrNumber = GetOwner()%4+1;
|
||||
var szSection = Format("Player%d", iPlrNumber); // TODO: Check teams and get the fitting player section
|
||||
iWealth = GetScenarioVal ("Wealth", szSection, 0);
|
||||
|
||||
aHomebaseMaterial = [];
|
||||
aHomabaseProduction = [];
|
||||
|
@ -43,6 +40,9 @@ local ProductionUnit;
|
|||
|
||||
func ExecHomeBaseProduction()
|
||||
{
|
||||
// Do not exec if no base is around
|
||||
if(!FindBase(GetOwner())) return;
|
||||
|
||||
// Called every minute
|
||||
ProductionUnit++;
|
||||
var aArray;
|
||||
|
@ -58,72 +58,39 @@ func ExecHomeBaseProduction()
|
|||
|
||||
local aHomebaseMaterial; // Array filled with [idDef, iCount] arrays
|
||||
local aHomabaseProduction;
|
||||
local iWealth;
|
||||
|
||||
// ---------------------- global Interface ---------------------------
|
||||
|
||||
global func GetHomebaseMaterial (int iPlr, id idDef, int iIndex, int dwCategory)
|
||||
{
|
||||
var pObj = FindObject(Find_ID(BASM), Find_Owner(iPlr));
|
||||
if(!pObj) pObj = CreateObject(BASM,AbsX(10),AbsY(10),GetOwner());
|
||||
if(pObj) return pObj->DoGetHomebaseMaterial(idDef, iIndex, dwCategory);
|
||||
}
|
||||
|
||||
global func GetHomebaseProduction (int iPlr, id idDef, int iIndex, int dwCategory)
|
||||
{
|
||||
var pObj = FindObject(Find_ID(BASM), Find_Owner(iPlr));
|
||||
if(!pObj) pObj = CreateObject(BASM,AbsX(10),AbsY(10),GetOwner());
|
||||
if(pObj) return pObj->DoGetHomebaseProduction(idDef, iIndex, dwCategory);
|
||||
}
|
||||
|
||||
global func DoHomebaseMaterial (int iPlr, id idID, int iChange)
|
||||
{
|
||||
var pObj = FindObject(Find_ID(BASM), Find_Owner(iPlr));
|
||||
if(!pObj) pObj = CreateObject(BASM,AbsX(10),AbsY(10),GetOwner());
|
||||
if(pObj) return pObj->DoDoHomebaseMaterial(idID, iChange);
|
||||
}
|
||||
|
||||
global func DoHomebaseProduction (int iPlr, id idID, int iChange)
|
||||
{
|
||||
var pObj = FindObject(Find_ID(BASM), Find_Owner(iPlr));
|
||||
if(!pObj) pObj = CreateObject(BASM,AbsX(10),AbsY(10),GetOwner());
|
||||
if(pObj) return pObj->DoDoHomebaseProduction(idID, iChange);
|
||||
}
|
||||
|
||||
global func GetWealth (int iOwner)
|
||||
{
|
||||
var pObj = FindObject(Find_ID(BASM), Find_Owner(iOwner));
|
||||
if(pObj) return pObj->DoGetWealth();
|
||||
}
|
||||
|
||||
global func SetWealth (int iPlr, int iValue)
|
||||
{
|
||||
var pObj = FindObject(Find_ID(BASM), Find_Owner(iPlr));
|
||||
if(pObj) return pObj->DoSetWealth(iValue);
|
||||
}
|
||||
|
||||
global func DoWealth (int iPlr, int iChange)
|
||||
{
|
||||
var pObj = FindObject(Find_ID(BASM), Find_Owner(iPlr));
|
||||
if(pObj) return pObj->DoDoWealth(iChange);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
public func DoGetWealth()
|
||||
{
|
||||
return iWealth;
|
||||
}
|
||||
|
||||
public func DoSetWealth(int iValue)
|
||||
{
|
||||
iWealth = iValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
public func DoDoWealth(int iChange)
|
||||
{
|
||||
iWealth += iChange;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public func DoGetHomebaseMaterial (id idDef, int iIndex, int dwCategory)
|
||||
{
|
||||
var aArray;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/*--- The Base ---*/
|
||||
|
||||
#strict 2
|
||||
|
||||
// Determines it the Building is acutally a base
|
||||
local fIsBase;
|
||||
local iEnergy;
|
||||
|
@ -111,6 +109,8 @@ public func MakeBase(bool fRemoveBase)
|
|||
{
|
||||
fIsBase = 1;
|
||||
AddEffect("IntBase", this, 1, 10, this);
|
||||
if(!FindObject(Find_ID(BASM), Find_Owner(GetOwner())))
|
||||
CreateObject(BASM,AbsX(10),AbsY(10),GetOwner());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -430,10 +430,11 @@ global func Sell (int iPlr, object pObj, object pToBase)
|
|||
|
||||
global func FindBase (int iPlr, int iIndex)
|
||||
{
|
||||
return FindObjects(Find_Owner(iPlr), Find_Category(C4D_Structure), Find_Func("IsBase"))[iIndex];
|
||||
return FindObjects(Find_Owner(iPlr), Find_Func("IsBase"))[iIndex];
|
||||
}
|
||||
|
||||
global func GetBase (object pObj)
|
||||
global func GetBase ()
|
||||
{
|
||||
if(!(this->~IsBase())) return NO_OWNER;
|
||||
return GetOwner();
|
||||
}
|
|
@ -63,7 +63,7 @@ InEarth=ROCK=1;GOLD=1;DYNA=10;LOAM=1
|
|||
InEarthLevel=65,0,0,100
|
||||
Sky=Clouds2
|
||||
MapWidth=200,0,64,250
|
||||
MapHeight=200,0,40,250
|
||||
MapHeight=100,0,40,250
|
||||
Amplitude=10,10,0,100
|
||||
Phase=50,50,0,100
|
||||
Period=10,10,0,100
|
||||
|
|
|
@ -1301,41 +1301,6 @@ void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo)
|
|||
C4Facet ccgo;
|
||||
if (!ValidPlr(Player)) return;
|
||||
|
||||
// Wealth
|
||||
if (::Players.Get(Player)->ViewWealth || Config.Graphics.ShowPlayerInfoAlways)
|
||||
{
|
||||
int32_t wdt = C4SymbolSize;
|
||||
int32_t hgt = C4SymbolSize/2;
|
||||
ccgo.Set(cgo.Surface,
|
||||
cgo.X+cgo.Wdt-wdt-C4SymbolBorder,
|
||||
cgo.Y+C4SymbolBorder,
|
||||
wdt,hgt);
|
||||
::GraphicsResource.fctWealth.DrawValue(ccgo,::Players.Get(Player)->Wealth, 0, Config.Graphics.Currency);
|
||||
}
|
||||
|
||||
// Value gain
|
||||
if (Config.Graphics.ShowPlayerInfoAlways)
|
||||
{
|
||||
int32_t wdt = C4SymbolSize;
|
||||
int32_t hgt = C4SymbolSize/2;
|
||||
ccgo.Set(cgo.Surface,
|
||||
cgo.X+cgo.Wdt-2*wdt-2*C4SymbolBorder,
|
||||
cgo.Y+C4SymbolBorder,
|
||||
wdt,hgt);
|
||||
::GraphicsResource.fctScore.DrawValue(ccgo,::Players.Get(Player)->ValueGain);
|
||||
}
|
||||
|
||||
// Crew
|
||||
if (Config.Graphics.ShowPlayerInfoAlways)
|
||||
{
|
||||
int32_t wdt = C4SymbolSize;
|
||||
int32_t hgt = C4SymbolSize/2;
|
||||
ccgo.Set(cgo.Surface,
|
||||
cgo.X+cgo.Wdt-3*wdt-3*C4SymbolBorder,
|
||||
cgo.Y+C4SymbolBorder,
|
||||
wdt,hgt);
|
||||
::GraphicsResource.fctCrewClr.DrawValue2Clr(ccgo,::Players.Get(Player)->SelectCount,::Players.Get(Player)->ActiveCrewCount(),::Players.Get(Player)->ColorDw);
|
||||
}
|
||||
|
||||
// Controls
|
||||
DrawPlayerControls(cgo);
|
||||
|
|
Loading…
Reference in New Issue