func_conveyor: Add Save/Restore methods for save-games.

This commit is contained in:
Marco Cawthorne 2021-12-29 15:54:51 -08:00
parent 6ca3900b4d
commit 3ca728e1d0
Signed by: eukara
GPG key ID: C196CD8BA993248A

View file

@ -36,6 +36,8 @@ class func_conveyor:NSRenderableEntity
void(void) func_conveyor;
virtual void(float) Save;
virtual void(string,string) Restore;
virtual void(void) Respawn;
virtual void(entity, int) Trigger;
virtual void(void) touch;
@ -43,6 +45,29 @@ class func_conveyor:NSRenderableEntity
virtual void(entity, string, string) Input;
};
void
func_conveyor::Save(float handle)
{
SaveFloat(handle, "m_flSpeed", m_flSpeed);
SaveVector(handle, "m_vecMoveDir", m_vecMoveDir);
super::Save(handle);
}
void
func_conveyor::Restore(string strKey, string strValue)
{
switch (strKey) {
case "m_flSpeed":
m_flSpeed = ReadFloat(strValue);
break;
case "m_vecMoveDir":
m_vecMoveDir = ReadVector(strValue);
break;
default:
super::Restore(strKey, strValue);
}
}
void
func_conveyor::SetMovementDirection(void)
{
@ -79,7 +104,7 @@ func_conveyor::Respawn(void)
SetMovementDirection();
SetModel(GetSpawnModel());
SetMovetype(MOVETYPE_NONE);
SetSolid(SOLID_BSPTRIGGER);
SetSolid(SOLID_BSP);
/* TODO: Apply some effect flag the engine handles? */
if (!(spawnflags & SF_CONVEYOR_VISUAL)) {