Opened 3 years ago

Closed 3 years ago

#5985 closed defect (fixed)

Improve mirage internals.

Reported by: Freagarach Owned by: Freagarach
Priority: Should Have Milestone: Alpha 25
Component: Simulation Keywords:
Cc: Patch:

Description (last modified by Freagarach)

Currently, mirages implement the functions they mirage "bare metal", i.e. cmpMirage.GetCurrentAmount() returns the saved amount of resources for the miraged entity. That will give problems when multiple components implement the same function name.

The calling function QueryMiragedInterface in the Player.js-helper, could just as well return an object belonging to the miraged component.

So:

  • Save the functions and values in an object, per component, in Mirage.js.
  • Change the function call to return the object instead of calling functions on cmpMirage.

While at it, I suggest more stuff:

  • Don't initialise null values (refs #5979).
  • Make the components responsible for what needs to be miraged?

Change History (4)

comment:1 by Freagarach, 3 years ago

Description: modified (diff)

In 25068:

Clean mirage internals.

Use a map that stores the functions instead of them being part of the Mirage component.
Means that a lot doesn't need to be inited now (refs. #5979).

Ticket: #5985
Differential revision: D3694
Comments by: @wraitii

comment:2 by Freagarach, 3 years ago

In 25076:

Revert cleaning the mirage internals.

Broke serialisation.
Reverts rP25068. (r25068)

Refs. #5985
Differential revision: D3701

comment:3 by Freagarach, 3 years ago

In 25079:

Clean mirage internals.

Redo r25068 / rP25068. Now! with not broken serialisation :D

Use a map that stores the functions, instead of them being part of the Mirage component.
Doesn't need to initialise the variables anymore (refs. #5979).

Saves the mirages in a global to allow (de)serialisation.
Only assign values on Init, not on Construction (to allow deserialisation).

Refs: #5985
Differential revision: D3702
Comments by: @wraitii

comment:4 by Freagarach, 3 years ago

Owner: set to Freagarach
Resolution: fixed
Status: newclosed

In 25089:

Move Mirage information to respective components.

Moves the functions that define the properties/functions to mirage to their respective components, making it easier for modders to know their existence and to modify.

Closes: #5985
Differential revision: D3695
Comments by: @wraitii

Note: See TracTickets for help on using tickets.