On the matter of singleton instances and constructors

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

On the matter of singleton instances and constructors

Post by JensAyton »

1.75 warns when you access properties on System or Player instead of system or player. However, these are not the only cases of this problem. The others are, in approximate order of obscurity:
  • Manifest: use player.ship.manifest (preferred), or manifest.
  • PlayerShip: use player.ship.
  • Mission: use mission.
  • Oolite: use oolite.
  • Clock: use clock.
  • MissionVariables: use missionVariables.
  • Global: use global, although in general you should just use foo instead of global.foo.
  • Console: use console.
There are some others, but you shouldn’t even know about them.

I could add warnings for some of these in 1.75.1, if they are known to be widespread problems, but I suspect the most-abused are the first two, and they have complications that make warnings impractical.
Post Reply