User Tools

Site Tools


dragengine:modules:dragonscript:behavior_world

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
dragengine:modules:dragonscript:behavior_world [2025/04/30 16:06] – removed - external edit (Unknown date) 127.0.0.1dragengine:modules:dragonscript:behavior_world [2025/04/30 16:06] (current) – ↷ Page name changed from dragengine:modules:dragonscript:bahavior_world to dragengine:modules:dragonscript:behavior_world dragonlord
Line 1: Line 1:
 +{{tag>dragonscript behavior}}
 +<WRAP youarehere>
 +[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorWorld**
 +</WRAP>
 +
 +  * [[behaviors_use_cases|Behaviors Explained: By Use-Case]]
 +  * [[behaviors_a_to_z|Behaviors Explained: From A to Z]]
 +
 +====== ECBehaviorWorld ======
 +
 +Behavior loads world file and adds contained content to the the game world this element is located in.
 +
 +====== Instance Counts ======
 +
 +This behavior can be added multiple times to an element. Use the behavior identifier to tell them apart.
 +
 +====== Element Class Properties ======
 +
 +Element class properties have the prefix ''world.'' or ''world({id}).'' if id is not empty.
 +
 +===== path =====
 +
 +Set path to world file to use.
 +
 +  * Full name: ''world.path'' or ''world({id}).path''
 +  * Type: string
 +  * Default Value: empty string
 +  * Expected File Pattern: ''*.deworld''
 +  * Example (*.deeclass) <code xml><string name='world.path'>room_storage.deworld</string></code>
 +
 +===== position =====
 +
 +Set position relative to element matrix to add created content at.
 +  * Full name: ''world.position'' or ''world({id}).position''
 +  * Type: 3-component float vector
 +  * Default Value: (0,0,0)
 +  * Example (*.deeclass) <code xml><vector name='world.position' x='0' y='-1' z='0'/></code>
 +
 +===== orientation =====
 +
 +Set orientation relative to element matrix to add created content at.
 +  * Full name: ''world.orientation'' or ''world({id}).orientation''
 +  * Type: 3-component float vector
 +  * Default Value: (0,0,0)
 +  * Example (*.deeclass) <code xml><vector name='world.orientation' x='0' y='180' z='0'/></code>
 +
 +====== Events ======
 +
 +This behavior has no events.
 +
 +====== Required Behaviors ======
 +
 +This behavior requires no other behaviors.
 +
 +====== Optional Behaviors ======
 +
 +This behavior does not support optional behaviors.
 +
 +====== Persistency ======
 +
 +This behavior does support element class to be persistable (setPersistable).
 +
 +====== API Documentation ======
 +
 +#@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorWorld.html,ECBehaviorWorld~@#.
 +
 +Since DragonScript Module Version ''1.26''
 +
 +====== Use Cases ======
 +
 +  * Reuse groups of elements to reuse them in other world files.
 +
 +====== Element Class Example ======
 +
 +This example defines an element which loads a single world.
 +
 +<code>
 +class MyElement extends BehaviorElementClass
 +  public var ECBehaviorWorld world
 +  func new()
 +    world = ECBehaviorWorld.new(this)
 +    world.getPath().setPath("/content/worlds/storageRoom.deworld")
 +  end
 +end
 +</code>
 +
 +====== Behavior Factory ======
 +
 +Using element class supporting adding behaviors the behavior can be added like this:
 +<code xml>
 +<?xml version='1.0' encoding='UTF-8'?>
 +<elementClass name='MyClass' class='GenericBehaviorElement'>
 +  <!-- add world behavior -->
 +  <behavior type='ECBehaviorWorld'>
 +    <!-- set element properties. omit property prefix if used inside behavior tag -->
 +    <string name='.path'>/content/worlds/storageRoom.deworld</string>
 +  </behavior>
 +  
 +  <!-- for adding multiple behaviors use unique identifiers -->
 +  <behavior type='ECBehaviorWorld' id='second'/>
 +</elementClass>
 +</code>
 +
 +====== Live Examples ======
 +
 +  * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]