Jump to content

Alberyk’s guide on contained sprites and custom items [WIP]


Recommended Posts

Alberyk’s guide on contained sprites and custom items:


What even are contained sprites?

They are a solution to the fact that dmi files have a limit on the amount of sprites you can store in them, this was coded by Sound Scopes in old code, ported by me to new code, and improved greatly by Nanako. Instead of the code looking for the icon and the icons of the mob wearing/holding in their respective places, they will get them in the same file. So, with contained sprites, everything will be a single file and you won’t fill the suits.dmi with thousands of different snowflake jackets. And they will help a lot with merge conflict related to the github, since those are god-damn awful to deal with.


How I enable/add those in an item?

There is a var for contained sprites (contained_sprite), which when enabled, will look for all related sprites in the dmi file you set the icons to be. Example:

 

 
/obj/item/clothing/suit/unathi/mantle/fluff/yinzr_mantle  //Heirloom Unathi Mantle - Sslazhir Yinzr - alberyk - DONE
name = "heirloom unathi mantle"
desc = "A withered mantle sewn from threshbeast's hides, the pauldrons that holds it on the shoulders seems to be the remains of some kind of old armor."
icon = 'icons/obj/custom_items/yinzr_mantle.dmi'
icon_state = "yinzr_mantle" //special thanks to Araskael
item_state = "yinzr_mantle"
species_restricted = list("Unathi") //forged for lizardmen
contained_sprite = 1

 

You must set the icon to the path of the dmi file where all the related sprites are located at. Then the icon_state and item_state to their related names and etc.


Now due to Nanako's update, you just add a suffix to the end of the sprite of the mob wearing it;


List of them atm:

 

Left hand: "_lh"

Right hand: "_rh"

Left pocket:"_ls"

Right pocket: "_rs"

Suit storage: "_ss"

Left ear: "_le"

Right ear"_re"

Head"_he"

Uniform(also applies for accessories): "_un"

Suit: "_su"

Gloves: "_gl"

Shoes: "_sh"

Eyes: "_ey"

Belt: "_be"

Back:"_ba"

Id: "_id"

Mask: "_ma"

 

Example:

 

C9HF4Cz.png

 

Nanako also added one var, short_name, that enables species related sprites:


List of them atm:

 

Human: "_hum"

Unathi: "_una"

Tajara: "_taj"

Skrell: "_skr"

Diona: "_dio"

Machine: "_ipc"

Vaurca: "_vau"

Vox: "_vox"

Monkey: "_mon"

Farwa: "_far"

Neaera: "_nea"

Stok: "_stok"

 

How I code/add a custom item?

If you are ever doing custom items, those are not really hard to deal with. They all go into the item_defines.dm. Also, it is always a good idea to generalize things if ever possible, like the custom implants and etc. Anyway, since we decided to go against bay’s original idea; “everything is a resprite”, coders are free to carry on with whatever snowflake code they want for custom items. Look into item_spawning.dmi if you want to know more how they spawn and the like.


How I into config?

The config, custom_items.txt, is something that probably the head-dev, head mins or anyone with box-access will set up. But, it also a tool that you can add job restrictions and extra information into the custom items, so, learn about it.

{
ckey: (the item owner’s ckey, everything must be in lowercase and without underlines, spaces and the like)
character_name: (the character’s name, must be exactly like it is in game)
item_path: (item path, those are in the item_defines.dm or anywhere else the item is)
item_name: (if you are just using another item and have to change the name, this will replace the original name when the item spawns)
item_desc: ( this will replace the original item description when the item spawns)
req_titles: (adding jobs to this will restrict the character from spawning with those items outside of those jobs)
req_access: (this one will check if the character has the access related to the re_titles, I don’t think this will be used as much)
additional_data: (this may be used for whatever information you may need, it is used atm for implants and mech paint kits which I will explain ahead)
}

 

Some snowflake cases you must pay attention and take some different steps, if you don’t it will end with everything being horribly broken:


Mechas paint kits:

You just set those using the config, but you must store the mecha icons in the icons/obj/custom_items_obj.dmi.

Now, do the following in the config, because you don’t really need to set those using code and they can be done via the config:

 	{
ckey: (the item owner’s ckey, everything must be in lowercase and without underlines, spaces and the like)
character_name: (The character’s name, must be exactly like it is in game)
item_path: /obj/item/device/kit/paint (leave this like this or not if you are doing something more snowflake)
item_name: (set the kit’s name here, NOT THE MECHA NEW NAME)
item_desc: (set the kit’s description here, NOT THE MECHA NEW DESCRIPTION)
kit_name: (set the new mecha name here, example: ROCKFUCKER 9000)
kit_desc: (set the new mecha descroption here, example: It is a dank ripley painted with the blood of baldies)
kit_icon: (set the icon’s state here, the one you put in icons/obj/custom_items_obj.dmi.)
additional_data: (what kind of mechas you can use this kit, example: ripley, firefighter)
 }

 

Mod kits for voidsuits:

Now, if someone comes up with this awful snowflake idea and you must code it, do the following: place the icons in the icons/obj/custom_items_obj.dmi., then you place the sprites of the mob wearing the suit in the following dmi: icons/mob/ custom_items_mob.dmi.

The helmet must have: “_helmet” in the end of the sprite’s state.

The suit must have: “_suit” in the end of the sprite’s state.

Now, go set the item via config, because you don’t really need to set those using code and they can be done via the config:

	{
ckey: (the item owner’s ckey, everything must be in lowercase and without underlines, spaces and the like)
character_name: (The character’s name, must be exactly like it is in game)
item_path: /obj/item/device/kit/suit (leave this like this)
item_name: (set the kit’s name here, NOT THE VOIDSUIT NEW NAME)
item_desc: (set the kit’s description here, NOT THE VOIDSUIT NEW DESCRIPTION)
kit_name: (set the new voidsuit name here, example: Amaranth colored medical suit or something)
kit_desc: (set the new voidsuit descroption here, example: It is amaranth colored voidsuit, smells of powergaming)
kit_icon: (set the icon’s state here, the one you put in icons/obj/custom_items_obj.dmi. and icons/mob/ custom_items_mob.dmi.)
}

 

Custom implants:


If someone wanted a custom implant of their own, you can also set those up using the config. They will spawn with a special injector that can only inject their ckey and has their implant inside.

 

	{
ckey: (The item owner’s ckey, everything must be in lowercase and without underlines, spaces and the like)
character_name: (The character’s name, must be exactly like it is in game)
item_path: /obj/item/weapon/implanter/fluff (leave this like this)
additional_data: (what implant you are using, example: /obj/item/weapon/implant/loyalty)
}

 

Custom AI’s core and borg’s sprites:

Throw everything into icons/mob/custom_synthetic.dmi.


However, for AI’s core, the sprite must have the following state model: ckey-ai (example: alberyk-ai)

For cyborg custom sprites, the sprite must have the following state model: ckey-Module (example: alberyk-Security.)

And for the borg’s eyes/light, the sprites must have the following state model: eyes-ckey-Module (example: eyes-alberyk-Security.)


Better example of how it should be done:

xxhyimu.png

 

Now, after adding the sprites, move to the config, customs_sprites.txt, and do the following:

ckey :BORGNAME/AINAME

So, if you have a borg named BUTT-TRON 300, the config addition should be like that.

 

alberyk :BUTT-TRON 300

Link to comment
×
×
  • Create New...