forked from Mirrors/openclonk
remove object component functionality from the engine
parent
1df322b7ff
commit
6794b3b630
|
@ -987,31 +987,6 @@ static C4Def * FnGetDefinition(C4PropList * _this, long iIndex)
|
|||
return ::Definitions.GetDef(iIndex);
|
||||
}
|
||||
|
||||
static C4Value FnGetComponent(C4PropList * _this, C4ID idComponent, int iIndex, C4Object * pObj, C4ID idDef)
|
||||
{
|
||||
// Def component - as seen by scope object as builder
|
||||
if (idDef)
|
||||
{
|
||||
// Get def
|
||||
C4Def *pDef=C4Id2Def(idDef); if (!pDef) return C4Value();
|
||||
// Component count
|
||||
if (idComponent) return C4VInt(pDef->GetComponentCount(idComponent));
|
||||
// Indexed component
|
||||
return C4VPropList(C4Id2Def(pDef->GetIndexedComponent(iIndex)));
|
||||
}
|
||||
// Object component
|
||||
else
|
||||
{
|
||||
// Get object
|
||||
if (!pObj) pObj=Object(_this); if (!pObj) return C4Value();
|
||||
// Component count
|
||||
if (idComponent) return C4VInt(pObj->Component.GetIDCount(idComponent));
|
||||
// Indexed component
|
||||
return C4VPropList(C4Id2Def(pObj->Component.GetID(iIndex)));
|
||||
}
|
||||
return C4Value();
|
||||
}
|
||||
|
||||
static C4Value FnGetBaseMaterial(C4PropList * _this, int iPlr, C4ID id, int iIndex, int dwCategory)
|
||||
{
|
||||
if (!ValidPlr(iPlr)) return C4VBool(false);
|
||||
|
@ -2867,7 +2842,6 @@ void InitGameFunctionMap(C4AulScriptEngine *pEngine)
|
|||
F(GainScenarioAchievement);
|
||||
F(GetPXSCount);
|
||||
F(GetPlrKnowledge);
|
||||
F(GetComponent);
|
||||
F(GetBaseMaterial);
|
||||
F(GetBaseProduction);
|
||||
F(GetDefCoreVal);
|
||||
|
|
|
@ -94,7 +94,6 @@ void C4Def::DefaultDefCore()
|
|||
PictureRect.Default();
|
||||
SolidMask.Default();
|
||||
TopFace.Default();
|
||||
Component.Default();
|
||||
BurnTurnTo=C4ID::None;
|
||||
GrowthType=0;
|
||||
CrewMember=0;
|
||||
|
@ -212,7 +211,6 @@ void C4Def::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkParAdapt(Shape, static_cast<C4Shape*>(NULL)));
|
||||
pComp->Value(mkNamingAdapt(Value, "Value", 0 ));
|
||||
pComp->Value(mkNamingAdapt(Mass, "Mass", 0 ));
|
||||
pComp->Value(mkNamingAdapt(Component, "Components", C4IDList() ));
|
||||
pComp->Value(mkNamingAdapt(SolidMask, "SolidMask", TargetRect0 ));
|
||||
pComp->Value(mkNamingAdapt(TopFace, "TopFace", TargetRect0 ));
|
||||
pComp->Value(mkNamingAdapt(PictureRect, "Picture", Rect0 ));
|
||||
|
@ -626,27 +624,6 @@ void C4Def::Synchronize()
|
|||
{
|
||||
}
|
||||
|
||||
int32_t C4Def::GetComponentCount(C4ID idComponent)
|
||||
{
|
||||
return Component.GetIDCount(idComponent);
|
||||
}
|
||||
|
||||
C4ID C4Def::GetIndexedComponent(int32_t idx)
|
||||
{
|
||||
return Component.GetID(idx);
|
||||
}
|
||||
|
||||
void C4Def::GetComponents(C4IDList *pOutList, C4Object *pObjInstance)
|
||||
{
|
||||
assert(pOutList);
|
||||
assert(!pOutList->GetNumberOfIDs());
|
||||
// no valid script overload: Assume object or definition components
|
||||
if (pObjInstance)
|
||||
*pOutList = pObjInstance->Component;
|
||||
else
|
||||
*pOutList = Component;
|
||||
}
|
||||
|
||||
void C4Def::IncludeDefinition(C4Def *pIncludeDef)
|
||||
{
|
||||
// inherited rank infos and clonk names, if this definition doesn't have its own
|
||||
|
|
|
@ -110,7 +110,6 @@ public:
|
|||
C4Rect PictureRect;
|
||||
C4TargetRect SolidMask;
|
||||
C4TargetRect TopFace;
|
||||
C4IDList Component;
|
||||
C4ID BurnTurnTo;
|
||||
int32_t GrowthType;
|
||||
int32_t CrewMember;
|
||||
|
@ -221,11 +220,6 @@ protected:
|
|||
bool LoadActMap(C4Group &hGroup);
|
||||
void CrossMapActMap();
|
||||
public:
|
||||
// return def components - may be overloaded by script callback
|
||||
int32_t GetComponentCount(C4ID idComponent);
|
||||
C4ID GetIndexedComponent(int32_t idx);
|
||||
void GetComponents(C4IDList *pOutList, C4Object *pObjInstance=NULL);
|
||||
|
||||
void IncludeDefinition(C4Def *pIncludeDef); // inherit components from other definition
|
||||
void ResetIncludeDependencies(); // resets all pointers into foreign definitions caused by include chains
|
||||
|
||||
|
|
|
@ -204,7 +204,6 @@ void C4Object::Default()
|
|||
Shape.Default();
|
||||
fOwnVertices=0;
|
||||
Contents.Default();
|
||||
Component.Default();
|
||||
SolidMask.Default();
|
||||
PictureRect.Default();
|
||||
Def=NULL;
|
||||
|
@ -285,10 +284,6 @@ bool C4Object::Init(C4PropList *pDef, C4Object *pCreator,
|
|||
if (Alive) Energy=GetPropertyInt(P_MaxEnergy);
|
||||
Breath=GetPropertyInt(P_MaxBreath);
|
||||
|
||||
// Components
|
||||
Component=Def->Component;
|
||||
ComponentConCutoff();
|
||||
|
||||
// Color
|
||||
if (Def->ColorByOwner)
|
||||
{
|
||||
|
@ -729,24 +724,6 @@ void C4Object::UpdateMass()
|
|||
}
|
||||
}
|
||||
|
||||
void C4Object::ComponentConCutoff()
|
||||
{
|
||||
// this is not ideal, since it does not know about custom builder components
|
||||
int32_t cnt;
|
||||
for (cnt=0; Component.GetID(cnt); cnt++)
|
||||
Component.SetCount(cnt,
|
||||
std::min(Component.GetCount(cnt),Def->Component.GetCount(cnt)*Con/FullCon));
|
||||
}
|
||||
|
||||
void C4Object::ComponentConGain()
|
||||
{
|
||||
// this is not ideal, since it does not know about custom builder components
|
||||
int32_t cnt;
|
||||
for (cnt=0; Component.GetID(cnt); cnt++)
|
||||
Component.SetCount(cnt,
|
||||
std::max(Component.GetCount(cnt),Def->Component.GetCount(cnt)*Con/FullCon));
|
||||
}
|
||||
|
||||
void C4Object::UpdateInMat()
|
||||
{
|
||||
// get new mat
|
||||
|
@ -1288,14 +1265,6 @@ void C4Object::DoCon(int32_t iChange, bool grow_from_center)
|
|||
// Face (except for the shape)
|
||||
UpdateFace(false);
|
||||
|
||||
// component update
|
||||
// Decay: reduce components
|
||||
if (iChange<0)
|
||||
ComponentConCutoff();
|
||||
// Growth: gain components
|
||||
else
|
||||
ComponentConGain();
|
||||
|
||||
// Unfullcon
|
||||
if (fWasFull && (Con<FullCon))
|
||||
{
|
||||
|
@ -2315,7 +2284,6 @@ void C4Object::CompileFunc(StdCompiler *pComp, C4ValueNumbers * numbers)
|
|||
pComp->Value(mkNamingAdapt( Contained, "Contained", C4ObjectPtr::Null ));
|
||||
pComp->Value(mkNamingAdapt( Action.Target, "ActionTarget1", C4ObjectPtr::Null ));
|
||||
pComp->Value(mkNamingAdapt( Action.Target2, "ActionTarget2", C4ObjectPtr::Null ));
|
||||
pComp->Value(mkNamingAdapt( Component, "Component", Def->Component ));
|
||||
pComp->Value(mkNamingAdapt( mkParAdapt(Contents, numbers), "Contents" ));
|
||||
pComp->Value(mkNamingAdapt( lightRange, "LightRange", 0 ));
|
||||
pComp->Value(mkNamingAdapt( lightFadeoutRange, "LightFadeoutRange", 0 ));
|
||||
|
|
|
@ -166,7 +166,6 @@ public:
|
|||
C4Shape Shape;
|
||||
bool fOwnVertices; // if set, vertices aren't restored from def but from end of own vtx list
|
||||
C4TargetRect SolidMask;
|
||||
C4IDList Component;
|
||||
C4Rect PictureRect;
|
||||
C4NotifyingObjectList Contents;
|
||||
C4MaterialList *MaterialContents; // SyncClearance-NoSave //
|
||||
|
@ -255,8 +254,6 @@ public:
|
|||
void UpdatePos(); // pos/shape changed
|
||||
void UpdateSolidMask(bool fRestoreAttachedObjects);
|
||||
void UpdateMass();
|
||||
void ComponentConCutoff();
|
||||
void ComponentConGain();
|
||||
bool ChangeDef(C4ID idNew);
|
||||
void UpdateFace(bool bUpdateShape, bool fTemp=false);
|
||||
void UpdateGraphics(bool fGraphicsChanged, bool fTemp=false); // recreates solidmasks (if fGraphicsChanged), validates Color
|
||||
|
|
|
@ -1248,11 +1248,6 @@ static bool FnGrabObjectInfo(C4Object *Obj, C4Object *pFrom)
|
|||
return !!Obj->GrabInfo(pFrom);
|
||||
}
|
||||
|
||||
static bool FnSetComponent(C4Object *Obj, C4ID idComponent, long iCount)
|
||||
{
|
||||
return Obj->Component.SetIDCount(idComponent,iCount,true);
|
||||
}
|
||||
|
||||
static bool FnSetCrewStatus(C4Object *Obj, long iPlr, bool fInCrew)
|
||||
{
|
||||
// validate player
|
||||
|
@ -2630,7 +2625,6 @@ void InitObjectFunctionMap(C4AulScriptEngine *pEngine)
|
|||
F(RemoveObject);
|
||||
F(GetActionTarget);
|
||||
F(SetActionTargets);
|
||||
F(SetComponent);
|
||||
::AddFunc(p, "SetCrewStatus", FnSetCrewStatus, false);
|
||||
F(SetPosition);
|
||||
F(CreateMenu);
|
||||
|
|
Loading…
Reference in New Issue