Skip to content

Commit

Permalink
Scripting: Added World.Thing.tracer()
Browse files Browse the repository at this point in the history
IssueID #2375
  • Loading branch information
skyjake committed Dec 6, 2020
1 parent 417f697 commit 9ef43a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Expand Up @@ -11,7 +11,7 @@ def Defs.getThingNum(thingId)
end

def World.listThings(thingId)
return World.findThings(typeIndex=Defs.getThingNum(thingId))
return World.findThings(typeIndex = Defs.getThingNum(thingId))
end

def World.Thing.info()
Expand Down
13 changes: 12 additions & 1 deletion doomsday/apps/plugins/common/src/common.cpp
Expand Up @@ -225,6 +225,16 @@ static de::Value *Function_Thing_Target(de::Context &ctx, const de::Function::Ar
return nullptr;
}

static de::Value *Function_Thing_Tracer(de::Context &ctx, const de::Function::ArgumentValues &)
{
auto &mo = P_ContextMobj(ctx);
if (mo.tracer)
{
return new de::RecordValue(THINKER_DATA(mo.tracer->thinker, ThinkerData).objectNamespace());
}
return nullptr;
}

static int playerNumberArgument(const de::Value &arg)
{
if (de::is<de::NoneValue>(arg))
Expand Down Expand Up @@ -466,7 +476,8 @@ void Common_Load()
"spawnMissile",
"id" << "angle" << "momz",
spawnMissileArgs)
<< DE_FUNC_NOARG(Thing_Target, "target");
<< DE_FUNC_NOARG(Thing_Target, "target")
<< DE_FUNC_NOARG(Thing_Tracer, "tracer");

#if defined (HAVE_SEEKER_MISSILE)
*gameBindings << DE_FUNC(Thing_SeekerMissile, "seekerMissile", "thresh" << "turnMax");
Expand Down

0 comments on commit 9ef43a7

Please sign in to comment.