Gdods is a small GDScript for reading ODS files: the OpenDocument format forspreadsheets used in for example LibreOffice, and OpenOffice.You can use this script to add support for ODS files to the game you'rebuilding in the Godot game engine. It does not support all features that ODSfiles have, but sticks mainly to reading text and images from columns, andproviding you with some functions to iterate over spreadsheets.Gdods uses gdunzip( https://github.com/jellehermsen/gdunzip ) under the hood,for extracting the contents of the ODS file (since ODS files are actualy abunch of xml's and other assets wrapped in a zip).Example code----------------------# Create a gdods instancevar gdods = load('res://addons/gdods/gdods.gd').new()# Load an ODS filevar loaded = gdods.load('res://test/test.ods')if !loaded: print('Could not load ODS file :-(')else: # Get cell in sheet 0, row 2, column 1 # NB: numbering starts from 0 var cell = gdods.get_cell(0, 2, 1) # Verify that the cell is a TextCell if cell.type == gdods.TEXT_CELL: print('We have a text cell with this value: ' + cell.value) # Get another cell by using the named position var cell2 = gdods.get_cell_by_name('A42') # Verify that this cell is an ImageCell if cell2.type == gdods.IMAGE_CELL: print('We have got us an image cell') # Grab the actual image from the ODS file var image = cell2.load_image() if !image: print('Failed loading the image from the image cell') else: print('Image width is: ' + str(image.get_width()) # Turn the second sheet with a header row into a array of dicts var dictarray = gdods.to_dictarray(1, 0) # Print the first row's value for the 'my_beautiful_key' column print(dictarray['my_beautiful_key'])Class documentation---------------------------------The gdods class inherits "reference", and upon initialization it loadsgdunzip.gd from the same directory gdods.gd resides.CONSTANTS:- EMPTY_CELL = 0- TEXT_CELL = 1- IMAGE_CELL = 2FUNCTIONS:- bool load(String path)Tries to load an ODS file with a given path. Returns false if it failedloading the ods, or true if it was successfull.- "Cell" get_cell(int sheet_nr, int row_nr, int column_nr)Given a sheet number, row number and column numberthis method will return this cell's value, thiscan either be a EmptyCell, TextCell or ImageCell instance.If the cell can't be found it will return an EmptyCellNB: numbering starts at 0- "Cell" get_cell_by_name(int sheet_nr, int pos)Return a cell by giving its name (i.e A1, D100).Returns an empty cell if the cell can't be found, or if the input is incorrect.- Array to_dictarray(int sheet_nr, int header_row)If your sheet has a header row, you can use this function to transform all therows beneath the header row into a array of dicts. The header row will be usedas dictionary keys. This function returns false if the sheet denoted bysheet_nr or the header_row can't be found.INNER CLASSESGdods has 3 inner classes that are used for cell types: TextCell,ImageCell, EmptyCell. Each of those has a to_string() function, and you can check the typeof the class by comparing the "type" attribute to one of the gdods' constants(EMPTY_CELL / TEXT_CELL / IMAGE_CELL).You can get the image path from ImageCell by using the image_pathattribute, and you can load the image by calling the "load_image" function withno arguments. This will return either false or an Image instance.
A simple implementation of Goal Oriented Action Planning. It provides a script to define action planner nodes that accept actions defined as subnodes or programmatically, and can generate a plan (a sequence of actions) from a description of the current state of the character, and a goal to be achieved.It comes with a funny example that shows how GOAP can be used to easily create complex behaviors.