Skip to content

Commit

Permalink
Added .HasSpawn so that targeting is not required. (#6)
Browse files Browse the repository at this point in the history
Touched nothing else for fear of the apocalypse
  • Loading branch information
DerpleMQ2 committed Jan 6, 2024
1 parent baf99fa commit 0d23253
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion MQ2SpawnMaster.cpp
Expand Up @@ -531,7 +531,8 @@ class MQ2SpawnMasterType : public MQ2Type
DownList,
Version,
LastMatch,
HasTarget
HasTarget,
HasSpawn
};

MQ2SpawnMasterType():MQ2Type("SpawnMaster")
Expand All @@ -542,6 +543,7 @@ class MQ2SpawnMasterType : public MQ2Type
TypeMember(Version);
TypeMember(LastMatch);
TypeMember(HasTarget);
TypeMember(HasSpawn);
}

virtual bool GetMember(MQVarPtr VarPtr, const char* Member, char* Index, MQTypeVar& Dest) override
Expand Down Expand Up @@ -580,6 +582,30 @@ class MQ2SpawnMasterType : public MQ2Type
// FIXME: Don't really want to pass a sound here
Dest.Int=IsWatchedSpawn(pTarget, DataTypeTemp, DataTypeTemp.size());
return true;
case HasSpawn:
{
Dest.Type = mq::datatypes::pBoolType;
if (SpawnUpList.empty() || Index[0] == '\0')
return false;

PlayerClient* search_spawn = nullptr;
const int spawn_id = GetIntFromString(Index, 0);
if (spawn_id < 1)
{
search_spawn = GetSpawnByName(Index);
}
else
{
search_spawn = GetSpawnByID(spawn_id);
}

if (search_spawn == nullptr)
return false;
// FIXME: Also don't want to pass a sound here
Dest.Set(IsWatchedSpawn(search_spawn, DataTypeTemp, DataTypeTemp.size()));
return true;
}

}
return false;
}
Expand Down

0 comments on commit 0d23253

Please sign in to comment.