Difference between revisions of "Modding"
(Tag: Visual edit) |
(Tag: Visual edit) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
=== Web === | === Web === | ||
Anyone is allowed to create modifications to prometheus code which they can share or even sell, as long as these requirements are met: | Anyone is allowed to create modifications to prometheus code which they can share or even sell, as long as these requirements are met: | ||
− | * The person sharing/selling the modification | + | * The person sharing/selling the modification must have purchased Prometheus. |
* Amount of files changed is the minimal possible(Only files that MUST be modified should be modified and shared, adding unnecessary stuff to a file only for it to be shareable is also violation of this requirement) | * Amount of files changed is the minimal possible(Only files that MUST be modified should be modified and shared, adding unnecessary stuff to a file only for it to be shareable is also violation of this requirement) | ||
* You must state on the modification page that it is a derivative work of Prometheus, and also link to Prometheus’ addon page | * You must state on the modification page that it is a derivative work of Prometheus, and also link to Prometheus’ addon page | ||
Line 28: | Line 28: | ||
You are allowed to include new files/folders of your own to any folder as long as they do not replace any of Prometheus files/folders. This includes /vendor, but only through the use of composer. | You are allowed to include new files/folders of your own to any folder as long as they do not replace any of Prometheus files/folders. This includes /vendor, but only through the use of composer. | ||
=== Lua === | === Lua === | ||
− | Usable hooks: | + | ==== Usable hooks: ==== |
+ | * PrometheusAddActions | ||
+ | ** Arguments: none | ||
+ | ** Add any custom actions inside this hook using Prometheus.AddAction function(Described lower) | ||
+ | * PrometheusDBConnected | ||
+ | ** Arguments: none | ||
+ | ** Ran when Prometheus has just connected to the database | ||
+ | * PrometheusDBInitialized | ||
+ | ** Arguments: none | ||
+ | ** Ran when Prometheus has fully connected to the database and has run any initializing queries | ||
+ | * PrometheusInitialized | ||
+ | ** Arguments: none | ||
+ | ** Ran when Prometheus has fully loaded(All it’s functions/values have been created) | ||
+ | * PrometheusRunningAction | ||
+ | ** Arguments: | ||
+ | *** Table Table of players that this action will run on(Can contain SteamID strings or Player Objects) | ||
+ | *** String Name of the action | ||
+ | *** Table Table of values for that action | ||
+ | *** Table Table of action data(steam64 of person, active status, expire time, etc) | ||
+ | ** Ran when Prometheus is running an action(For any custom new actions, use PrometheusAddActions hook instead, this is for informational purposes) | ||
− | + | ==== Usable functions: ==== | |
+ | * Prometheus.AddAction | ||
+ | ** Arguments: | ||
+ | *** Table Table that contains these values: | ||
+ | **** name String Name of the action | ||
+ | **** runfunc Function Function that will run when the action is bought(Arguments are: Player object, Table of values for that action, Table of action data) | ||
+ | **** endfunc Function Functions that will run when the action has expired or deactivated(Arguments are: Player object, Table of values for that action, Table of action data) | ||
+ | ** Use this to create your own custom actions(Keep in mind you need to also mod web side to be able to save/buy that action). | ||
+ | ** Examples of actions can be found in actions.lua file. | ||
− | + | '''Preferably don't modify Prometheus Lua files.''' | |
− | + | Rather create your own separate add-on that uses the hooks/function overwrites to modify Prometheus Lua side, while not modifying files is almost impossible in PHP, in Lua it's pretty easy. | |
− | + | Pretty much anything you would need to do can be acquired by using the hooks, if that isn't enough, you can use function overwrites, example of tapping into a function called "testFunc": | |
− | + | local oldFunc = testFunc | |
− | + | testFunc = function(...) | |
− | + | args = {...} | |
− | + | -- Do anything here with the arguments, original function will still run by running the oldFunc(...) | |
− | + | oldFunc(...) | |
− | + | end | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| class="wikitable" !File / Folder | {| class="wikitable" !File / Folder | ||
|- | / inc functions.php |- cache * vendor cert lib mods |install.php |ipn.php |paymentwall.php |inc classes verification.class.php paymentwall.class.php stripe.class.php update.class.php cache.class.php mods.class.php |} | |- | / inc functions.php |- cache * vendor cert lib mods |install.php |ipn.php |paymentwall.php |inc classes verification.class.php paymentwall.class.php stripe.class.php update.class.php cache.class.php mods.class.php |} | ||
|} | |} |
Latest revision as of 20:25, 21 August 2017
Contents
Web
Anyone is allowed to create modifications to prometheus code which they can share or even sell, as long as these requirements are met:
- The person sharing/selling the modification must have purchased Prometheus.
- Amount of files changed is the minimal possible(Only files that MUST be modified should be modified and shared, adding unnecessary stuff to a file only for it to be shareable is also violation of this requirement)
- You must state on the modification page that it is a derivative work of Prometheus, and also link to Prometheus’ addon page
- You must also state that adding the modification to Prometheus will mean that any errors or problems involving stuff the modification changes will NOT be helped with by the Prometheus support team.
- Your modification must be freely accessible by the Prometheus support team(Can be done after requested by us)
- The modification can't contain Prometheus files from any of these files/folders: (you can put any class files in inc/classes and run them from any file loaded elsewhere, they autoload)
- /inc/functions.php
- /cache/*
- /vendor/*
- /cert/*
- /inc/lib/*
- /mods/*
- install.php
- ipn.php
- paymentwall.php
- inc/classes/verification.class.php
- inc/classes/paymentwall.class.php
- inc/classes/stripe.class.php
- inc/classes/update.class.php
- inc/classes/cache.class.php
- inc/classes/mods.class.php
- No modifications regarding license verification
- You need to inform the user that is downloading your modification of the files modified BEFORE they are required to pay(So they can check if any other modifications they already have, have modified a file yours has as well)
- The modification MUST include a modification info file located in “mods” folder, example of syntax can be found in examplemod.txt (Make the filename as unique as you can)
You are allowed to include new files/folders of your own to any folder as long as they do not replace any of Prometheus files/folders. This includes /vendor, but only through the use of composer.
Lua
Usable hooks:
- PrometheusAddActions
- Arguments: none
- Add any custom actions inside this hook using Prometheus.AddAction function(Described lower)
- PrometheusDBConnected
- Arguments: none
- Ran when Prometheus has just connected to the database
- PrometheusDBInitialized
- Arguments: none
- Ran when Prometheus has fully connected to the database and has run any initializing queries
- PrometheusInitialized
- Arguments: none
- Ran when Prometheus has fully loaded(All it’s functions/values have been created)
- PrometheusRunningAction
- Arguments:
- Table Table of players that this action will run on(Can contain SteamID strings or Player Objects)
- String Name of the action
- Table Table of values for that action
- Table Table of action data(steam64 of person, active status, expire time, etc)
- Ran when Prometheus is running an action(For any custom new actions, use PrometheusAddActions hook instead, this is for informational purposes)
- Arguments:
Usable functions:
- Prometheus.AddAction
- Arguments:
- Table Table that contains these values:
- name String Name of the action
- runfunc Function Function that will run when the action is bought(Arguments are: Player object, Table of values for that action, Table of action data)
- endfunc Function Functions that will run when the action has expired or deactivated(Arguments are: Player object, Table of values for that action, Table of action data)
- Table Table that contains these values:
- Use this to create your own custom actions(Keep in mind you need to also mod web side to be able to save/buy that action).
- Examples of actions can be found in actions.lua file.
- Arguments:
Preferably don't modify Prometheus Lua files.
Rather create your own separate add-on that uses the hooks/function overwrites to modify Prometheus Lua side, while not modifying files is almost impossible in PHP, in Lua it's pretty easy.
Pretty much anything you would need to do can be acquired by using the hooks, if that isn't enough, you can use function overwrites, example of tapping into a function called "testFunc":
local oldFunc = testFunc
testFunc = function(...)
args = {...}
-- Do anything here with the arguments, original function will still run by running the oldFunc(...)
oldFunc(...)
end