2018-05-17 16:18:20 +02:00
# Content DB
# Copyright (C) 2018 rubenwardy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-03-19 19:25:13 +01:00
import os , sys , datetime
2018-03-18 18:43:30 +01:00
2018-03-24 03:49:30 +01:00
if not " FLASK_CONFIG " in os . environ :
os . environ [ " FLASK_CONFIG " ] = " ../config.cfg "
2018-05-23 18:40:15 +02:00
test_data = len ( sys . argv ) > = 2 and sys . argv [ 1 ] . strip ( ) == " -t "
2018-03-19 19:08:41 +01:00
2018-05-23 18:40:15 +02:00
from app . models import *
2018-06-24 13:27:28 +02:00
from app . utils import make_flask_user_password
2018-05-13 18:55:28 +02:00
2018-05-23 18:40:15 +02:00
def defineDummyData ( licenses , tags , ruben ) :
2018-03-21 23:03:37 +01:00
ez = User ( " Shara " )
ez . github_username = " Ezhh "
2018-05-13 01:56:32 +02:00
ez . forums_username = " Shara "
2018-03-21 23:03:37 +01:00
ez . rank = UserRank . EDITOR
db . session . add ( ez )
2018-05-13 18:55:28 +02:00
not1 = Notification ( ruben , ez , " Awards approved " , " /packages/rubenwardy/awards/ " )
db . session . add ( not1 )
2018-03-20 03:24:44 +01:00
jeija = User ( " Jeija " )
jeija . github_username = " Jeija "
2018-05-29 19:16:05 +02:00
jeija . forums_username = " Jeija "
2018-03-20 03:24:44 +01:00
db . session . add ( jeija )
2018-03-24 03:36:14 +01:00
2018-05-13 01:56:32 +02:00
2018-04-19 21:20:05 +02:00
mod = Package ( )
mod . approved = True
mod . name = " alpha "
mod . title = " Alpha Test "
mod . license = licenses [ " MIT " ]
mod . type = PackageType . MOD
mod . author = ruben
mod . tags . append ( tags [ " mapgen " ] )
mod . tags . append ( tags [ " environment " ] )
mod . repo = " https://github.com/ezhh/other_worlds "
mod . issueTracker = " https://github.com/ezhh/other_worlds/issues "
mod . forums = 16015
mod . shortDesc = " The content library should not be used yet as it is still in alpha "
mod . desc = " This is the long desc "
db . session . add ( mod )
rel = PackageRelease ( )
rel . package = mod
rel . title = " v1.0.0 "
rel . url = " https://github.com/ezhh/handholds/archive/master.zip "
rel . approved = True
db . session . add ( rel )
2018-03-19 19:25:13 +01:00
mod1 = Package ( )
2018-03-21 20:03:14 +01:00
mod1 . approved = True
2018-03-19 19:08:41 +01:00
mod1 . name = " awards "
mod1 . title = " Awards "
2018-04-03 15:13:11 +02:00
mod1 . license = licenses [ " LGPLv2.1 " ]
2018-03-20 01:44:47 +01:00
mod1 . type = PackageType . MOD
2018-03-19 19:08:41 +01:00
mod1 . author = ruben
2018-03-26 12:28:34 +02:00
mod1 . tags . append ( tags [ " player_effects " ] )
2018-03-20 03:24:44 +01:00
mod1 . repo = " https://github.com/rubenwardy/awards "
mod1 . issueTracker = " https://github.com/rubenwardy/awards/issues "
2018-03-21 18:42:43 +01:00
mod1 . forums = 4870
2018-03-20 03:17:33 +01:00
mod1 . shortDesc = " Adds achievements and an API to register new ones. "
mod1 . desc = """
2018-03-20 03:24:44 +01:00
Majority of awards are back ported from Calinou ' s old fork in Carbone, under same license.
2018-03-20 03:17:33 +01:00
` ` `
awards . register_achievement ( " award_mesefind " , {
title = " First Mese Find " ,
description = " Found some Mese! " ,
trigger = {
type = " dig " , - - award is given when
node = " default:mese " , - - this type of node has been dug
target = 1 , - - this number of times
} ,
} )
` ` `
2018-03-20 03:24:44 +01:00
"""
2018-03-20 19:20:30 +01:00
rel = PackageRelease ( )
rel . package = mod1
rel . title = " v1.0.0 "
rel . url = " https://github.com/rubenwardy/awards/archive/master.zip "
2018-04-08 20:33:42 +02:00
rel . approved = True
2018-03-20 19:20:30 +01:00
db . session . add ( rel )
2018-03-20 03:24:44 +01:00
mod2 = Package ( )
2018-03-21 20:03:14 +01:00
mod2 . approved = True
2018-03-20 03:24:44 +01:00
mod2 . name = " mesecons "
mod2 . title = " Mesecons "
2018-03-26 12:28:34 +02:00
mod2 . tags . append ( tags [ " tools " ] )
2018-03-20 03:24:44 +01:00
mod2 . type = PackageType . MOD
2018-04-03 15:13:11 +02:00
mod2 . license = licenses [ " LGPLv3 " ]
2018-03-20 03:24:44 +01:00
mod2 . author = jeija
mod2 . repo = " https://github.com/minetest-mods/mesecons/ "
mod2 . issueTracker = " https://github.com/minetest-mods/mesecons/issues "
2018-03-21 18:42:43 +01:00
mod2 . forums = 628
2018-03-20 03:24:44 +01:00
mod2 . shortDesc = " Mesecons adds everything digital, from all kinds of sensors, switches, solar panels, detectors, pistons, lamps, sound blocks to advanced digital circuitry like logic gates and programmable blocks. "
mod2 . desc = """
########################################################################
## __ __ _____ _____ _____ _____ _____ _ _ _____ ##
## | \ / | | ___| | ___| | ___| | ___| | _ | | \ | | | ___| ##
## | \/ | | |___ | |___ | |___ | | | | | | | \| | | |___ ##
## | |\__/| | | ___| |___ | | ___| | | | | | | | | |___ | ##
## | | | | | |___ ___| | | |___ | |___ | |_| | | |\ | ___| | ##
## |_| |_| |_____| |_____| |_____| |_____| |_____| |_| \_| |_____| ##
## ##
########################################################################
MESECONS by Jeija and contributors
Mezzee - what ?
- - - - - - - - - - - -
[ Mesecons ] ( http : / / mesecons . net / ) ! They ' re yellow, they ' re conductive , and they ' ll add a whole new dimension to Minetest ' s gameplay .
Mesecons is a mod for [ Minetest ] ( http : / / minetest . net / ) that implements a ton of items related to digital circuitry , such as wires , buttons , lights , and even programmable controllers . Among other things , there are also pistons , solar panels , pressure plates , and note blocks .
Mesecons has a similar goal to Redstone in Minecraft , but works in its own way , with different rules and mechanics .
OK , I want in .
- - - - - - - - - - - - - -
Go get it !
[ DOWNLOAD IT NOW ] ( https : / / github . com / minetest - mods / mesecons / archive / master . zip )
Now go ahead and install it like any other Minetest mod . Don ' t know how? Check out [the wonderful page about it](http://wiki.minetest.com/wiki/Mods) over at the Minetest Wiki. For your convenience, here ' s a quick summary :
1. If Mesecons is still in a ZIP file , extract the folder inside to somewhere on the computer .
2. Make sure that when you open the folder , you can directly find ` README . md ` in the listing . If you just see another folder , move that folder up one level and delete the old one .
3. Open up the Minetest mods folder - usually ` / mods / ` . If you see the ` minetest ` or folder inside of that , that is your mod folder instead .
4. Copy the Mesecons folder into the mods folder .
Don ' t like some parts of Mesecons? Open up the Mesecons folder and delete the subfolder containing the mod you don ' t want . If you didn ' t want movestones, for example, all you have to do is delete the `mesecons_movestones` folder and they will no longer be available.
There are no dependencies - it will work right after installing !
How do I use this thing ?
- - - - - - - - - - - - - - - - - - - - - - - -
How about a [ quick overview video ] ( https : / / www . youtube . com / watch ? v = 6 kmeQj6iW5k ) ?
Or maybe a [ comprehensive reference ] ( http : / / mesecons . net / items . html ) is your style ?
An overview for the very newest of new beginners ? How does [ this one ] ( http : / / uberi . mesecons . net / projects / MeseconsBasics / index . html ) look ?
Want to get more into building ? Why not check out the [ Mesecons Laboratory ] ( http : / / uberi . mesecons . net / ) , a website dedicated to advanced Mesecons builders ?
Want to contribute to Mesecons itself ? Check out the [ source code ] ( https : / / github . com / minetest - mods / mesecons ) !
Who wrote it anyways ?
- - - - - - - - - - - - - - - - - - - - -
These awesome people made Mesecons possible !
| Contributor | Contribution |
| - - - - - - - - - - - - - - - | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| Hawk777 | Code for VoxelManip caching |
| Jat15 | Various tweaks . |
| Jeija | * * Main developer ! Everything . * * |
| Jordach | Noteblock sounds . |
| khonkhortistan | Code , recipes , textures . |
| Kotolegokot | Nodeboxes for items . |
| minerd247 | Textures . |
| Nore / Novatux | Code . |
| RealBadAngel | Fixes , improvements . |
| sfan5 | Code , recipes , textures . |
| suzenako | Piston sounds . |
| Uberi / Temperest | Code , textures , documentation . |
| VanessaE | Code , recipes , textures , design . |
| Whiskers75 | Logic gates implementation . |
There are also a whole bunch of other people helping with everything from code to testing and feedback . Mesecons would also not be possible without their help !
Alright , how can I use it ?
- - - - - - - - - - - - - - - - - - - - - - - - - -
All textures in this project are licensed under the CC - BY - SA 3.0 ( Creative Commons Attribution - ShareAlike 3.0 Generic ) . That means you can distribute and remix them as much as you want to , under the condition that you give credit to the authors and the project , and that if you remix and release them , they must be under the same or similar license to this one .
All code in this project is licensed under the LGPL version 3 or later . That means you have unlimited freedom to distribute and modify the work however you see fit , provided that if you decide to distribute it or any modified versions of it , you must also use the same license . The LGPL also grants the additional freedom to write extensions for the software and distribute them without the extensions being subject to the terms of the LGPL , although the software itself retains its license .
No warranty is provided , express or implied , for any part of the project .
"""
2018-03-19 19:08:41 +01:00
db . session . add ( mod1 )
2018-03-20 03:24:44 +01:00
db . session . add ( mod2 )
2018-04-08 19:27:27 +02:00
mod = Package ( )
mod . approved = True
mod . name = " handholds "
2018-05-21 23:20:28 +02:00
mod . title = " Handholds "
2018-04-08 19:27:27 +02:00
mod . license = licenses [ " MIT " ]
mod . type = PackageType . MOD
mod . author = ez
mod . tags . append ( tags [ " player_effects " ] )
mod . repo = " https://github.com/ezhh/handholds "
mod . issueTracker = " https://github.com/ezhh/handholds/issues "
mod . forums = 17069
mod . shortDesc = " Adds hand holds and climbing thingies "
mod . desc = " This is the long desc "
db . session . add ( mod )
2018-04-08 20:33:42 +02:00
rel = PackageRelease ( )
rel . package = mod
rel . title = " v1.0.0 "
rel . url = " https://github.com/ezhh/handholds/archive/master.zip "
rel . approved = True
db . session . add ( rel )
2018-04-08 19:27:27 +02:00
mod = Package ( )
mod . approved = True
mod . name = " other_worlds "
mod . title = " Other Worlds "
mod . license = licenses [ " MIT " ]
mod . type = PackageType . MOD
mod . author = ez
mod . tags . append ( tags [ " mapgen " ] )
mod . tags . append ( tags [ " environment " ] )
mod . repo = " https://github.com/ezhh/other_worlds "
mod . issueTracker = " https://github.com/ezhh/other_worlds/issues "
mod . forums = 16015
mod . shortDesc = " Adds space with asteroids and comets "
mod . desc = " This is the long desc "
db . session . add ( mod )
mod = Package ( )
mod . approved = True
mod . name = " food "
mod . title = " Food "
mod . license = licenses [ " LGPLv2.1 " ]
mod . type = PackageType . MOD
mod . author = ruben
mod . tags . append ( tags [ " player_effects " ] )
mod . repo = " https://github.com/rubenwardy/food/ "
mod . issueTracker = " https://github.com/rubenwardy/food/issues/ "
mod . forums = 2960
mod . shortDesc = " Adds lots of food and an API to manage ingredients "
mod . desc = " This is the long desc "
2018-05-21 23:20:28 +02:00
food = mod
2018-04-08 19:27:27 +02:00
db . session . add ( mod )
mod = Package ( )
mod . approved = True
mod . name = " food_sweet "
mod . title = " Sweet Foods "
mod . license = licenses [ " CC0 " ]
mod . type = PackageType . MOD
mod . author = ruben
mod . tags . append ( tags [ " player_effects " ] )
mod . repo = " https://github.com/rubenwardy/food_sweet/ "
mod . issueTracker = " https://github.com/rubenwardy/food_sweet/issues/ "
mod . forums = 9039
mod . shortDesc = " Adds sweet food "
mod . desc = " This is the long desc "
2018-05-27 22:31:11 +02:00
food_sweet = mod
2018-04-08 19:27:27 +02:00
db . session . add ( mod )
2018-03-20 03:24:44 +01:00
game1 = Package ( )
2018-03-21 20:03:14 +01:00
game1 . approved = True
2018-03-20 03:24:44 +01:00
game1 . name = " capturetheflag "
game1 . title = " Capture The Flag "
game1 . type = PackageType . GAME
2018-04-03 15:13:11 +02:00
game1 . license = licenses [ " LGPLv2.1 " ]
2018-03-20 03:24:44 +01:00
game1 . author = ruben
2018-03-26 12:54:33 +02:00
game1 . tags . append ( tags [ " pvp " ] )
2018-03-26 12:28:34 +02:00
game1 . tags . append ( tags [ " survival " ] )
2018-03-26 12:54:33 +02:00
game1 . tags . append ( tags [ " multiplayer " ] )
2018-03-20 03:24:44 +01:00
game1 . repo = " https://github.com/rubenwardy/capturetheflag "
game1 . issueTracker = " https://github.com/rubenwardy/capturetheflag/issues "
2018-03-21 18:42:43 +01:00
game1 . forums = 12835
2018-03-20 03:24:44 +01:00
game1 . shortDesc = " Two teams battle to snatch and return the enemy ' s flag, before the enemy takes their own! "
game1 . desc = """
As seen on the Capture the Flag server ( minetest . rubenwardy . com : 30000 )
Uses the CTF PvP Engine .
"""
db . session . add ( game1 )
2018-04-08 22:15:29 +02:00
rel = PackageRelease ( )
rel . package = game1
rel . title = " v1.0.0 "
rel . url = " https://github.com/rubenwardy/capturetheflag/archive/master.zip "
rel . approved = True
db . session . add ( rel )
2018-03-20 03:24:44 +01:00
2018-04-09 02:08:14 +02:00
mod = Package ( )
mod . approved = True
mod . name = " pixelbox "
mod . title = " PixelBOX Reloaded "
mod . license = licenses [ " CC0 " ]
mod . type = PackageType . TXP
mod . author = ruben
mod . forums = 14132
mod . shortDesc = " This is an update of the original PixelBOX texture pack by the brillant artist Gambit "
mod . desc = " This is the long desc "
db . session . add ( mod )
rel = PackageRelease ( )
rel . package = mod
rel . title = " v1.0.0 "
rel . url = " http://mamadou3.free.fr/Minetest/PixelBOX.zip "
rel . approved = True
db . session . add ( rel )
2018-05-27 17:37:54 +02:00
db . session . commit ( )
metas = { }
for package in Package . query . filter_by ( type = PackageType . MOD ) . all ( ) :
meta = None
try :
meta = metas [ package . name ]
except KeyError :
meta = MetaPackage ( package . name )
db . session . add ( meta )
metas [ package . name ] = meta
package . provides . append ( meta )
2018-05-27 22:31:11 +02:00
dep = Dependency ( food_sweet , meta = metas [ " food " ] )
db . session . add ( dep )
2018-05-23 18:40:15 +02:00
delete_db = len ( sys . argv ) > = 2 and sys . argv [ 1 ] . strip ( ) == " -d "
if delete_db and os . path . isfile ( " db.sqlite " ) :
os . remove ( " db.sqlite " )
print ( " Creating database tables... " )
db . create_all ( )
print ( " Filling database... " )
ruben = User ( " rubenwardy " )
2018-06-24 13:27:28 +02:00
ruben . active = True
ruben . password = make_flask_user_password ( " tuckfrump " )
2018-05-23 18:40:15 +02:00
ruben . github_username = " rubenwardy "
ruben . forums_username = " rubenwardy "
ruben . rank = UserRank . ADMIN
db . session . add ( ruben )
tags = { }
for tag in [ " Inventory " , " Mapgen " , " Building " , \
" Mobs and NPCs " , " Tools " , " Player effects " , \
" Environment " , " Transport " , " Maintenance " , " Plants and farming " , \
" PvP " , " PvE " , " Survival " , " Creative " , " Puzzle " , " Multiplayer " , " Singleplayer " ] :
row = Tag ( tag )
tags [ row . name ] = row
db . session . add ( row )
licenses = { }
for license in [ " GPLv2.1 " , " GPLv3 " , " LGPLv2.1 " , " LGPLv3 " , " AGPLv2.1 " , " AGPLv3 " ,
" Apache " , " BSD 3-Clause " , " BSD 2-Clause " , " CC0 " , " CC-BY-SA " ,
2018-05-29 22:24:50 +02:00
" CC-BY " , " MIT " , " ZLib " ] :
2018-05-23 18:40:15 +02:00
row = License ( license )
licenses [ row . name ] = row
db . session . add ( row )
2018-05-29 22:24:50 +02:00
for license in [ " CC-BY-NC-SA " ] :
row = License ( license , False )
licenses [ row . name ] = row
db . session . add ( row )
2018-05-23 18:40:15 +02:00
if test_data :
defineDummyData ( licenses , tags , ruben )
db . session . commit ( )