Opened 6 years ago

Closed 4 years ago

#5129 closed defect (fixed)

Create a CPP Interface for cmp Attack

Reported by: Stan Owned by: Stan
Priority: Should Have Milestone: Alpha 24
Component: Simulation Keywords:
Cc: Patch: Phab:D2464

Description

Currently there is some hacky atlas code to get some variables in Javascript mostly using evals. It would be better to define the component interface in c++ instead so that if changes were to be made to that function it would not break.

    CStr code = "var cmp = Engine.QueryInterface("+CStr::FromUInt(m.Entity)+", IID_Attack); " +
    "if (cmp) cmp.GetTimers(cmp.GetBestAttack()).repeat; else 0;";
        m.Simulation2.GetScriptInterface().Eval(code.c_str(), repeattime);

Change History (4)

comment:1 by elexis, 4 years ago

Component: Atlas editorSimulation
Keywords: simple removed
Patch: Phab:D2464

comment:2 by Stan, 4 years ago

Milestone: BacklogAlpha 24

comment:3 by Stan, 4 years ago

Owner: set to Stan

comment:4 by Stan, 4 years ago

Resolution: fixed
Status: newclosed

In 23592:

Add a C++ interface for CCmpAttack.
This allows Atlas not to rely on eval() to get access to the attack component.
Add a quick test for the added method.
This fixes the animation speed matching that of the actor instead of the template.
Remove some dead code after rP21359
Fixes: #5129
Reviewed by: @Angen
Comments by: @elexis

Differential Revision: https://code.wildfiregames.com/D2464

Note: See TracTickets for help on using tickets.