Skip to content
This repository was archived by the owner on Jul 21, 2020. It is now read-only.

CSP Definition File

damagefilter edited this page Nov 20, 2016 · 2 revisions

Creating CSP objects can be cumbersome. Which is why there is an option that allows you to quickly create new GameObjects with everything attached to them that you need for working a CSP. Entries will appear in the context menu of the hierarchy panel and the GameObject top-menu under a new point "CSP".

The FGD File

FGD - you might know that file extension from source engine. This here is really nothing like it. It is named that way because the CSP is heavily based on what Hammer and the Source Engine does with the I/O system.

The contents of this file is actually a (possibly) large list of json objects describing the components required to make a CSP object.

This is how an entry might look like:

{
    Category: "Trigger",
    NameInMenu: "FuncTrigger",
    TypeName: "Assets.Source.Logic.FuncTrigger",
    DependentComponents: [
        "BoxCollider2D"
    ]
    
}

Category

This is meta data. A category. You can put slashes in between words to create groups in the context menu. You can use it if you have a lot of these setups to keep things clean.

NameInMenu

This is the name to display in the context menu and how the newly generated GameObject will be named. It can be anything you like.

TypeName

The FQ class name of the base CSP object you want to add to the GameObject.

DependentComponents

A list of components that are required to run the base CSP class. For instance it can be a specific Collider for trigger CSPs (which would most probably require a collider of some description). This array is optional.

You can also use this to add more CSP objects if you want.

Here's a short example for adding multiple of these descriptions to the fgd file:

[
    {
        Category: "Env",
        NameInMenu: "EnvMessage",
        TypeName: "Assets.Source.Logic.EnvMessage"
    },
    {
        Category: "Env",
        NameInMenu: "EnvLight",
        TypeName: "Assets.Source.Logic.EnvLight"
    },
    {
        Category: "Trigger",
        NameInMenu: "FuncTrigger",
        TypeName: "Assets.Source.Logic.FuncTrigger",
        DependentComponents: [
            "BoxCollider2D"
        ]
        
    },
    {
        Category: "Trigger",
        NameInMenu: "FuncTeleport",
        TypeName: "Assets.Source.Logic.FuncTeleport"	
    }
]

You must save this file to Assets/Playblack/csp_definitions.fgd. After that you can use the main menu entry "Playblack/CSP/Generate CSP Context Menu".

Et voila.

If you wish to make changes to the context menu, adjust the FGD as required and use the menu point again.

Clone this wiki locally