diff --git a/README.md b/README.md index 282e624..979a559 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,81 @@ -# yl_template +# yl_cinema ## Purpose -This mod is not meant to bring functionality by itself, but to serve as a template you can base your mod on. +This mod allows staff or code to show movies to players. ## Download -Get it from https://gitea.your-land.de/your-land/yl_template +Get it from https://gitea.your-land.de/your-land/yl_cinema ## Installation -Being a template, you shouldn't install the mod itself. Your mod could look like this: +Copy the "yl_cinema" folder to your mod folder and enable it in your world.mt. +## Configuration +Find config in ./settingtypes.txt + +``` +yl_cinema.save_path = "yl_cinema_movies" +yl_cinema.admin_priv = "staff" +``` + +## Modmakers + +API: Call these function from your mod to show a movie to a player + +``` +success, msg, movielist = yl_cinema.listmovies(name, searchterm) +``` + +Parameters +* `name` : string. The name of the player the movielist will be shown to. +* `searchterm` : string or nil. An optional searchterm. If set, movielist will only contain the movies that have the searchterm in the title or description. + +Returns +* `success` : boolean. Is `true` if a movielist was returned. Is `false` if an error occurred +* `msg` : string. Errormessage if success is false, number of movies if success is `true` +* `movielist` : table of strings. Contains unordered list of `movie_id`s in the format `{"id1","id7","id27","id3"}`. May be empty `{}` if no movie was found. + +``` +success, msg = yl_cinema.showmovie(name, movie_id, target_player_name) +``` + +Parameters +* `name` : string. The name of the player who sends causes the movie be shown. +* `movie_id` : string. The movie ID that is means to be shown. +* `target_player_name` : string or nil. The name of the player the movie is shown to. + +Returns +* `success` : boolean. Is `true` if a movielist was returned. Is `false` if an error occurred +* `msg` : string. Errormessage if success is `false`, number of movies if success is `true` ## Usage + +There are two chatcommands to show players movies. + +* `showmovie ` : Shows to the the . + +* `listmovies []` : Shows the whole movielist to you. Filter the movielist with . + +## Create a movie + +Create a folder with the movie_id as name. Ask your admin which prefix, suffix or other markings are accepted. + +Inside the folder, create a JSON file with structure `{movie_id, name, description, title_texture, replay, [{order, texturename, caption, captionposx, captionposy, duration},{...}]}` + +Create a new folder inside the movie_id folder and name it textures. Place all the textures of your movie here. Please note, their filenames need to correspond to the `title_texture` and `texturename` from the pages. + +Copy the movie to your yl_cinema.save_path, by default "yl_cinema_movies" + ## Uninstall + +Remove it from your mod folder or deactivate it in your world.mt + +Mods that depend on it will cease to work, if the mod is removed without proper replacement. + ## License +MIT \ No newline at end of file