Data Storage: Difference between revisions

From Citizens Wiki

(Created page with "Data storage in Citizens2 is handled in one of two ways: YAML flatfile, or a SQL database. ==Saves.yml== Saves.yml is used by default to store al...")
 
No edit summary
 
(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Data storage in Citizens2 is handled in one of two ways: [[#Saves.yml|YAML flatfile]], or a [[#Database|SQL database]].
Data storage in Citizens2 is handled in one of two ways: [[#Saves.yml|YAML flatfile]] or a NBT file.


==Saves.yml==
==saves.yml==
Saves.yml is used by default to store all data on created NPCs.
''saves.yml'' is used by default to store all data on created NPCs.


===Structure===
===Structure===
Line 11: Line 11:
     {{H:title|The name of the NPC. Displayed above head for regular NPCs.|name: My_First_NPC}}
     {{H:title|The name of the NPC. Displayed above head for regular NPCs.|name: My_First_NPC}}
     {{H:title|Traits block. All specifics about the NPC are located here.|traits:}}
     {{H:title|Traits block. All specifics about the NPC are located here.|traits:}}
      {{H:title|Age block. Age specific settings are stored here.|age:}}
        {{H:title|What is the NPC's current age?|age: 0}}
        {{H:title|Will the NPC age over time?|locked: true}}
       {{H:title|Should the NPC be spawned on server startup?|spawned: true}}
       {{H:title|Should the NPC be spawned on server startup?|spawned: true}}
       {{H:title|Type of NPC. Either PLAYER or the mob type|type: PLAYER}}
       {{H:title|Type of NPC. Either PLAYER or the mob type|type: PLAYER}}
       {{H:title|Owner of the NPC. Has all permissions for that NPC by default.|owner: Steve}}
       {{H:title|Owner of the NPC. Can be set to "server".|owner: Steve}}
      {{H:title|Should the NPC look at the player when he comes near it?|lookclose: true}}
       {{H:title|Location block. Stores the location of the NPC|location:}}
       {{H:title|Location block. Stores the location of the NPC|location:}}
         {{H:title|World that the NPC is located in|world: world}}
         {{H:title|World that the NPC is located in|world: world}}
Line 21: Line 25:
         {{H:title|Yaw (direction the NPC is looking) of the NPC in degrees|yaw: '87.90003967285156'}}
         {{H:title|Yaw (direction the NPC is looking) of the NPC in degrees|yaw: '87.90003967285156'}}
         {{H:title|Pitch (height the NPC is looking) of the NPC in degrees|pitch: '21.14999008178711'}}
         {{H:title|Pitch (height the NPC is looking) of the NPC in degrees|pitch: '21.14999008178711'}}
 
      {{H:title|Text block. Stores information about the NPC's text.|text:}}
==Database==
        {{H:title|Should the NPC talk when a player gets near it?|talk-close: true}}
Database usage can be configured inside of the config.yml. Database usage requires more setup, but runs quicker when dealing with large numbers of NPCs.
        {{H:title|Should the NPC talk randomly?|random-talker: true}}
===Configuration===
        {{H:title|First line of the NPC's chat.|0: Hello, there. I'm My_First_NPC.}}
A quote from the config.yml (mouseover to view info):
      {{H:title|Waypoints block|waypoints:}}
<nowiki></nowiki>{{H:title|The name of the database|database:}}
        {{H:title|Linear type of waypoints|linear:}}
  {{H:title|The password for the database connection.|password: ''}}
          {{H:title|Points section of the linear block|points:}}
  {{H:title|The username for the database connection.|username: ''}}
            {{H:title|Waypoint number|'0':}}
  {{H:title|The URL for connecting to the database.|url: ''}}
              {{H:title|Waypoint location block|location:}}
  {{H:title|The driver to use when connecting to the database.|driver: ''}}
                {{H:title|World of the waypoint|world: MyWorld}}
 
                {{H:title|X coordinate of the waypoint|x: 60}}
''See also: [[Configuration]]''
                {{H:title|Y coordinate of the waypoint|y: 64}}
                {{H:title|Z coordinate of the waypoint|z: 80}}
                {{H:title|Pitch of the waypoint|pitch: 90}}
                {{H:title|Yaw of the waypoint|yaw: 0}}
              {{H:title|How long to wait at this point|delay: 0}}
            {{H:title|Waypoint number|'1':}}
              {{H:title|Waypoint location block|location:}}
                {{H:title|World of the waypoint|world: MyWorld}}
                {{H:title|X coordinate of the waypoint|x: 65}}
                {{H:title|Y coordinate of the waypoint|y: 64}}
                {{H:title|Z coordinate of the waypoint|z: 82}}
                {{H:title|Pitch of the waypoint|pitch: 45}}
                {{H:title|Yaw of the waypoint|yaw: 0}}
              {{H:title|How long to wait at this point|delay: 0}}
        {{H:title|Which pathfinder code do we use? (probably linear)|provider: linear}}


{{NavBox}}
{{NavBox}}
[[Category:Configuration]]

Latest revision as of 09:48, 23 January 2014

Data storage in Citizens2 is handled in one of two ways: YAML flatfile or a NBT file.

saves.yml

saves.yml is used by default to store all data on created NPCs.

Structure

Mouseover to view info:

# Citizens NPC Storage
npc:
  '0':
   name: My_First_NPC
   traits:
     age:
       age: 0
       locked: true
     spawned: true
     type: PLAYER
     owner: Steve
     lookclose: true
     location:
       world: world
       x: '92.65002360423462'
       y: '3.0'
       z: '-264.5621058817138'
       yaw: '87.90003967285156'
       pitch: '21.14999008178711'
     text:
       talk-close: true
       random-talker: true
       0: Hello, there. I'm My_First_NPC.
     waypoints:
       linear:
         points:
           '0':
             location:
               world: MyWorld
               x: 60
               y: 64
               z: 80
               pitch: 90
               yaw: 0
             delay: 0
           '1':
             location:
               world: MyWorld
               x: 65
               y: 64
               z: 82
               pitch: 45
               yaw: 0
             delay: 0
       provider: linear