Resolving 2 errors

This commit is contained in:
Jonathan Herrewijnen 2021-04-05 23:17:34 +02:00
commit 3d382a9833
4 changed files with 273 additions and 272 deletions

View File

@ -1,69 +1,70 @@
extends Node extends Node
const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns")
var path = "user://storage.db"
var path = "user://storage.db" var db_name = "RingOfRaces"
var db_name = "RingOfRaces" var db = null
var db = null var verbose = true
var verbose = true
# Called when the node enters the scene tree for the first time.
# Called when the node enters the scene tree for the first time. func _ready():
func _ready(): pass # Replace with function body.
pass # Replace with function body.
func CreateWorldDatabase():
func CreateWorldDatabase(): print("Creating new database")
print("Creating new database") var SQLite = load("user://gdsqlite.gdns")
var player_inventory : Dictionary = Dictionary() var player_inventory : Dictionary = Dictionary()
player_inventory["id"] = {"data_type":"int", "primary_key": true, "not_null": true} #slot id player_inventory["id"] = {"data_type":"int", "primary_key": true, "not_null": true} #slot id
player_inventory["item_id"] = {"data_type":"int", "not_null": true} #item id player_inventory["item_id"] = {"data_type":"int", "not_null": true} #item id
player_inventory["item_name"] = {"data_type":"text", "not_null": true} #item name player_inventory["item_name"] = {"data_type":"text", "not_null": true} #item name
player_inventory["amount"] = {"data_type":"int", "not_null": true} #amount player_inventory["amount"] = {"data_type":"int", "not_null": true} #amount
player_inventory["shortdesc"] = {"data_type":"char(80)", "not_null": true} #short description player_inventory["shortdesc"] = {"data_type":"char(80)", "not_null": true} #short description
db.create_table("player_inventory", player_inventory) db.create_table("player_inventory", player_inventory)
var items : Dictionary = Dictionary() var items : Dictionary = Dictionary()
for i in range(40): for i in range(40):
items["id"] = i items["id"] = i
items["item_id"] = 0 items["item_id"] = 0
items["item_name"] = "No Item" items["item_name"] = "No Item"
items["amount"] = 0 items["amount"] = 0
items["shortdesc"] = "No item here" items["shortdesc"] = "No item here"
# Insert a new row in the table # Insert a new row in the table
db.insert_row("player_inventory", items) db.insert_row("player_inventory", items)
items.clear() items.clear()
func OpenConnection(): func OpenConnection():
self.db = SQLite.new() var SQLite = load("user://gdsqlite.gdns")
var file = File.new() self.db = SQLite.new()
self.db.path = path var file = File.new()
self.db.verbose_mode = verbose self.db.path = path
var create = false self.db.verbose_mode = verbose
print(path) var create = false
print(path)
# This does not seem to work. The file is in the right place, but being recreated everytime. The file is findable in Res:// and C:/ .. But not after the user folder
if !file.file_exists(path): # This does not seem to work. The file is in the right place, but being recreated everytime. The file is findable in Res:// and C:/ .. But not after the user folder
print("File not existing, so creating new db") if !file.file_exists(path):
create = true print("File not existing, so creating new db")
self.db.open_db() create = true
if create: self.db.open_db()
CreateWorldDatabase() if create:
CreateWorldDatabase()
func OpenConnectionIfClosed():
if self.db == null: func OpenConnectionIfClosed():
OpenConnection() if self.db == null:
OpenConnection()
func GetInventoryItems():
OpenConnectionIfClosed() func GetInventoryItems():
var ret = [] OpenConnectionIfClosed()
ret = db.select_rows("player_inventory", "",["*"]) var ret = []
return ret ret = db.select_rows("player_inventory", "",["*"])
return ret
func SaveInventory(player_inventory_items):
print("Now on inventory save file") func SaveInventory(player_inventory_items):
if(player_inventory_items == null or len(player_inventory_items) != 40): print("Now on inventory save file")
Global.Log("Bad inventory save!", 3) if(player_inventory_items == null or len(player_inventory_items) != 40):
return Global.Log("Bad inventory save!", 3)
OpenConnectionIfClosed() return
OpenConnectionIfClosed()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta): # Called every frame. 'delta' is the elapsed time since the previous frame.
# pass #func _process(delta):
# pass

View File

