remove base library

* remove library itself
* remove GetBase()
* change flagpole, etc.
* move basematerial library to vendor
ipv6
Maikel de Vries 2016-12-28 18:19:10 +01:00
parent 7968372dfa
commit 59961f3a17
16 changed files with 21 additions and 164 deletions

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>GetBase</title>
<category>Player</category>
<version>5.1 OC</version>
<syntax><rtype>int</rtype></syntax>
<desc>Returns the player whose home base the specified object is. Return value <funclink>NO_OWNER</funclink> if the object is not a home base.</desc>
<related><funclink>FindBase</funclink></related>
</func>
<author>jwk</author><date>2002-06</date>
</funcs>

View File

@ -1,6 +0,0 @@
[DefCore]
id=BaseMaterial
Version=6,0
Category=C4D_StaticBack
Picture=0,0,64,64
HideInCreator=true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1,94 +0,0 @@
/*--- The Base ---*/
// Author: Randrian
// Determines it the Building is acutally a base
local fIsBase;
local iEnergy;
// ---------------- Settings for base funcionallity --------------------
// --- these functions can be overloaded for vendors or special bases ---
// Determines if the base can heal allied clonks
public func CanHeal() { return true; }
// The amount of energy the base can store, if none the base can't heal
public func GetHeal() { return 100; }
// The money one filling of the bases energy storage costs
public func GetHealCost() { return 5;}
// Determines if the base can extinguish allied clonks
public func CanExtinguish() { return true; }
// Does the base block enemies?
public func CanBlockEnemies() { return true; }
// ------------- Base states -------------------------------
// This Building can be a base
public func IsBaseBuilding() { return true; }
// This Building is a base at the moment
public func IsBase() { return fIsBase; }
// Makes this building a base or removes the base functionallity
public func MakeBase(bool fRemoveBase)
{
if(fRemoveBase)
{
fIsBase = 0;
RemoveEffect("IntBase", this);
}
else
{
fIsBase = 1;
AddEffect("IntBase", this, 1, 10, this);
if(!FindObject(Find_ID(BaseMaterial), Find_Owner(GetOwner())))
CreateObjectAbove(BaseMaterial,AbsX(10),AbsY(10),GetOwner());
}
}
// ---------- Healing, Extinguishing and Autosell -----------
func FxIntBaseTimer(pThis, effect, iTime)
{
var pObj;
// Can this base heal? Then look for clonks that need some
if(CanHeal() && GetHeal())
for(pObj in FindObjects(Find_Container(this), Find_OCF(OCF_CrewMember), Find_Allied(GetOwner())))
{
if(pObj->GetEnergy() < pObj->GetMaxEnergy() && !GetEffect("IntBaseHeal", pObj))
AddEffect("IntBaseHeal", pObj, 1, 1, this);
}
// Can this base extinguish? Then look for something on fire
if(CanExtinguish())
for(pObj in FindObjects(Find_Container(this), Find_OCF(OCF_OnFire), Find_Allied(GetOwner())))
pObj->Extinguish();
}
func FxIntBaseHealTimer(pClonk, effect)
{
// The clonk has left the base? Stop!
if(pClonk->Contained() != this) return -1;
// Full energy? Stop too.
if(pClonk->GetEnergy() >= pClonk->GetMaxEnergy()) return -1;
// No energy left? Buy some
if(!iEnergy)
{
if(GetWealth(GetOwner()) >= GetHealCost())
{
DoWealth(GetOwner(), -GetHealCost());
Sound("UI::UnCash?", {player = pClonk->GetOwner()});
iEnergy = GetHeal()*5;
}
}
// Some energy in the storage? heal clonk
if(iEnergy)
{
pClonk->DoEnergy(200, 1, FX_Call_EngBaseRefresh, GetOwner()+1);
iEnergy--;
}
}
local Name = "$Name$";

View File

@ -1,8 +0,0 @@
Name=Basissteuerung
Buy=Kaufen
Sell=Verkaufen
TxtNothingToBuy=Nichts zu kaufen
TxtBuy=Kaufen: %s
TxtNotEnoughtMoney=Du hast nicht|genug Geld!
TxtNothingToSell=Nichts zu verkaufen
TxtSell=Verkaufen: %s

View File

@ -1,8 +0,0 @@
Name=Base control
Buy=Buy
Sell=Sell
TxtNothingToBuy=Nothing to buy
TxtBuy=Buy: %s
TxtNotEnoughtMoney=You don't have|enough money!
TxtNothingToSell=Nothing to sell
TxtSell=Sell: %s

View File

