OgarII icon indicating copy to clipboard operation
OgarII copied to clipboard

plugins [high priority]

Open SuperOP535 opened this issue 6 years ago • 6 comments

(I recommend you to fs.readdir a folder to get all .js files, then require them (they should export a class)|provide a function for adding plugin classes), in this class there will be a constructor defining this.info (or super()) like plugin name, version, author, api version etc. and in the class they'll define specified function like onPacketRecieve(player, packet) { code.. }, your system will check if this function exists in the plugins class (so that people will not have to define every single function) then call it like class.onPacketRecieve(player, packet);

A plugin system would be nice, here are some..

Suggested events/functions:

  • [ ] onPacketRecieve(player, packet)
  • [ ] onPlayerSplit(player, oldCellAmount, newCellAmount)
  • [ ] onPlayerChat(player, message)
  • [ ] onPlayerJoin(player, ip)
  • [ ] onPlayerLeave(player, ip)
  • [ ] onPlayerSpawn(player)
  • [ ] onPlayerDie(player)
  • [ ] onPlayerEjectMass(player, ejectedCell)
  • [ ] onMothercellEjectMass(mothercell, ejectedCell)
  • [ ] onVirusSplit(mainVirus, newVirus)
  • [ ] something.setOption(option: for example merge delay, speed, mass etc.)
  • [ ] something.getOption(option: ^)
  • [ ] something.getInfo(info: ip, id, size, mass, color, cells etc.)
  • [ ] something.setInfo(info: ^)
  • [ ] something.remove() // kill a player, remove a cell/virus
  • [ ] player.split()
  • [ ] player.merge()
  • [ ] player.connection // websocket client
  • [ ] player.request // websocket upgrade request

access for writer.js and reader.js should be given

SuperOP535 avatar May 15 '18 06:05 SuperOP535

Already a thing, it’s called a Mode. Modes don’t support all of the above events, but it’s relatively easy to add them.

retroscepter avatar Jun 09 '18 12:06 retroscepter

plugins [high priority]

Niall7459 avatar Dec 29 '18 13:12 Niall7459

[high priority]

Niall7459 avatar Feb 21 '19 18:02 Niall7459

[high priority]

TheMKDev avatar Apr 25 '19 07:04 TheMKDev

[high priority]

Niall7459 avatar Apr 25 '19 17:04 Niall7459

1 year soon:tm:

SuperOP535 avatar May 07 '19 19:05 SuperOP535