@ -1,200 +1,200 @@
[preset.0] [preset.0]
name="Android" name="Android"
platform="Android" platform="Android"
runnable=true runnable=true
custom_features="" custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter="*.db"
exclude_filter="" exclude_filter=""
export_path="./Ring of Races_v03_GLE2.apk" export_path="./Ring of Races_v03_GLE2.apk"
patch_list=PoolStringArray( ) patch_list=PoolStringArray( )
script_export_mode=1 script_export_mode=1
script_encryption_key="" script_encryption_key=""
[preset.0.options] [preset.0.options]
graphics/32_bits_framebuffer=true graphics/32_bits_framebuffer=true
xr_features/xr_mode=0 xr_features/xr_mode=0
xr_features/degrees_of_freedom=0 xr_features/degrees_of_freedom=0
xr_features/hand_tracking=0 xr_features/hand_tracking=0
xr_features/focus_awareness=false xr_features/focus_awareness=false
one_click_deploy/clear_previous_install=false one_click_deploy/clear_previous_install=false
custom_template/debug="" custom_template/debug=""
custom_template/release="" custom_template/release=""
custom_template/use_custom_build=false custom_template/use_custom_build=false
command_line/extra_args="" command_line/extra_args=""
version/code=1 version/code=1
version/name="1.0" version/name="1.0"
package/unique_name="org.godotengine.$genname" package/unique_name="org.godotengine.$genname"
package/name="" package/name=""
package/signed=true package/signed=true
screen/immersive_mode=true screen/immersive_mode=true
screen/orientation=0 screen/orientation=0
screen/support_small=true screen/support_small=true
screen/support_normal=true screen/support_normal=true
screen/support_large=true screen/support_large=true
screen/support_xlarge=true screen/support_xlarge=true
screen/opengl_debug=false screen/opengl_debug=false
launcher_icons/main_192x192="" launcher_icons/main_192x192=""
launcher_icons/adaptive_foreground_432x432="" launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432="" launcher_icons/adaptive_background_432x432=""
keystore/debug="" keystore/debug=""
keystore/debug_user="" keystore/debug_user=""
keystore/debug_password="" keystore/debug_password=""
keystore/release="" keystore/release=""
keystore/release_user="" keystore/release_user=""
keystore/release_password="" keystore/release_password=""
apk_expansion/enable=false apk_expansion/enable=false
apk_expansion/SALT="" apk_expansion/SALT=""
apk_expansion/public_key="" apk_expansion/public_key=""
architectures/armeabi-v7a=true architectures/armeabi-v7a=true
architectures/arm64-v8a=true architectures/arm64-v8a=true
architectures/x86=false architectures/x86=false
architectures/x86_64=false architectures/x86_64=false
permissions/custom_permissions=PoolStringArray( ) permissions/custom_permissions=PoolStringArray( )
permissions/access_checkin_properties=false permissions/access_checkin_properties=false
permissions/access_coarse_location=false permissions/access_coarse_location=false
permissions/access_fine_location=false permissions/access_fine_location=false
permissions/access_location_extra_commands=false permissions/access_location_extra_commands=false
permissions/access_mock_location=false permissions/access_mock_location=false
permissions/access_network_state=false permissions/access_network_state=false
permissions/access_surface_flinger=false permissions/access_surface_flinger=false
permissions/access_wifi_state=false permissions/access_wifi_state=false
permissions/account_manager=false permissions/account_manager=false
permissions/add_voicemail=false permissions/add_voicemail=false
permissions/authenticate_accounts=false permissions/authenticate_accounts=false
permissions/battery_stats=false permissions/battery_stats=false
permissions/bind_accessibility_service=false permissions/bind_accessibility_service=false
permissions/bind_appwidget=false permissions/bind_appwidget=false
permissions/bind_device_admin=false permissions/bind_device_admin=false
permissions/bind_input_method=false permissions/bind_input_method=false
permissions/bind_nfc_service=false permissions/bind_nfc_service=false
permissions/bind_notification_listener_service=false permissions/bind_notification_listener_service=false
permissions/bind_print_service=false permissions/bind_print_service=false
permissions/bind_remoteviews=false permissions/bind_remoteviews=false
permissions/bind_text_service=false permissions/bind_text_service=false
permissions/bind_vpn_service=false permissions/bind_vpn_service=false
permissions/bind_wallpaper=false permissions/bind_wallpaper=false
permissions/bluetooth=false permissions/bluetooth=false
permissions/bluetooth_admin=false permissions/bluetooth_admin=false
permissions/bluetooth_privileged=false permissions/bluetooth_privileged=false
permissions/brick=false permissions/brick=false
permissions/broadcast_package_removed=false permissions/broadcast_package_removed=false
permissions/broadcast_sms=false permissions/broadcast_sms=false
permissions/broadcast_sticky=false permissions/broadcast_sticky=false
permissions/broadcast_wap_push=false permissions/broadcast_wap_push=false
permissions/call_phone=false permissions/call_phone=false
permissions/call_privileged=false permissions/call_privileged=false
permissions/camera=false permissions/camera=false
permissions/capture_audio_output=false permissions/capture_audio_output=false
permissions/capture_secure_video_output=false permissions/capture_secure_video_output=false
permissions/capture_video_output=false permissions/capture_video_output=false
permissions/change_component_enabled_state=false permissions/change_component_enabled_state=false
permissions/change_configuration=false permissions/change_configuration=false
permissions/change_network_state=false permissions/change_network_state=false
permissions/change_wifi_multicast_state=false permissions/change_wifi_multicast_state=false
permissions/change_wifi_state=false permissions/change_wifi_state=false
permissions/clear_app_cache=false permissions/clear_app_cache=false
permissions/clear_app_user_data=false permissions/clear_app_user_data=false
permissions/control_location_updates=false permissions/control_location_updates=false
permissions/delete_cache_files=false permissions/delete_cache_files=false
permissions/delete_packages=false permissions/delete_packages=false
permissions/device_power=false permissions/device_power=false
permissions/diagnostic=false permissions/diagnostic=false
permissions/disable_keyguard=false permissions/disable_keyguard=false
permissions/dump=false permissions/dump=false
permissions/expand_status_bar=false permissions/expand_status_bar=false
permissions/factory_test=false permissions/factory_test=false
permissions/flashlight=false permissions/flashlight=false
permissions/force_back=false permissions/force_back=false
permissions/get_accounts=false permissions/get_accounts=false
permissions/get_package_size=false permissions/get_package_size=false
permissions/get_tasks=false permissions/get_tasks=false
permissions/get_top_activity_info=false permissions/get_top_activity_info=false
permissions/global_search=false permissions/global_search=false
permissions/hardware_test=false permissions/hardware_test=false
permissions/inject_events=false permissions/inject_events=false
permissions/install_location_provider=false permissions/install_location_provider=false
permissions/install_packages=false permissions/install_packages=false
permissions/install_shortcut=false permissions/install_shortcut=false
permissions/internal_system_window=false permissions/internal_system_window=false
permissions/internet=false permissions/internet=false
permissions/kill_background_processes=false permissions/kill_background_processes=false
permissions/location_hardware=false permissions/location_hardware=false
permissions/manage_accounts=false permissions/manage_accounts=false
permissions/manage_app_tokens=false permissions/manage_app_tokens=false
permissions/manage_documents=false permissions/manage_documents=false
permissions/master_clear=false permissions/master_clear=false
permissions/media_content_control=false permissions/media_content_control=false
permissions/modify_audio_settings=false permissions/modify_audio_settings=false
permissions/modify_phone_state=false permissions/modify_phone_state=false
permissions/mount_format_filesystems=false permissions/mount_format_filesystems=false
permissions/mount_unmount_filesystems=false permissions/mount_unmount_filesystems=false
permissions/nfc=false permissions/nfc=false
permissions/persistent_activity=false permissions/persistent_activity=false
permissions/process_outgoing_calls=false permissions/process_outgoing_calls=false
permissions/read_calendar=false permissions/read_calendar=false
permissions/read_call_log=false permissions/read_call_log=false
permissions/read_contacts=false permissions/read_contacts=false
permissions/read_external_storage=false permissions/read_external_storage=false
permissions/read_frame_buffer=false permissions/read_frame_buffer=false
permissions/read_history_bookmarks=false permissions/read_history_bookmarks=false
permissions/read_input_state=false permissions/read_input_state=false
permissions/read_logs=false permissions/read_logs=false
permissions/read_phone_state=false permissions/read_phone_state=false
permissions/read_profile=false permissions/read_profile=false
permissions/read_sms=false permissions/read_sms=false
permissions/read_social_stream=false permissions/read_social_stream=false
permissions/read_sync_settings=false permissions/read_sync_settings=false
permissions/read_sync_stats=false permissions/read_sync_stats=false
permissions/read_user_dictionary=false permissions/read_user_dictionary=false
permissions/reboot=false permissions/reboot=false
permissions/receive_boot_completed=false permissions/receive_boot_completed=false
permissions/receive_mms=false permissions/receive_mms=false
permissions/receive_sms=false permissions/receive_sms=false
permissions/receive_wap_push=false permissions/receive_wap_push=false
permissions/record_audio=false permissions/record_audio=false
permissions/reorder_tasks=false permissions/reorder_tasks=false
permissions/restart_packages=false permissions/restart_packages=false
permissions/send_respond_via_message=false permissions/send_respond_via_message=false
permissions/send_sms=false permissions/send_sms=false
permissions/set_activity_watcher=false permissions/set_activity_watcher=false
permissions/set_alarm=false permissions/set_alarm=false
permissions/set_always_finish=false permissions/set_always_finish=false
permissions/set_animation_scale=false permissions/set_animation_scale=false
permissions/set_debug_app=false permissions/set_debug_app=false
permissions/set_orientation=false permissions/set_orientation=false
permissions/set_pointer_speed=false permissions/set_pointer_speed=false
permissions/set_preferred_applications=false permissions/set_preferred_applications=false
permissions/set_process_limit=false permissions/set_process_limit=false
permissions/set_time=false permissions/set_time=false
permissions/set_time_zone=false permissions/set_time_zone=false
permissions/set_wallpaper=false permissions/set_wallpaper=false
permissions/set_wallpaper_hints=false permissions/set_wallpaper_hints=false
permissions/signal_persistent_processes=false permissions/signal_persistent_processes=false
permissions/status_bar=false permissions/status_bar=false
permissions/subscribed_feeds_read=false permissions/subscribed_feeds_read=false
permissions/subscribed_feeds_write=false permissions/subscribed_feeds_write=false
permissions/system_alert_window=false permissions/system_alert_window=false
permissions/transmit_ir=false permissions/transmit_ir=false
permissions/uninstall_shortcut=false permissions/uninstall_shortcut=false
permissions/update_device_stats=false permissions/update_device_stats=false
permissions/use_credentials=false permissions/use_credentials=false
permissions/use_sip=false permissions/use_sip=false
permissions/vibrate=false permissions/vibrate=false
permissions/wake_lock=false permissions/wake_lock=false
permissions/write_apn_settings=false permissions/write_apn_settings=true
permissions/write_calendar=false permissions/write_calendar=false
permissions/write_call_log=false permissions/write_call_log=false
permissions/write_contacts=false permissions/write_contacts=false
permissions/write_external_storage=false permissions/write_external_storage=true
permissions/write_gservices=false permissions/write_gservices=false
permissions/write_history_bookmarks=false permissions/write_history_bookmarks=false
permissions/write_profile=false permissions/write_profile=false
permissions/write_secure_settings=false permissions/write_secure_settings=false
permissions/write_settings=false permissions/write_settings=true
permissions/write_sms=false permissions/write_sms=false
permissions/write_social_stream=false permissions/write_social_stream=false
permissions/write_sync_settings=false permissions/write_sync_settings=false
permissions/write_user_dictionary=false permissions/write_user_dictionary=false

