Translations:Modding:World Access/8/en

From Vintage Story Wiki
Revision as of 08:02, 9 November 2022 by FuzzyBot (talk | contribs) (Importing a new version from external source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

With this you can already start placing or reading blocks using the api object. Please note that mods are loaded before the world is loaded, so you cannot immediately access the world. Depending on what you want to achieve, you have to register to the appropriate event. For some examples in order to do something...

  • after the world has loaded you could register to the RunGame phase: api.Event.ServerRunPhase(EnumServerRunPhase.RunGame, OnRunGame);
  • during world generation we'd have to register to the appropriate world gen events.
  • when the player runs a custom command we need to register one: api.RegisterCommand("test", "a test command", "", OnCommand);
  • when a player joins the game: api.Event.PlayerJoin += OnPlayerJoin;