# HG changeset patch # User Wuzzy # Date 1531846494 -7200 # Node ID 278848d942bafb58faf2446dc7d0b225e1caf23f # Parent 26ce5d1ea7c1c3ae4069f6ac8e00fe77dc99ebb4 Add Achievements lib diff -r 26ce5d1ea7c1 -r 278848d942ba LuaLibraries.wiki --- a/LuaLibraries.wiki Tue Jul 17 13:32:36 2018 +0100 +++ b/LuaLibraries.wiki Tue Jul 17 18:54:54 2018 +0200 @@ -24,3 +24,4 @@ * [LuaLibraryTargetPractice TargetPractice] * [LuaLibrarySpeedShoppa SpeedShoppa] * [LuaLibrarySimpleMission SimpleMission] + * [LuaLibraryAchievements Achievements] diff -r 26ce5d1ea7c1 -r 278848d942ba LuaLibraryAchievements.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LuaLibraryAchievements.lua Tue Jul 17 18:54:54 2018 +0200 @@ -0,0 +1,21 @@ +#summary Lua library documentation of Achievements; contains assorted helper functions +#labels !LuaLibrary += Lua library: `Achievements` = +WARNING: The achievements system is still very bare bones. It might be subject to major changes in future. This library should only be used internally by Hedgewars at this point. + +This is simple library for awarding an achievement to the player, to be used in missions. They are not meant for multiplayer. + +An achievement in Hedgewars is a simple award given for doing something awesome or difficult in a mission, or winning a mission in a great way. +Achievements are a hidden feature in Hedgewars so far and far from complete. +One example achievement is “Lively Lifeguard” in the mission “That Sinking Feeling” for rescuing all hogs. + +== `awardAchievement(name, statText, capgrp)` == +Awards an achievement with name `name` to player. + +Currently, this only displays a caption and adds a mention in the stat screen. + +* `name`: Name of achievement. +* `statText`: Optional. If set as string, this text will be shown in the stats screen. If `nil`, a default text is used. +* `capgrp`: Optional. Caption group of `AddCaption` to be used. Default is `capgrpMessage2`. If `false`, no caption is shown. + +For consistent style, treat the name like a title is written in the English language. Good: “Naughty Ninja”. Bad: “naughty ninja”. diff -r 26ce5d1ea7c1 -r 278848d942ba TableOfContents.wiki --- a/TableOfContents.wiki Tue Jul 17 13:32:36 2018 +0100 +++ b/TableOfContents.wiki Tue Jul 17 18:54:54 2018 +0200 @@ -64,6 +64,7 @@ * [LuaLibraryTargetPractice TargetPractice] * [LuaLibrarySpeedShoppa SpeedShoppa] * [LuaLibrarySimpleMission SimpleMission] + * [LuaLibraryAchievements Achievements] * [LuaDrawing Drawing maps] * Quick Reference tables * [GearTypes Gear types]