View File

@ -45,7 +45,7 @@
[sub_resource type="OccluderPolygon2D" id=6] [sub_resource type="OccluderPolygon2D" id=6]
polygon = PoolVector2Array( 0, 0, 32, 0, 32, 96, 0, 96 ) polygon = PoolVector2Array( 0, 0, 32, 0, 32, 96, 0, 96 )
[sub_resource type="ConvexPolygonShape2D" id=5] [sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 0, 0, 32, 0, 32, 96, 0, 96 ) points = PoolVector2Array( 0, 0, 32, 0, 32, 96, 0, 96 )
[sub_resource type="TileSet" id=2] [sub_resource type="TileSet" id=2]
@ -116,14 +116,14 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 96, 0, 96 )
4/navigation_offset = Vector2( 0, 0 ) 4/navigation_offset = Vector2( 0, 0 )
4/shape_offset = Vector2( 0, 0 ) 4/shape_offset = Vector2( 0, 0 )
4/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) 4/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
4/shape = SubResource( 5 ) 4/shape = SubResource( 7 )
4/shape_one_way = false 4/shape_one_way = false
4/shape_one_way_margin = 1.0 4/shape_one_way_margin = 1.0
4/shapes = [ { 4/shapes = [ {
"autotile_coord": Vector2( 0, 0 ), "autotile_coord": Vector2( 0, 0 ),
"one_way": false, "one_way": false,
"one_way_margin": 1.0, "one_way_margin": 1.0,
"shape": SubResource( 5 ), "shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ] } ]
4/z_index = 0 4/z_index = 0