Containers, Chests, etc.

From The DarkMod Wiki
Jump to: navigation, search

written by Fidcal

Introduction

Dark Mod containers are not mere symbolic models but actually contain items which can be removed and replaced. They can be large chests or small cashboxes. This article describes the recommended method of getting containers into your FM.


Prefabs

This is the easiest way to get a working container into your FM. Prefabs have been created for each basic type of container so just insert the one you want.

By default each is pickable by a single pick and the key is inside so just delete the lock_picktype property if you only want it openable with the key or delete the key if you only want it pickable. Obviously adjust and modify them how you like.

Only minor difficulty is if you want to turn them then check carefully. I think the model ones are OK but check the tiny lockbar next to the lock. Might need to change its rotate property. The lid I think is OK. Not so on the cashbox brushes so adjust.


Making your own

You can make up your own container from brushes. Make the lid a atdm:mover_door entity and the body a atdm:froblock entity. With this method the container lid and body highlight as one unit and the player can use the key/lockpick anywhere they are focused.

Don't lock the lid itself or add any lockpick properties. All the lock properties go on the froblock container body (not the lid)

Don't add "frob_peer" on either lid or body to sync highlights, as it caused problems.

"lock_picktype" "t"

"lock_pins" "1"

"locked" "1"

"used_by" "JewelleryboxKey_1"

Ignore those on the lid, they probably will show defaults eg, "locked" "0" but ignore it.

The froblock body also must target the lid and frob_peer to it so it highlights.

The lid (door entity) needs these as in this example:

"frob_master" "JewelleryBoxBody_1" [this passes everything over to the froblock body to handle]


In addition, the above prefabs all have a atdm:target_set_frobable clip brush inside to disable frobbing of loot out of a locked chest. Strictly speaking the body and lid block this anyway but it has been known at certain angles and situations depending on the item size and position to accidentally frob an item out of a closed container. So I play it safe and include the atdm:target_set_frobable. Just drag out a brush to almost fill the interior, give it clip texture and right click in ortho grid view for menu and select 'create entity' and choose: atdm:target_set_frobable entity. This disables frob again if the player puts something into the box too. If using this method you also need to add to BOTH body and lid:

"immune_to_target_setfrobable" "1"

Otherwise, the chest becomes unfrobbable.

The atdm:target_set_frobable is controlled from the LID not the body by adding:

"trigger_on_close" "1" [so it also triggers it when you shut the lid] "target" "JewelleryboxFrobControl_1" [name of atdm:target_set_frobable clip brush.

Optionally add a lockbar to indicate lockpicking progress. Best on big chests but not practical on a tiny cashbox. There is a tiny model or you can make a tiny brush one. Give it atdm:mover_lock_handle entity. IMPORTANT: then give it "immune_to_target_setfrobable" "1" and bind it to the froblock body. It should automatically work but you may need to adjust its position and rotation (see rotate property.) If clipping problems then give it solid 0 as well.

If you already have containers working in your FMs and are happy with them and betamappers are not complaining then probably just leave them as is, but for the future I'd recommend the above as the default method.

If you want to keep players from being able to frob items out of a container from the back when the door is open, you can draw a thin brush, texture it with no_draw_wood (or whatever the correct material is), turn it into a func_static and give it the property "frobable" "1". This entity will then catch the frob trace before it hits anything inside the container. It is invisible, but must be a solid material, so if you make it too thick it will block the player.