Opened 10 years ago

Last modified 10 years ago

#2517 closed enhancement

Register all component classes as global — at Version 7

Reported by: sanderd17 Owned by:
Priority: Should Have Milestone: Alpha 17
Component: Core engine Keywords: patch
Cc: Patch:

Description (last modified by sanderd17)

When someone makes a mod now, they have to copy the entire component over to their mod (which can be quite hard to maintain).

By registering all components as a global, mods can just extend functionality from the existing prototype in the public mod by doing that in a different file that's loaded afterwards (f.e. by creating an Attack.MyMod.js file to extend the Attack prototype defined in Attack.js).

There's a separate Engine function now to register variables as global (Engine.RegisterGlobal(name, var)), but it would be better to put this functionality inside the Engine.RegisterComponentType() method, so the actual JS components don't have to be modified.

As the schema gets saved to the Engine on RegisterComponentType, we should also allow to register the same component multiple times to allow schema overriding by mods (this might be less simple than the other part to get it right).

Change History (7)

comment:1 by Niek, 10 years ago

Didn't it work already?

comment:2 by sanderd17, 10 years ago

Apparently not

in reply to:  2 comment:3 by Niek, 10 years ago

Replying to sanderd17:

Apparently not

But I extended the Aristeia scripts like the way you described, and no errors are thrown...

comment:4 by Radagast, 10 years ago

That's strange. It didn't work for me. It rather was random. Did you test the healing priests/converter unit after your changes?

(that's the only unit that uses the Convert Attack. Which for me didn't work.)

in reply to:  4 comment:5 by Niek, 10 years ago

Replying to Radagast:

That's strange. It didn't work for me. It rather was random. Did you test the healing priests/converter unit after your changes?

(that's the only unit that uses the Convert Attack. Which for me didn't work.)

No, I did only test the cheat.

comment:6 by sanderd17, 10 years ago

The cheat isn't a component.

comment:7 by sanderd17, 10 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.