Jump to content

Plugins without parts?


Recommended Posts

Is it possible to make a plugin without an associated part? I want a plugin that does stuff on every game update, without requiring players to attach a part to their ship. However, it seems like you can't even load your plugin without a module = ... in a part. Is there a way?

Link to comment
Share on other sites

  • 3 weeks later...

a scenario module, now that they are an option, can be used in two ways (or so i gather) --

- if placed on a scenario plugins folder, then it'll be active for that particular scenario only - this allows you to devise non-trivial events and challenges (asteroid impact stoppage mission, for example)

- if placed on the root plugins folder, then it'll affect the game as a whole, being used on sandbox/career persistent saves

neither of which require adding a part, so that's the answer to that problem :wink:

cheers!

Link to comment
Share on other sites

Scenario Modules, just like PartModules, are compiled into dlls that go in the Plugins folder. In fact, nothing stops you from having ScenarioModules sharing dlls with PartModules. The dlls in Plugins simply add their classes to the game assembly.

Once added, a ScenarioModule is loaded into the game through SFS files. In very much the same way you set up a PartModule in a part.cfg, you set up a ScenarioModule in an .sfs file:


GAME
{
version = 0.17.0
Title = Orbiting 101
Description = This training scenario covers the basics of flying a blablabla....
// mode 0: Sandbox - mode 1: Career (not available yet), mode 2: Scenario, mode 3: Non-Resumable Scenario
Mode = 3
// scene to load when starting this save.
scene = 7
PARAMETERS
{
// flight parameter stuff
}
FLIGHTSTATE
{
// flight state data (in 0.16 this was your entire sfs file)
}
SCENARIO
{
// the name of the ScenarioModule class to spawn
name = TutorialOrbit101
// the scene in which the module gets spawned (7 = flight)
scene = 7
}
}

The only limitation at the moment is that to add a scenario module to your ongoing sandbox game, you'll need to manually add the module config to your persistent.sfs. Once added, it gets loaded into the persistence data structure and will remain in your sfs file even as it gets resaved and rewritten.

ScenarioModules have one main difference from PartModules though. Because they are made to run on any scene, you must specify a target scene in which your module will run. Currently, modules can only run on one scene at a time. When a scene starts, the scenario module runner attaches all ScenarioModules that target that scene as a MonoBehaviour on an empty game object in the scene. You can use all MonoBehaviour events (except Awake), and code it in very much the same way you code part modules... Of course, there is no reference to vessel or part, since the module isn't attached to one.

Hope this helps.

Cheers

Link to comment
Share on other sites

Could these modules be used to generate things like random part break downs and add the ability to repair them in an EVA to all missions?

Or problems caused by random solar flares.

Yeah, there is very little you can't do with modules. You would have to program all those systems that don't exist yourself though... Adding a random failure to a part should be relatively easy, but having EVAs be able to repair them is a bit trickier. Not impossible at all though.

Cheers

Link to comment
Share on other sites

i really believe scenario plugins found in the global folder should be automatically loaded for sandbox/career games - it's only a general inconvenience that they do not, stopping something very powerful from being far more accessible for no good reason

a "global" scenario module - which i would prefer to call "Sim Module" would allow users to plug in nature-driven effects like solar wind or radiation, and have the effects of such be felt by all vessels and their parts

one could also add custom planets, make adaptations of construction tools or UI to ones hearts content

reentry heating is a clear example of a plugin that could be made much more comprehensive by having this functionality -- just add a sim module, and you've added a new thing to the whole game!

it's too awesome to -not- do it

Link to comment
Share on other sites

that does imply it will not be a limitation in a time after the aforementioned "moment" :rolleyes:

i was just putting it out there, for clarity - if it were an actual request, i'd be posting it at the dev boards

cheers!

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...