@ -7,7 +7,7 @@
protected func ActivateEntrance(object entering_obj)
{
if (this->~IsBase() && this->~CanBlockEnemies())
if (this->~CanBlockEnemies())
{
var for_plr = entering_obj->GetOwner();
if (Hostile(GetOwner(), for_plr))

View File

@ -1,6 +1,5 @@
[DefCore]
id=Library_Base
id=Library_BaseMaterial
Version=6,0
Category=C4D_StaticBack
Picture=0,0,64,64
HideInCreator=true

View File

@ -34,54 +34,54 @@ static const BASEMATERIAL_ProductionRate = 2160;
global func GetBaseMaterial(int plr, id def, int index, int category)
{
var base = FindObject(Find_ID(BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
var base = FindObject(Find_ID(Library_BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
if (!base)
base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
base = CreateObject(Library_BaseMaterial, 0, 0, plr);
if (base)
return base->GetBaseMat(def, index, category);
}
global func SetBaseMaterial(int plr, id def, int cnt)
{
var base = FindObject(Find_ID(BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
var base = FindObject(Find_ID(Library_BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
if (!base)
base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
base = CreateObject(Library_BaseMaterial, 0, 0, plr);
if (base)
return base->SetBaseMat(def, cnt);
}
global func DoBaseMaterial(int plr, id def, int change)
{
var base = FindObject(Find_ID(BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
var base = FindObject(Find_ID(Library_BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
if (!base)
base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
base = CreateObject(Library_BaseMaterial, 0, 0, plr);
if (base)
return base->DoBaseMat(def, change);
}
global func GetBaseProduction(int plr, id def, int index, int category)
{
var base = FindObject(Find_ID(BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
var base = FindObject(Find_ID(Library_BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
if (!base)
base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
base = CreateObject(Library_BaseMaterial, 0, 0, plr);
if (base)
return base->GetBaseProd(def, index, category);
}
global func SetBaseProduction(int plr, id def, int cnt)
{
var base = FindObject(Find_ID(BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
var base = FindObject(Find_ID(Library_BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
if (!base)
base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
base = CreateObject(Library_BaseMaterial, 0, 0, plr);
if (base)
return base->SetBaseProd(def, cnt);
}
global func DoBaseProduction(int plr, id def, int change)
{
var base = FindObject(Find_ID(BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
var base = FindObject(Find_ID(Library_BaseMaterial), Find_AnyLayer(), Find_Owner(plr));
if (!base)
base = CreateObjectAbove(BaseMaterial, AbsX(10), AbsY(10), plr);
base = CreateObject(Library_BaseMaterial, 0, 0, plr);
if (base)
return base->DoBaseProd(def, change);
}
@ -339,12 +339,8 @@ public func DoBaseProd(id def, int change)
}
func Destruction() { Log("fsdfs"); }
/*-- Miscellaneous --*/
// Internal management object not saved. Use Scenario.txt or script
// to adjust base materials and production.
func SaveScenarioObject() { return false; }
local Name = "$Name$";

View File

@ -3,7 +3,6 @@
#include Library_Ownable
#include Library_Structure
#include Library_Flag
#include Library_Base // Needed for DoBuy...
#include Library_PowerDisplay
#include Library_Vendor
@ -37,6 +36,11 @@ public func IsHammerBuildable() { return true; }
public func NoConstructionFlip() { return true; }
// This building is a base.
public func IsBaseBuilding() { return true; }
public func IsBase() { return true; }
/*-- Interaction --*/
// The flag can take valuables which are then auto-sold.

View File

@ -138,7 +138,6 @@ Split2Components() - Splits the calling object into its components.
RootSurface() - Pulls an object above ground if it was buried (e.g. by PlaceVegetation).
Buy() - Buys an object.
Sell() - Sells an object.
GetBase() - Returns the owner if this is a base.
##### Player.c:

View File

@ -400,14 +400,6 @@ global func Sell (int iPlr, object pObj, object pToVendor)
return pToVendor->DoSell(pObj, iPlr);
}
// Returns the owner if this is a base.
global func GetBase ()
{
if(!(this->~IsBase())) return NO_OWNER;
return GetOwner();
}
/* GetXEdge returns the position of the objects top/bottom/left/right edge */
global func GetLeftEdge()
{

View File

@ -151,7 +151,7 @@ global func GetDefaultMenuDecoration()
}
// Find a base of the given player. Use index to search through all bases.
global func FindBase (int iPlr, int iIndex)
global func FindBase(int plr, int index)
{
return FindObjects(Find_Owner(iPlr), Find_Func("IsBase"))[iIndex];
return FindObjects(Find_Owner(plr), Find_Func("IsBase"))[index];
}