Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equipment condition scripting #2

Open
JensAyton opened this issue Mar 13, 2011 · 3 comments
Open

Equipment condition scripting #2

JensAyton opened this issue Mar 13, 2011 · 3 comments

Comments

@JensAyton
Copy link
Member

Oolite 1.x supports legacy conditions for equipment. A JavaScript replacement is needed.

1.75 added equipment scripts in order to implement the primable equipment system. These equipment scripts have a ship property set before being run, so applying them directly to the problem would be inconvenient. I can see several options:

  • Change the semantics of equipment scripts so that they’re associated with an equipment type and the ship is passed as a parameter to activated().
  • Add a separate “equipment type script”.
  • Instantiate the equipment script once, with no ship property, and make that the “equipment type” script. When an equipment item is activated, create a new script object with the type script as its prototype and the ship property set. (I’m actually considering doing this for ship scripts as well; the downside is that scripts that do stuff on first run will need to be rewritten to use shipSpawned(), and the closure pattern won’t work.)
@JensAyton
Copy link
Member Author

See also: #5.

@JensAyton
Copy link
Member Author

Related idea: remove the various equipment type conditions (available_to_all, requires_non_full_fuel and all that jazz), and use scripts instead. For upgrading, code can be generated. (I should find my “new” JS code generator and check it in.)

@JensAyton JensAyton reopened this Mar 21, 2011
@JensAyton
Copy link
Member Author

For a while, I considered handling as many equipment effects as possible using scripts, but I’ve decided that’s a bad idea. Instead, the built-in effects (like adding ECM ability) should be flags on equipment, with internal counters of how many equipment items are applying each effect. That way, you can create one equipment item that’s just an ECM, and one that combines ECM with Advanced Nav Array or something, and adding/removing both will work properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant