|
1 | | -IronPythonModule |
2 | | -================ |
| 1 | +Copy the files to the right place. |
| 2 | +Make sure you have: |
| 3 | +IronPythonModule=PyPlugins |
| 4 | +and not: |
| 5 | +;IronPythonModule=PyPlugins |
| 6 | +in Save\Fougerite.cfg |
3 | 7 |
|
4 | | -just publish |
| 8 | +There are two example plugins for tests. |
| 9 | + |
| 10 | +Server, DataStore, Util, World are working the same way as in other Magma/Jint plugins |
| 11 | + |
| 12 | +TimedEvent.ElapsedCount:int | how many time the timer ran |
| 13 | + |
| 14 | +Entities class from Mike (initial, it will change a lot, don't get used to it): |
| 15 | + - Entities.Structures:Lookup<string, StructureMaster> |
| 16 | + - Entities.Doors:Lookup<string, BasicDoor> |
| 17 | + - Entities.Respawns:Lookup<string, DeployedRespawn> |
| 18 | + - Entities.Sleepers:Lookup<string, SleepingAvatar> |
| 19 | + - Entities.Inventories:Lookup<string, SaveableInventory> |
| 20 | + - Entities.Boxes:Lookup<string, SaveableInventory> |
| 21 | + - Entities.Stashes:Lookup<string, SaveableInventory> |
| 22 | + - Entities.Fires:Lookup<string, FireBarrel> |
| 23 | + - Entities.Shelters:Lookup<string, DeployableObject> |
| 24 | + |
| 25 | +Plugin class: |
| 26 | + - Plugin.CreateDir(string path):bool |
| 27 | + |
| 28 | + - Plugin.DumpObjToFile(string path, object obj, (optional)string prefix):bool |
| 29 | + - Plugin.DumpObjToFile(string path, object obj, int depth, (optional)string prefix):bool |
| 30 | + - Plugin.DumpObjToFile(string path, object obj, int depth, int maxItems, (optional)string prefix):bool |
| 31 | + - Plugin.DumpObjToFile(string path, object obj, int depth, int maxItems, bool displayPrivate, (optional)string prefix):bool |
| 32 | + - Plugin.DumpObjToFile(string path, object obj, int depth, int maxItems, bool displayPrivate, bool useFullClassname, (optional)string prefix):bool |
| 33 | + |
| 34 | + - Plugin.DeleteLog(string path):void |
| 35 | + - Plugin.Log(string path, string text):void |
| 36 | + - Plugin.RotateLog(string logfile, (optional)int max = 6):void |
| 37 | + |
| 38 | + - Plugin.GetIni(string path):IniParser |
| 39 | + - Plugin.IniExists(string path):bool |
| 40 | + - Plugin.CreateIni(string path):IniParser |
| 41 | + - Plugin.GetInis(string path):List<IniParser> |
| 42 | + |
| 43 | + - Plugin.GetPlugin(string name):IPPlugin |
| 44 | + |
| 45 | + - Plugin.GetDate():string |
| 46 | + - Plugin.GetTicks():int |
| 47 | + - Plugin.GetTime():string |
| 48 | + - Plugin.GetTimeStamp():long |
| 49 | + |
| 50 | + - Plugin.CreateTimer(string name, int timoutInMilis):IPTimedEvent |
| 51 | + - Plugin.CreateTimer(string name, int timoutInMilis, Dictionary<string, object> args):IPTimedEvent | yeah, I changed paramslist for dictionary |
| 52 | + - Plugin.GetTimer(string name):IPTimedEvent |
| 53 | + - Plugin.KillTimer(string name):void |
| 54 | + - Plugin.KillTimers():void |
| 55 | + |
| 56 | +ExtraHooks: |
| 57 | + - On_EntityDestroyed(DestroyEvent de):void |
| 58 | + - On_AllPluginsLoaded():void |
| 59 | + # note: On_EntityHurt isn't hooked, when it's caused by decay or if the entity was destroyed |
| 60 | + |
| 61 | +DestroyEvent: |
| 62 | + - DestroyEvent.Destroyer:Fougerite.Player |
| 63 | + - DestroyEvent.DamageAmount:float |
| 64 | + - DestroyEvent.DamageEvent:DamageEvent |
| 65 | + - DestroyEvent.DamageType:string |
| 66 | + - DestroyEvent.Entity:Fougerite.Entity |
| 67 | + - DestroyEvent.IsDecay:bool |
| 68 | + - DestroyEvent.WeaponData:WeaponImpact |
| 69 | + - DestroyEvent.WeaponName:string |
| 70 | + |
| 71 | +- DumpObjToFile |
| 72 | +"(optional)" values have a default value, you can skip those. For example: |
| 73 | +Plugin.DumpObjToFile("Players", Player, "") |
| 74 | +Plugin.DumpObjToFile("Players", Player) |
| 75 | +^ these are the same. |
| 76 | +Use this only for debugging. |
| 77 | + |
| 78 | +- GetPlugin |
| 79 | +Use this to call other plugin's function like: |
| 80 | +# myPlugin.py |
| 81 | +class myPlugin: |
| 82 | + def myFunctionCallsAnother(self): |
| 83 | + otherPlugin = Plugin.GetPlugin("OtherPluginName") |
| 84 | + if(otherPlugin != null) |
| 85 | + otherPlugin.Invoke("otherPluginFunctionToInvoke", param1, param2) |
| 86 | + |
| 87 | +# OtherPluginName.py |
| 88 | +class OtherPluginName: |
| 89 | + def otherPluginFunctionToInvoke(self, param1, param2): |
| 90 | + doStuff() |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +to access UnityEngine.dll start your script with: |
| 95 | +import clr |
| 96 | +clr.AddReferenceByPartialName("UnityEngine") |
| 97 | +import UnityEngine |
| 98 | + |
| 99 | +class PluginName: |
| 100 | + def On_PluginInit(self): |
| 101 | + UnityEngine.Debug.Log("Hello world!") |
0 commit comments