Vantha Posted September 3 Report Share Posted September 3 So, I want to add a new simulation component. There is no documentation about it, so I tried replicating the existing components' setups. Here is what I did: I put my script in simulation/components/. It calls Engine.RegisterComponentType() at the end. Additionally, I created a script of the same name inside simulation/components/interfaces/ running Engine.RegisterInterface(). From searching the codebase I found most components only do exactly that. For mine, however, Engine.QueryInterface(SYSTEM_ENTITY, <Name>) still returns undefined... Does anyone know why? What am I missing? Quote Link to comment Share on other sites More sharing options...
Stan` Posted September 3 Report Share Posted September 3 See https://docs.wildfiregames.com/pyrogenesis/writing-components.html https://gitea.wildfiregames.com/0ad/0ad/wiki/TDD_Simulation Did you add a component file and an interface file? Unless you reused one. Also your component should be in the template xml you're querying 2 Quote Link to comment Share on other sites More sharing options...
Vantha Posted September 3 Author Report Share Posted September 3 3 hours ago, Stan` said: See https://docs.wildfiregames.com/pyrogenesis/writing-components.html https://gitea.wildfiregames.com/0ad/0ad/wiki/TDD_Simulation Did you add a component file and an interface file? Unless you reused one. Also your component should be in the template xml you're querying Hmm, I still can't get it to work. I already added both the component and interface files. And I'm not querying a specific template, but the system entity (I want the code to be run globally). I believe I've correctly registered the component type and interface. Does the component maybe need to be instantiated somehow? (I've never worked with the simulation code before...) Quote Link to comment Share on other sites More sharing options...
Stan` Posted September 3 Report Share Posted September 3 Oh wait you're using SYSTEM_ENTITY? What does the schema look like? IIRC they have special schemas to tell the engine they are system https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/binaries/data/mods/public/simulation/components/CeasefireManager.js#L3 Although the a: prefix is for docs so not sure. 1 Quote Link to comment Share on other sites More sharing options...
Grapjas Posted September 3 Report Share Posted September 3 (edited) The last line in Stan's link is pretty important and different from a "normal" component type aswell so be sure to get that right. If that doesn't solve it, could you share your code on pastebin or something? Edited September 3 by Grapjas 1 Quote Link to comment Share on other sites More sharing options...
Vantha Posted September 3 Author Report Share Posted September 3 1 hour ago, Grapjas said: The last line in Stan's link is pretty important and different from a "normal" component type aswell so be sure to get that right. Yes, that fixed it! I didn't notice there was a different function specifically for registering system component types. Thanks for your help. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.