Difference between revisions of "OBJf"
MogHughson (Talk | contribs) (→Introduction) |
|||
Line 125: | Line 125: | ||
Called when Design mode updates an object, so we can set the correct state on it. | Called when Design mode updates an object, so we can set the correct state on it. | ||
− | [[Category:Modding]] | + | [[Category:Sims 2 Modding]] |
[[Category:InternalFormats]] | [[Category:InternalFormats]] | ||
[[Category:FormatsByName]] | [[Category:FormatsByName]] |
Latest revision as of 21:02, 17 September 2012
4F424A66 | |
---|---|
Short name: | OBJf |
Long name: | Object Functions |
[edit] Introduction
Each OBJD resource in an object will have an OBJf resource with a matching instance value. The OBJf resource contains all the object functions.
There are quite a number of object functions, although most of the time you will find that you use very few of them. Each of these has an Action BHAV and a Guardian BHAV in a similar way to Pie-Menu functions. When the object function is run using Run Functional Tree, there is a "test only" option which runs the Guardian instead of the Action BHAV.
[edit] init
The init tree is called whenever an object is reset. This happens when the object is first being placed, and if "Reset" is chosen after an object error.
This is one of the ones you will likely always use.
[edit] main
The main tree is the initial point of entry for the object's main simulation. Parameters may be passed to main if the "create object" primitive specifies.
This is one of the ones you will always use, even if only to have an Idle instruction pointing back at itself.
[edit] load
The load tree is called whenever an instance of the object is loaded from a save file. It is only called if the "object version" instance variable is different from the corresponding variable in the object definition.
[edit] cleanup
The cleanup tree is called whenever an object is about to be deleted, or if a person's interaction with the object had to be aborted.
[edit] queue skipped
The queue skipped tree is called if an interaction in a person's queue was deleted for any reason.
[edit] allow intersection
This tree is a last resort hook for object intersection tests. If all the normal intersection tests pass, this tree is called to determine if two objects are allowed to intersect. Parameter 0 is the id of the object that is being tested.
[edit] wall adjacency changed
This tree is called whenever the wall configuration around an object changed. At that time, the "wall adjacency flags" instance variable will indicate the new configuration.
[edit] room changed
This tree is called whenever the room id of an object changes. At this time, the "room id" instance variable will contain the new room id.
[edit] dynamic multi-tile update
If this function is defined for a multi-tile object, the object is "dynamic". This means that any time one is placed, it is joined with any neighboring objects. When the joining takes place, this tree is called for each object in the multi-tile group.
[edit] placement
This tree is called any time the position of an object changes.
[edit] pickup
This tree is called when an object is removed from the world, either to be deleted or to be re-placed in the world.
[edit] user placement
This tree is called when the user clicks to place an object.
[edit] user pickup
This tree is called just before an object is picked up by the user.
[edit] level info request
This tree is called when the "level info" button is pressed. May not be used in final game.
[edit] serving surface
This tree is used by people who are looking for a place to drop food.
[edit] portal
If this tree is defined for a portal object, then the object may be used to transfer a person from one room to another. If two such objects are part of the same multi-tile group and lie in different rooms, then a person will push the tree to go between the rooms.
[edit] gardening
If this tree is defined, then the gardener will use it to take care of the plants.
[edit] wash hands
This tree is used by any person looking to wash hands.
[edit] prep
This tree is used a person who is trying to prepare food.
[edit] cook
This tree is used by any person trying to cook food.
[edit] surface
This tree is used by a person who is looking for a surface on which to place an object.
[edit] dispose
This tree is used by a person looking to throw away an object.
[edit] food
This tree is used to eat an object. It is only used by the fridge to transfer control of the person to the food after it is created.
[edit] pickup from slot
This tree is used by a person to pick up an object.
[edit] wash dish
This tree is used by a person who is looking to wash a dish.
[edit] eating surface
This tree is used by a person who wants to find a surface suitable for eating.
[edit] sit
This tree seats a person. If the tree is defined, the game considers the object to be a chair.
[edit] stand
If a person is sitting and contained in an object, this tree must be defined so that the person may stand up.
[edit] clean
This tree is used by the maid to clean objects.
[edit] repair
This tree is used by the repair man to repair objects.
[edit] ui event
This tree is called in the current situation object when an event in the user interface occurs. The first parameter is the type of the event. The second parameter is the id of the event.
[edit] Restock
Used by OfB employees/business owners to restock certain items. Example can be seen on the bookshelf. (Was previously labeled as Dry Clothes)
[edit] Wash Clothes
[edit] Start Live Mode
This is called when ever live mode is reentered. It is not called after a simple pause.
[edit] Stop Live Mode
This is called when ever live mode is left. It is note called for a simple pause.
[edit] Link Objects
This tree is called so that the object can set links to the previous and next objects in a doubly-linked list of objects. The first parameter is the ID of the previous object in the chain or -1 if this is the first object. The second parameter is the ID of the next object in the chain or -1 if this is the last object.
[edit] Message Handler
This tree is called when the object receives a broadcast message from the message primitive.
[edit] Pre Route
This tree handles the transition from the idle-neutral pose, to the locomotion neutral pose if they are different at the beginning of a route. An example is of a toddler changing from sitting to crawling pose brefore routing.
[edit] Post Route
This tree handles the transition from the locomotion neutral pose, to the idle-neutral pose if they are different at the end of a route. An example is of a toddler changing from crawling to a sitting pose brefore routing.
[edit] Goal Check
This tree checks if the routing goal is still available. Its called on the object that issues the goto command. For example if a sim is trying to route to a seat, and another sim gets there false, this call can return false, allowing the sim to stop and choose another seat.
[edit] Reaction Handler
This tree is called from a message handler tree, if the message receiver decides to actually handle the message.
[edit] Along Route Callback
This tree is called on the sim once per tile along the route, and can interupt it by returning false. This tree can be used to run idles while the sim is routing.
[edit] awareness
This tree is used by objects to advertise that they are interesting things to look at.
[edit] reset
Called when object is reset on loading of lot. This should never happen in shipped game.
[edit] lookatTarget
Called to choose objects to lookat along a route
[edit] Walk Over
When an object is walked over, this tree gets called.
[edit] Utility State Change
When a utility changes state, this tree gets called.
[edit] Set Model by Type
Called to change the model based on a type defined in the game code. The first parameter holds the model 'type'. e.x. Modular stair railing types: None | Left | Right | Both
[edit] Get Model Type
Called to get the model type as defined by the game code. e.x. Modular stair railing types: None | Left | Right | Both
[edit] delete
Called before an object is killed.
[edit] user delete
Called before an object is "deleted" or "sold" by the player, even if the object is not immediately killed.
[edit] Just Moved In
Called on objects that have been created by moving in a sim that have objects they own from another lot.
[edit] prevent place in slot
Called on container object during placement test for placing in a slot; return true to prevent placement even when all other tests pass.
[edit] Global Awareness
Added to make Paul B's life easier.
[edit] Object Updated by Design Mode
Called when Design mode updates an object, so we can set the correct state on it.