Paste #30125: Untitled Paste

Date: 2016/02/11 02:14:56 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


########################
# File for Engine-Core #
########################

##################################################################################
# World script that manages the loading and initialising of the entire framework #
##################################################################################
Engine_Manager:
  type: world
  events:
    on server start:
    - if <server.has_file[../dFramework/config.yml]> {
      - yaml load:../dFramework/config.yml id:config

      - ^run Engine_Load_Modules
      }
      else {
      - yaml create id:config

      - ^run Engine_Initialise_Core
      - ^run Engine_Initialise_Modules
      }

#########################################################################
# Task script for loading the core of the engine # CURRENTLY NOT IS USE #
#########################################################################
Engine_Load_Core:
  type: task
  script:
  - yaml load:../dFramework/config.yml id:config

#####################################################
# Task script for loading the modules of the engine #
#####################################################
Engine_Load_Modules:
  type: task
  script:
  - if <yaml[config].read[engine.options.enable-framework].not> {
    - queue clear
    }

  - foreach <yaml[config].list_keys[engine.modules]> {
    - if <yaml[config].read[engine.modules.<def[value]>.enable]> && <server.list_scripts.contains[s@Load_Module_<def[value]>]> {
      - run Load_Module_<def[value]>

      - debug debug "Module: <def[value]> detected and enabled. Loading module."
      }
    }

##############################################################
# Task script for initialising the core config of the engine #
##############################################################
Engine_Initialise_Core:
  type: task
  script:
  - yaml id:config set engine.options.enable-framework:'true'
  - yaml savefile:../dFramework/config.yml id:config

#################################################################
# Task script for initialising the modules config of the engine #
#################################################################
Engine_Initialise_Modules:
  type: task
  script:
  - yaml id:config set engine.modules.dtitles.description:'This module is the dTitles plugin, used in the BuyCraft shop.'
  - yaml id:config set engine.modules.dtitles.enable:'true'
  - ^run Initialise_Module_dTitles

  - yaml id:config set engine.modules.esteem.description:'This module is what determines how the npcs respond to you.'
  - yaml id:config set engine.modules.esteem.enable:'true'
  - ^run Initialise_Module_Esteem

  - yaml id:config set engine.modules.debug.description:'This module contains all the debugging and security related tools.'
  - yaml id:config set engine.modules.debug.enable:'true'
  - ^run Initialise_Module_Debug

  - yaml savefile:../dFramework/config.yml id:config