lib/demiurge.rb
# This sets the Engine's internal state from a structured array of
# items. It is normally used via load_state_from_dump.
This sets the Engine's internal state from a structured array of
items. It is normally used via load_state_from_dump.
This sets the Engine ' s internal state from a structured array of items . It is normally used via load_state_from_dump .
def state_from_structured_array(arr)
      @finished_init = false
      @state_items = {}
      @zones = []
      unless arr.any? { |type, name, state| name == "admin" }
        register_state_item(StateItem.from_name_type(self, "InertStateItem", "admin", {}))
        @state_items["admin"].state["ticks"] ||= 0
        @state_items["admin"].state["notification_id"] ||= 0
        @state_items["admin"].state["intention_id"] ||= 0
      end
      arr.each do |type, name, state|
        register_state_item(StateItem.from_name_type(self, type.freeze, name.to_s.freeze, state))
      end
      nil
    end
def state_from_structured_array ( arr ) @finished_init = false @state_items = { } @zones = [ ] unless arr . any? { | type , name , state | name == "admin" } register_state_item ( StateItem . from_name_type ( self , "InertStateItem" , "admin" , { } ) ) @state_items [ "admin" ] . state [ "ticks" ] ||= 0 @state_items [ "admin" ] . state [ "notification_id" ] ||= 0 @state_items [ "admin" ] . state [ "intention_id" ] ||= 0 end arr . each do | type , name , state | register_state_item ( StateItem . from_name_type ( self , type . freeze , name . to_s . freeze , state ) ) end nil end
This sets the Engine's internal state from a structured array of
items.
This sets the Engine ' s internal state from a structured array of items .
arr