Skip to content

Commit

Permalink
Create slots.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinFunk committed Jul 24, 2015
1 parent 9d2dc81 commit bbb9045
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions developer/slots.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Addings slots to existing modules
---------------------------------

Sometimes you will want an extra accessory or other type of slot. Since it is not recommended to create slots directly within the files that define them, a way to create new slots is described here.

Using the customizing addon
===========================
It is recommended to extend Pointshop 2 using a seperate addon. Simply download this addon and extract it into your addons folder: <LINK>. Put your new slot code into ``pointshop2-customizing/lua/ps2/modules/pointshop2/sh_customslots.lua``

Adding accessory slots
======================

To add an accessory slot, use the function :lua:func:`Pointshop2.AddHatSlot`. This requires the Accessory/Hat module to be fully loaded, which is why the function should be called inside of the hook ``PS2_ModulesLoaded``.

Example:

.. highlight:: lua
.. code-block:: lua
-- Adds a new Accessory slot
hook.Add( "PS2_ModulesLoaded", "AddCustomSlots", function( )
Pointshop2.AddHatSlot( "Accessory 3" )
end )
Adding other slot types
=======================
Other slot types usually do not have convenience functions like the Accessory type. It is still possible to add these slots by duplicating the code. The slot code is defined in the file ``sh_slots.lua`` which can be found in the module's main folder.

It is also possible to define entirely custom slot types (for example VIP slots, universal slots, etc.) using :lua:func:`Pointshop2.AddEquipmentSlot`

0 comments on commit bbb9045

Please sign in to comment.