REPOSITORY WAS MOVED! UPDATE YOUR LOCAL REPO
New location: https://git.0x7be.net/dirk/mtimer New head: `main` instead of `master`
136
README.md
@ -1,136 +1,20 @@
|
|||||||
**_mTimer_ is a mod for showing ingame and reallife times and periods**
|
# This officially released Minetest mod was moved
|
||||||
|
|
||||||
## Description
|
The repository was moved away from GitLab. The new location can be found here:
|
||||||
|
|
||||||
*mTimer* is a mod that allows players to individually configure and show a timer as permanent HUD element that automatically updates every second. The timer can show the real-world time and the ingame time as well as the current play session starting time and duration in freely configurable formats.
|
* https://git.0x7be.net/dirk/mtimer
|
||||||
|
|
||||||
![HUD element](screenshots/hud_element.png)
|
Just set the new origin in your local copy of the repository.
|
||||||
|
|
||||||
Use it on your public server to give your players additional value (players can individually hide the timer if they want) while being on your server or use it in your singleplayer world to stay informed or – when creating creative content for others to watch – give your viewers a hint on when the footage was recorded.
|
Also make sure to change `master` branch to `main` branch. The `master` branch is no longer in use and was renamed.
|
||||||
|
|
||||||
The mod is game-agnostic and does not have any dependencies. The mod only interfaces with Minetest’s *HUD API*, the *player meta data API* and the *Formspec API*.
|
## Mod in Content Database
|
||||||
|
|
||||||
## Configuration
|
If you use the [Minetest content database][cdb] just wait for the update to show up in the client or manually check for updates. The CDB link and package name stay the same.
|
||||||
|
|
||||||
The timer display and settings are entirely configured on a per-player basis via configuration dialogs. Configurations are set when leaving the dialog via the buttons or when pressing enter or clicking the apply button (where available). Pressing the escape key cancels the changes.
|
* https://content.minetest.net/packages/Linuxdirk/mtimer/
|
||||||
|
|
||||||
For opening the main menu simply enter the `/mtimer` chat command. From the main menu all configuration dialogs are accessible.
|
The move only affects Git pulls form the repository.
|
||||||
|
|
||||||
![Main Menu](screenshots/main_menu.png)
|
|
||||||
|
|
||||||
Simply click the button of the option you want to configure.
|
[cdb]: https://content.minetest.net
|
||||||
|
|
||||||
Configuration dialogs can be accessed directly by providing the respective parameter to the `/mtimer` chat command. Run `/mtimer help` to see a list of available parameters. You might need to bring up the console (F10 by default) to see all available parameters because the chat display might be too small.
|
|
||||||
|
|
||||||
### Variables
|
|
||||||
|
|
||||||
Some dialogs allow you to use variables. The variables and their current (i.e. the moment when opening the dialog) values are shown below the input field.
|
|
||||||
|
|
||||||
![Real-World Time Format](screenshots/real_world_time_format.png)
|
|
||||||
|
|
||||||
Simply use the variables as shown. For example, to use the day name in the dialog shown above simply enter `{dname}`. Using unknown variables is possible. Those variables are rendered literally. So Entering `{foobar}` renders to “{foobar}” in the output.
|
|
||||||
|
|
||||||
Using a string being a variable is not possible (`{foobar}` will always render to it’s value if it is a valid variable) but using the same variable multiple times is possible.
|
|
||||||
|
|
||||||
### Confirmations
|
|
||||||
|
|
||||||
Pressing enter in an input field applies the changes. Not all dialogs have input fields. Sometimes there only schemes or just buttons.
|
|
||||||
|
|
||||||
Using those dialogs is the same except setting things works instantly. So by clicking the bottom right on the scheme in the dialog below directly places the timer there.
|
|
||||||
|
|
||||||
![Position](screenshots/position.png)
|
|
||||||
|
|
||||||
Where needed, apply buttons are placed. So instead of having to leave the dialog via the navigation buttons at the bottom to apply the changes simply click the apply button to have the value applied.
|
|
||||||
|
|
||||||
![Timer Format](screenshots/timer_format.png)
|
|
||||||
|
|
||||||
In the timer format configuration dialog shown above a text area is used where pressing enter goes to a new line so a button for applying the changes is shown.
|
|
||||||
|
|
||||||
## Custom Timer
|
|
||||||
|
|
||||||
mTimer comes with a freely configurable custom timer that can run in three different modes and shows its current state and time as applicable. The formats for the three states can be configured individually.
|
|
||||||
|
|
||||||
The four time input fields on the middle left are used for days, hours, minutes, and seconds and the table with the variables shows the set value and not the current value because the current value changes depending on the timer state and mode.
|
|
||||||
|
|
||||||
![Custom Timer](screenshots/custom_timer.png)
|
|
||||||
|
|
||||||
In *Countdown* mode the custom timer counts down from the time that was set using the time input fields. In *Timer* mode the custom timer counts up to the value that was set. And in *Continuous Run* mode the custom timer counts up from when it was started, adding the time that was set to the starting point calculation.
|
|
||||||
|
|
||||||
After the custom timer was set up it needs to be started. Starting (as well as stopping or restarting) it is done using the defined chat commands.
|
|
||||||
|
|
||||||
```
|
|
||||||
/mtimer ctstart -- Start the timer if not running
|
|
||||||
/mtimer ctstop -- Stop the timer if running
|
|
||||||
/mtimer ctrestart -- Restart the timer if running
|
|
||||||
```
|
|
||||||
|
|
||||||
If the custom timer finished the format changes to the “finished” value. Please note that the timer is still running if this message is shown. To stop the timer you need to invoke the corresponding chat command. Only if the “stopped” format is used the timer is actually stopped (i.e. most of it’s logic isn’t running).
|
|
||||||
|
|
||||||
## Default configuration (interesting for server admins)
|
|
||||||
|
|
||||||
The default configuration is loaded on server start and applied when a new player joins or an already existing player sets any (or all) of the mTimer values to the default value via the main menu or one of the specific dialog formspecs.
|
|
||||||
|
|
||||||
The mod tries to load the configuration from least to most mod specific locations:
|
|
||||||
|
|
||||||
1. Default `minetest.conf` that is used to load the server
|
|
||||||
2. From `_mtimer.conf` in the served world’s directory
|
|
||||||
3. Built-in default setting defined by the mod’s author
|
|
||||||
|
|
||||||
There is intentionally no `settingtypes.txt` because the mod is meant to be configured by the individual players. The following options can be set in either `1.` or `2.` without changing the mod’s code. After that a server restart is necessary.
|
|
||||||
|
|
||||||
```ini
|
|
||||||
mtimer_color = #ffffff
|
|
||||||
mtimer_hud_element_scale = 1
|
|
||||||
mtimer_position = bl
|
|
||||||
mtimer_timezone_offset = 0
|
|
||||||
mtimer_visible = true
|
|
||||||
|
|
||||||
mtimer_hud_element_offset_x = 0
|
|
||||||
mtimer_hud_element_offset_y = 0
|
|
||||||
|
|
||||||
mtimer_host_time_format = {24h}:{min} ({isodate})
|
|
||||||
mtimer_ingame_time_format = {24h}:{min}
|
|
||||||
mtimer_real_time_format = {24h}:{min} ({isodate})
|
|
||||||
mtimer_session_duration_format = {hours}:{minutes}
|
|
||||||
mtimer_session_start_time_format = {isodate}T{isotime}
|
|
||||||
mtimer_timer_format = S('Current Date: @1', '{rd}'){_n}S('Ingame Time: @1', '{it}'){_n}S('Session Start: @1', '{st}'){_n}S('Session Duration: @1', '{sd}')
|
|
||||||
|
|
||||||
mtimer_custom_timer_running_format = d: {days}, h: {hours}, m: {minutes}, s: {seconds}
|
|
||||||
mtimer_custom_timer_stopped_format = S('The timer is stopped')
|
|
||||||
mtimer_custom_timer_finished_format = S('The timer has finished')
|
|
||||||
|
|
||||||
mtimer_custom_timer_value_days = 0
|
|
||||||
mtimer_custom_timer_value_hours = 0
|
|
||||||
mtimer_custom_timer_value_minutes = 0
|
|
||||||
mtimer_custom_timer_value_seconds = 0
|
|
||||||
|
|
||||||
mtimer_custom_timer_mode = countdown
|
|
||||||
```
|
|
||||||
|
|
||||||
The `mtimer_timer_format` value allows a special replacement variable. All occurrences of a literal `{_n}` will be replaced with a newline. This is done because configuration values cannot have a newline. All `S()` values are translated. Unfortunately currently you cannot set translatable string in configuration options.
|
|
||||||
|
|
||||||
## Known issues
|
|
||||||
|
|
||||||
### Formspecs look weird
|
|
||||||
|
|
||||||
On very small screens the configuration dialogs might look very crammed with text being cut off or overlaying other text. This is due to how formspecs work and is not fixable without massive Minetest engine changes.
|
|
||||||
|
|
||||||
Same in the other direction: On very large screens the dialogs seem unnecessary huge with much empty space. Same here: This is not fixable without re-implementing formspec generation from scratch in Minetest.
|
|
||||||
|
|
||||||
mTimer was tested with resolutions from 1024×768 up to 2560×1440 with 20px font and GUI scaling of 1.5. Since different font sizes and GUI scaling are somewhat broken in Minetest when it comes to formspecs the later was usable but did not look that good.
|
|
||||||
|
|
||||||
### Dialog language does not match dame language
|
|
||||||
|
|
||||||
Simple: The mod was not translated to the language you’re using. Feel free to translate it and file a pull request. I’d be happy to merge it.
|
|
||||||
|
|
||||||
Currently German (`language = de` in `minetest.conf`) and Italian (`language = it`) are supported as translation language and English being the default and Italian being slightly out of date.
|
|
||||||
|
|
||||||
### HUD element scale slider does not reset
|
|
||||||
|
|
||||||
The slider dialog is created using a formspec scroll bar element. For some reason it seems not to be possible to properly reload the formspec programmatically so the actual value is used.
|
|
||||||
|
|
||||||
Currently there is nothing that can be done in order to instantly reset the formspec as needed to reflect the state of the dialog after the value was reset to default. The HUD element itself is reset and when re-opening the HUD element scale dialog the correct value is shown again.
|
|
||||||
|
|
||||||
### When unchecking the custom timer type nothing is enabled
|
|
||||||
|
|
||||||
This is a visual glitch. The timer operates in the last selected mode. The checkmark re-appears when closing and re-opening the custom timer dialog.
|
|
||||||
|
38
init.lua
@ -1,38 +0,0 @@
|
|||||||
local modpath = minetest.get_modpath('mtimer')..DIR_DELIM
|
|
||||||
local syspath = modpath..'system'..DIR_DELIM
|
|
||||||
local fspath = syspath..'formspecs'..DIR_DELIM
|
|
||||||
|
|
||||||
|
|
||||||
-- Set initial global `mtimer` table
|
|
||||||
--
|
|
||||||
-- The sub tables are filesd programmatically.
|
|
||||||
--
|
|
||||||
-- @see ./system/formspecs/*
|
|
||||||
-- @see ./system/load_configuration.lua
|
|
||||||
mtimer = {
|
|
||||||
translator = minetest.get_translator('mtimer'),
|
|
||||||
dialog = {},
|
|
||||||
meta = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-- Load configuration
|
|
||||||
dofile(syspath..'load_configuration.lua')
|
|
||||||
|
|
||||||
|
|
||||||
-- Load formspec-related files
|
|
||||||
dofile(syspath..'formspec_helpers.lua')
|
|
||||||
dofile(syspath..'on_receive_fields.lua')
|
|
||||||
for _,f in pairs(minetest.get_dir_list(fspath, false)) do dofile(fspath..f) end
|
|
||||||
|
|
||||||
|
|
||||||
-- Load timer actions
|
|
||||||
dofile(syspath..'get_times.lua')
|
|
||||||
dofile(syspath..'get_timer_data.lua')
|
|
||||||
dofile(syspath..'update_timer.lua')
|
|
||||||
|
|
||||||
|
|
||||||
-- Load player-related functionality
|
|
||||||
dofile(syspath..'chat_command.lua')
|
|
||||||
dofile(syspath..'on_joinplayer.lua')
|
|
||||||
dofile(syspath..'register_globalstep.lua')
|
|
674
license.txt
@ -1,674 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -1,209 +0,0 @@
|
|||||||
# textdomain: mtimer
|
|
||||||
|
|
||||||
|
|
||||||
# mTimer Configuration Names
|
|
||||||
Open Main Menu=Hauptmenü öffnen
|
|
||||||
mTimer Configuration=mTimer-Konfiguration
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Visibility
|
|
||||||
Visibility=Sichtbarkeit
|
|
||||||
Make invisible=Verbergen
|
|
||||||
Make visible=Anzeigen
|
|
||||||
The timer is currently @1.=Der Timer ist aktuell @1.
|
|
||||||
visible=sichtbar
|
|
||||||
invisible=verborgen
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Position
|
|
||||||
Position=Ausrichtung
|
|
||||||
Click the position you want to place the timer at.=Auf die Stelle klicken, an der der Timer angezeigt werden soll.
|
|
||||||
Current position: @1=Aktuelle Position: @1
|
|
||||||
top=Oben
|
|
||||||
middle=mittig
|
|
||||||
bottom=Unten
|
|
||||||
left=links
|
|
||||||
center=zentriert
|
|
||||||
right=rechts
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Color
|
|
||||||
Color=Farbe
|
|
||||||
Current color: @1=Aktuelle Farbe: @1
|
|
||||||
Use `@1` format only!=Ausschließlich `@1`-Format benutzen!
|
|
||||||
Set a predefined color=Eine vordefinierte Farbe einstellen
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: HUD Element Scale
|
|
||||||
HUD Element Scale=Anzeigeskalierung
|
|
||||||
The HUD element can be scaled between 1x (original size) and 10x (largest size due to performance reasons). Use the slider above to adjust the scaling to your needs.=Die Anzeige kann über den oben vorhandenen Schieberegler zwischen 1x (Originalgröße) und 10x (die aus Leistungsgründen die größte Größe) skaliert werden.
|
|
||||||
Due to technical reasons the slider position does not reset when clicking the button to set to default values. The HUD element itself resets, and when re-entering this dialog the slider position is properly set.=Aus technischen Gründen wird die Position des Schiebereglers beim einstellen der Standardwerte nicht zurückgesetzt, die Anzeige selbst wird aber zurückgesetzt. Beim erneuten öffnen des Dialogs wird der Schieberegler automatisch angepasst.
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: HUD Element Offset
|
|
||||||
HUD Element Offset=Anzeigeversatz
|
|
||||||
Vertical=Vertikal
|
|
||||||
Horizontal=Horizontal
|
|
||||||
Control the HUD element offset using the input on the right side and use the screenshot and markings as orientation for what is changed. The result is shown in the HUD in real time, so check for the actual timner position using the timer HUD element itself.=Anzeigeversatz des HUD-Elements über die Eingaben an der rechten Seite konfigurieren und dafür die Markierungen zur Orientierung verwenden. Das Ergebnis wir direkt übernommen. Die getätigen Änderungen können anhand des HUD-Elements sofort überprüft werden.
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Ingame Time
|
|
||||||
Ingame Time Format=Spielzeit-Format
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Real-World Time Format
|
|
||||||
Real-World Time Format=Realzeit-Format
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Session Start Time Format
|
|
||||||
Session Start Time Format=Sitzungsstartzeit-Format
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Session Duration Format
|
|
||||||
Session Duration Format=Sitzungsdauer-Format
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Host Time Format
|
|
||||||
Host Time Format=Hostzeit-Format
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Timer Format
|
|
||||||
Timer Format=Timerformat
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Timezone Offset
|
|
||||||
Timezone Offset=Zeitzonenunterschied
|
|
||||||
set a value between -12 and +12 hours=einen Wert zwischen -12 und +12 Stunden setzen
|
|
||||||
Set timezone offset to @1=Zeitzonenunterschied auf @1 setzen
|
|
||||||
Current server time: @1=Aktuelle Serverseitige Zeit: @1
|
|
||||||
Calculated local time: @1=Errechnete lokale Zeit: @1
|
|
||||||
Please note that daylight saving time (DST) is ignored entirely due to minimizing implementation complexity. You need to manually adjust the time zone in order to adapt to any DST changes. This messes up the visual representation a bit (but it’s not very accurate anyways …).=Die Sommerzeit wird aus Gründen der Komplexität der Implementierung vollständig ignoriert. Um der Sommerzeit Rechnung zu tragen muss die Zeitzone angepasst werden. Dies bringt zwar die grafische Darstellung durcheinander, aber die ist eh nicht ganz genau.
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Custom Timer
|
|
||||||
Custom Timer=Individueller Timer
|
|
||||||
Running=Timer läuft
|
|
||||||
Stopped=Angehalten
|
|
||||||
Finished=Abgeschlossen
|
|
||||||
Countdown=Countdown
|
|
||||||
Timer Mode=Zielzeit
|
|
||||||
Continuous Run=Dauerlauf
|
|
||||||
Used Value=Benutzter Wert
|
|
||||||
As configured=Wie konfiguriert
|
|
||||||
The timer is stopped=Der Timer ist angehalten
|
|
||||||
The timer has finished=Der Timer hat sein Ziel erreicht
|
|
||||||
Configure the custom timer=Individuellen Timer konfigurieren
|
|
||||||
Start the custom timer=Individuellen Timer starten
|
|
||||||
Stop stop custom timer=Individuellen Timer anhalten
|
|
||||||
Restart the custom timer=Individuellen Timer neu starten
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog: Reset Everything (also messages)
|
|
||||||
Reset Everything=Alles zurücksetzen
|
|
||||||
Soft-reset all values to their defaults=Alle Werte auf die definierten Standards setzen
|
|
||||||
Request hard-reset (kicks you from the server!)=Löschen anfordern (führt einen Kick vom Server aus!)
|
|
||||||
All configuration was reset. Server time of the requested: @1=Alle Konfiguration wurde zurückgesetzt. Serverzeit der Anfrage: @1
|
|
||||||
You requested a hard reset of the mTimer configuration. This request was stored. As described, you were kicked from the server in order to have the hard reset performed. Please rejoin the server. On rejoin all previously stored configuration regarding mTimer will be deleted.=Ein hartes Zurücksetzen der mTimer-Konfiguration wurde angefordert. Die Anfrage wurde gespeichert. Wie beschrieben wurde ein Kick vom Server ausgeführt. Um das harte Zurücksetzen der Konfiguration abzuschließen ist ein Neuverbinden zum Server erforderlich. Dabei wird die gesamte mTimer-bezogene Konfiguration entfernt.
|
|
||||||
Cancel reset and return to main menu=Zurücksetzen abbrechen und zurück zum Hauptmenü
|
|
||||||
For resetting the configuration you have two options.=Für das zurücksetzen der Konfiguration bestehen zwei Optionen.
|
|
||||||
Usually using a soft reset is enough. The soft reset sets all values based on mTimer functionality to the default values while staying connected.=Üblicher weise reicht ein sanftes Zurücksetzen. Dies setzt direkt alle Werte mittels mTimer-Funktionen auf die entsprecheden Standardwerte.
|
|
||||||
If the soft reset does not work you can hard reset the configuration. This stores a request and then kicks you from the server. On rejoining mTimer forcefully removes all stored configuration and sets the current default values.=Sollte dies nicht funktionieren kann ein hartes Zurücksetzen angefordert werden. Es wird ein entsprechender Eintrag gesetzt und eine Trennung vom Server ausgeführt. Beim Neuverbinden wird zwangsweise die Standardkonfiguration geladen.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Default custom timer status messages
|
|
||||||
The custom timer is already running=Der individuelle Timer läuft bereits
|
|
||||||
The custom timer is not running=Der individuelle Timer läuft nicht
|
|
||||||
The custom timer was started=Der individuelle Timer wurde gestartet
|
|
||||||
The custom timer was stopped=Der individuelle Timer wurde angehalten
|
|
||||||
The custom timer was restarted=Der individuelle timer wurde neu gestartet
|
|
||||||
|
|
||||||
|
|
||||||
# Custom Timer Controls
|
|
||||||
The timer is currently @1=Der Timer ist aktuell @1
|
|
||||||
running=aktiv
|
|
||||||
stopped=angehalten
|
|
||||||
Start=Starten
|
|
||||||
Stop=Anhalten
|
|
||||||
Restart=Neustart
|
|
||||||
|
|
||||||
|
|
||||||
# Named Times
|
|
||||||
ISO 8601 Date=Datum nach ISO 8601
|
|
||||||
ISO 8601 Time=Zeit nach ISO 8601
|
|
||||||
Ingame Timestamp=Spielzeitstempel
|
|
||||||
Local Time: @1=Lokale Zeit: @1
|
|
||||||
Server Time: @1=Serverzeit: @1
|
|
||||||
Timestamp=Zeitstempel
|
|
||||||
|
|
||||||
|
|
||||||
# Named Time Parts
|
|
||||||
Day Name=Tagesname
|
|
||||||
Day=Tag
|
|
||||||
Days=Tage
|
|
||||||
Hours (12h)=12-Stunden-Stunde
|
|
||||||
Hours (24h)=24-Stunden-Stunde
|
|
||||||
Hours=Stunden
|
|
||||||
Minutes=Minuten
|
|
||||||
Month Name=Monatsname
|
|
||||||
Month=Monat
|
|
||||||
Seconds=Sekunden
|
|
||||||
Year=Jahr
|
|
||||||
|
|
||||||
|
|
||||||
# Timer Format Variables
|
|
||||||
In-Game Time=Spielzeit
|
|
||||||
Real-World Date=Reale Zeit
|
|
||||||
Session Duration=Sitzungsdauer
|
|
||||||
Session Start Time=Sitzungsstart-Zeit
|
|
||||||
Host Time=Hostzeit
|
|
||||||
|
|
||||||
|
|
||||||
# Default Timer Format
|
|
||||||
Current Date: @1=Aktuelles Datum: @1
|
|
||||||
Ingame Time: @1=Spielzeit: @1
|
|
||||||
Session Duration: @1=Sitzungsdauer: @1
|
|
||||||
Session Start: @1=Sitzungsstart: @1
|
|
||||||
Custom Timer: @1=Individueller Timer: @1
|
|
||||||
|
|
||||||
|
|
||||||
# Dialog Buttons generic terms
|
|
||||||
Apply=Anwenden
|
|
||||||
Current Result=Aktuelles Ergebnis
|
|
||||||
Current Value=Aktueller Wert
|
|
||||||
Default=Standard
|
|
||||||
Exit=Verlassen
|
|
||||||
Main Menu=Hauptmenü
|
|
||||||
Variable=Variable
|
|
||||||
|
|
||||||
|
|
||||||
# Weekdays
|
|
||||||
Monday=Montag
|
|
||||||
Tuesday=Dienstag
|
|
||||||
Wednesday=Mittwoch
|
|
||||||
Thursday=Donnerstag
|
|
||||||
Friday=Freitag
|
|
||||||
Saturday=Samstag
|
|
||||||
Sunday=Sonntag
|
|
||||||
|
|
||||||
|
|
||||||
# Months
|
|
||||||
January=Januar
|
|
||||||
February=Februar
|
|
||||||
March=März
|
|
||||||
April=April
|
|
||||||
May=Mai
|
|
||||||
June=Juni
|
|
||||||
July=Juli
|
|
||||||
August=Auggust
|
|
||||||
September=September
|
|
||||||
October=Oktober
|
|
||||||
November=November
|
|
||||||
December=Dezember
|
|
||||||
|
|
||||||
|
|
||||||
# Related to the meridiem indicator
|
|
||||||
Meridiem Indicator=Tageshälftenhinweis
|
|
||||||
am=vorm.
|
|
||||||
pm=nachm.
|
|
||||||
(ERROR)=(FEHLER)
|
|
@ -1,90 +0,0 @@
|
|||||||
# textdomain: mtimer
|
|
||||||
|
|
||||||
# mTimer configuration section names
|
|
||||||
Color=Colore
|
|
||||||
Ingame Time Format=Orario nel gioco
|
|
||||||
Open Main Menu=Menu princ.
|
|
||||||
Position=Posizione
|
|
||||||
Real-World Time Format=Orario reale
|
|
||||||
Reset Everything=Reimp. tutto
|
|
||||||
Session Duration Format=Durata della sess.
|
|
||||||
Session Start Time Format=Orario inizio sess.
|
|
||||||
Timer Format=Cronometro
|
|
||||||
Timezone Offset=Fascia oraria
|
|
||||||
Visibility=Visibilità
|
|
||||||
mTimer Configuration=mTimer-Configurazione
|
|
||||||
|
|
||||||
# Settings
|
|
||||||
Visible=Visibile
|
|
||||||
Invisible=Invisibile
|
|
||||||
|
|
||||||
# Information & Warnings
|
|
||||||
30 minutes @= 0.5, 60 minutes @= 1=30 minuti @= 0.5, 60 minuti @= 1
|
|
||||||
Click the position you want to place the timer at.=Cliccate il punto in cui volete posizionare il cronometro.
|
|
||||||
Use `@1` format only!=Utilizzate solo il formato "@1"!
|
|
||||||
“Arbitrary” values are possible.=Sono possibili valori "arbitrari".
|
|
||||||
|
|
||||||
# Named Times
|
|
||||||
ISO 8601 Date=Data ISO 8601
|
|
||||||
ISO 8601 Time=Orario ISO 8601
|
|
||||||
Ingame Timestamp=Timestamp gioco
|
|
||||||
Local Time: @1=Orario locale: @1
|
|
||||||
Server Time: @1=Orario del server: @1
|
|
||||||
Timestamp=Timestamp
|
|
||||||
|
|
||||||
# Named Time Parts
|
|
||||||
Day Name=Nome del giorno
|
|
||||||
Day=Giorno
|
|
||||||
Days=Giorni
|
|
||||||
Hours (12h)=Formato 12 ore
|
|
||||||
Hours (24h)=Formato 24 ore
|
|
||||||
Hours=Ore
|
|
||||||
Minutes=Minuti
|
|
||||||
Month Name=Nome del mese
|
|
||||||
Month=Mese
|
|
||||||
Seconds=Secondi
|
|
||||||
Year=Anno
|
|
||||||
|
|
||||||
# Timer Variables
|
|
||||||
In-Game Time=Orario nel gioco
|
|
||||||
Real-World Date=Data reale
|
|
||||||
Session Duration=Durata sessione
|
|
||||||
Session Start Time=Inizio sessione
|
|
||||||
|
|
||||||
# Timer default format
|
|
||||||
Current Date: @1=Data attuale: @1
|
|
||||||
Ingame Time: @1=Orario nel gioco: @1
|
|
||||||
Session Duration: @1=Durata della sessione: @1
|
|
||||||
Session Start: @1=Inizio della sessione: @1
|
|
||||||
|
|
||||||
# Generic Formspec Strings
|
|
||||||
Apply=Applicare
|
|
||||||
Current Result=Risultato attuale
|
|
||||||
Current Value=Valore attuale
|
|
||||||
Default=Predefinito
|
|
||||||
Exit=Uscire
|
|
||||||
Main Menu=Menu princ.
|
|
||||||
Variable=Variabile
|
|
||||||
|
|
||||||
# Timer Weekdays
|
|
||||||
Monday=Lunedì
|
|
||||||
Tuesday=Martedì
|
|
||||||
Wednesday=Mercoledì
|
|
||||||
Thursday=Giovedì
|
|
||||||
Friday=Venerdì
|
|
||||||
Saturday=Sabato
|
|
||||||
Sunday=Domenica
|
|
||||||
|
|
||||||
# Timer Months
|
|
||||||
January=gennaio
|
|
||||||
February=febbraio
|
|
||||||
March=marzo
|
|
||||||
April=aprile
|
|
||||||
May=maggio
|
|
||||||
June=giugno
|
|
||||||
July=luglio
|
|
||||||
August=agosto
|
|
||||||
September=settembre
|
|
||||||
October=ottobre
|
|
||||||
November=novembre
|
|
||||||
December=dicembre
|
|
3
mod.conf
@ -1,3 +0,0 @@
|
|||||||
name = mtimer
|
|
||||||
title = mTimer
|
|
||||||
description = Ingame timer for showing current playtime, current day time, ingame time, etc.
|
|
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 320 KiB |
Before Width: | Height: | Size: 121 KiB |
Before Width: | Height: | Size: 83 KiB |
@ -1,98 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local d = m.dialog
|
|
||||||
|
|
||||||
|
|
||||||
-- Colorize a command sequence
|
|
||||||
--
|
|
||||||
-- This function returns a colorized chat command sequence with the given
|
|
||||||
-- parameter and the needed spacing
|
|
||||||
--
|
|
||||||
-- @param command The chat command paramter
|
|
||||||
-- @return table The colorized string
|
|
||||||
local command = function (command)
|
|
||||||
return minetest.colorize('cyan', '/mtimer '..command..' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Chat command
|
|
||||||
--
|
|
||||||
-- The `/mtimer` chat command opens the main menu and allows to directly open
|
|
||||||
-- the formspecs for the specific configuration. It can be run by all users.
|
|
||||||
--
|
|
||||||
-- The following parameters are supported.
|
|
||||||
--
|
|
||||||
-- Parameter Mnemonic Action
|
|
||||||
-- -------------------------------------------------------------------
|
|
||||||
-- vi visibility d.set_visibility(name)
|
|
||||||
-- po position d.set_position(name)
|
|
||||||
-- co color d.sec_color(name)
|
|
||||||
-- tz timezone d.timezone_offset(name)
|
|
||||||
-- in ingame d.ingame_time_format(name)
|
|
||||||
-- re real d.real_world_time_format(name)
|
|
||||||
-- ht host time d.host_time_format(name)
|
|
||||||
-- st start time d.session_start_time_format(name)
|
|
||||||
-- sd session duration d.session_duration_format(name)
|
|
||||||
-- hs HUD element scale d.hud_element_scale(name)
|
|
||||||
-- os OffSet d.hud_element_offset(name)
|
|
||||||
-- tf timer format d.timer_format(name)
|
|
||||||
-- ct custom timer d.custom_timer(name)
|
|
||||||
-- re reset everything d.reset_everything(name)
|
|
||||||
-- -------------------------------------------------------------------
|
|
||||||
-- help Prints the help output showing the parameters
|
|
||||||
--
|
|
||||||
-- Providing unknown parameters has no effect.
|
|
||||||
minetest.register_chatcommand('mtimer', {
|
|
||||||
description = S('Configure timer display'),
|
|
||||||
params = '<vi/po/co/tz/in/re/ht/st/sd/hs/os/tf/ct/re/help>',
|
|
||||||
func = function(name, parameters)
|
|
||||||
local action = parameters:match('%a+')
|
|
||||||
|
|
||||||
if not minetest.get_player_by_name(name) then return end
|
|
||||||
if not action then d.main_menu(name) end
|
|
||||||
|
|
||||||
if action == 'vi' then d.set_visibility(name) end
|
|
||||||
if action == 'po' then d.set_position(name) end
|
|
||||||
if action == 'co' then d.set_color(name) end
|
|
||||||
if action == 'tz' then d.timezone_offset(name) end
|
|
||||||
if action == 'in' then d.ingame_time_format(name) end
|
|
||||||
if action == 're' then d.real_world_time_format(name) end
|
|
||||||
if action == 'ht' then d.host_time_format(name) end
|
|
||||||
if action == 'st' then d.session_start_time_format(name) end
|
|
||||||
if action == 'sd' then d.session_duration_format(name) end
|
|
||||||
if action == 'hs' then d.hud_element_scale(name) end
|
|
||||||
if action == 'os' then d.hud_element_offset(name) end
|
|
||||||
if action == 'tf' then d.timer_format(name) end
|
|
||||||
if action == 'ct' then d.custom_timer(name) end
|
|
||||||
if action == 're' then d.reset_everything(name) end
|
|
||||||
|
|
||||||
if action == 'ctstart' then mtimer.update_custom_timer(name, { action = 'start' }) end
|
|
||||||
if action == 'ctstop' then mtimer.update_custom_timer(name, { action = 'stop' }) end
|
|
||||||
if action == 'ctrestart' then mtimer.update_custom_timer(name, { action = 'restart' }) end
|
|
||||||
|
|
||||||
if action == 'help' then
|
|
||||||
local message = {
|
|
||||||
command(' ')..S('Open Main Menu'),
|
|
||||||
command('vi')..S('Visibility'),
|
|
||||||
command('po')..S('Position'),
|
|
||||||
command('co')..S('Color'),
|
|
||||||
command('tz')..S('Timezone Offset'),
|
|
||||||
command('in')..S('Ingame Time Format'),
|
|
||||||
command('re')..S('Real-World Time Format'),
|
|
||||||
command('ht')..S('Host Time Format'),
|
|
||||||
command('st')..S('Session Start Time Format'),
|
|
||||||
command('sd')..S('Session Duration Format'),
|
|
||||||
command('hs')..S('HUD Element Scale'),
|
|
||||||
command('os')..S('HUD Element Offset'),
|
|
||||||
command('tf')..S('Timer Format'),
|
|
||||||
command('re')..S('Reset Everything'),
|
|
||||||
'',
|
|
||||||
command('ct ')..S('Configure the custom timer'),
|
|
||||||
command('ctstart ')..S('Start the custom timer'),
|
|
||||||
command('ctstop ')..S('Stop stop custom timer'),
|
|
||||||
command('ctrestart')..S('Restart the custom timer')
|
|
||||||
}
|
|
||||||
minetest.chat_send_player(name, table.concat(message, '\n'))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
@ -1,273 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
|
|
||||||
|
|
||||||
-- Get a table line
|
|
||||||
--
|
|
||||||
-- The index determines the position from top within the current container and
|
|
||||||
-- is calculated to display the string in the correct position.
|
|
||||||
--
|
|
||||||
-- If `name` is a literal `'-'` then a line is printed at the position.
|
|
||||||
--
|
|
||||||
-- @param index The numerical index for the line
|
|
||||||
-- @param name Human-readable name for the variable
|
|
||||||
-- @param variable The variable like it’s used in the definition
|
|
||||||
-- @param value The value to show for that variable
|
|
||||||
-- @return string The created formspec string
|
|
||||||
mtimer.get_table_line = function (index, name, variable, value)
|
|
||||||
local position = ((index-1) * 0.4)
|
|
||||||
|
|
||||||
if name == '-' then
|
|
||||||
return 'box[0,'..position..';+contentWidth,0.02;#ffffff]'
|
|
||||||
end
|
|
||||||
|
|
||||||
return table.concat({
|
|
||||||
'label[0,'..position..';'..name..']',
|
|
||||||
'label[4,'..position..';'..variable..']',
|
|
||||||
'label[7,'..position..';'..value..']'
|
|
||||||
}, ' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Get a button with icon
|
|
||||||
--
|
|
||||||
-- This function returns a fully formatted button with icon.
|
|
||||||
--
|
|
||||||
-- The provided ID is set as the button’s ID as well as the button’s image.
|
|
||||||
-- When set as image all colons are replaced with underscores and the id then
|
|
||||||
-- is formatted: `mtimer_ID.png` where `ID` is the given ID.
|
|
||||||
--
|
|
||||||
-- The definition table sets up the button’s parameters and is fully optional
|
|
||||||
-- even if it makes no sense.
|
|
||||||
--
|
|
||||||
-- definition = {
|
|
||||||
-- label = 'My Cool Button label' or '',
|
|
||||||
-- width = 5, or 3,
|
|
||||||
-- image_size = 1, or 0.5,
|
|
||||||
-- colorize = color_table or { use = false },
|
|
||||||
-- container = { left = 1, top = 1} or pos_container
|
|
||||||
-- exit_button = true or false
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- The container table is used to position the button. If the `container` sub
|
|
||||||
-- table is unset, the following table is used, causing the button to be in the
|
|
||||||
-- top left corner of the formspec if not contained in another container.
|
|
||||||
--
|
|
||||||
-- pos_container = {
|
|
||||||
-- left = 0,
|
|
||||||
-- top = 0
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- Via the `colorize` sub-table it is possible to add colorization to the icon
|
|
||||||
-- shown oin the button. The table contains two entries to define the color and
|
|
||||||
-- the ratio for applying the color.
|
|
||||||
--
|
|
||||||
-- color_table = {
|
|
||||||
-- color = '#729fcf',
|
|
||||||
-- ratio = 200
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- If one of the values is omitted the value shown in the example is used.
|
|
||||||
--
|
|
||||||
-- @param id The ID for the button
|
|
||||||
-- @param definition The definition table as described
|
|
||||||
-- @return string The created button as formspec code
|
|
||||||
mtimer.get_icon_button = function (id, definition)
|
|
||||||
local def = definition or {}
|
|
||||||
|
|
||||||
-- Define colorization of button texture
|
|
||||||
local t_table = type(def.colorize) == 'table'
|
|
||||||
local t_values = t_table and def.colorize or { use = false }
|
|
||||||
local t_color = t_values.color or '#729fcf'
|
|
||||||
local t_ratio = t_values.ratio or 200
|
|
||||||
local t_colorize = '^[colorize:'..t_color..':'..t_ratio
|
|
||||||
|
|
||||||
-- Set button defaults
|
|
||||||
local b_width = def.width or 3
|
|
||||||
local i_size = def.image_size or 0.5
|
|
||||||
local c_left = (def.container or {}).left or 0
|
|
||||||
local c_top = (def.container or {}).top or 0
|
|
||||||
|
|
||||||
-- Calculate button parameters
|
|
||||||
local b_padding = i_size / 4
|
|
||||||
local b_height = (b_padding * 2) + i_size
|
|
||||||
local l_top_pos = i_size / 2
|
|
||||||
local l_left_pos = i_size + (i_size / 4)
|
|
||||||
|
|
||||||
-- Create/Return the button
|
|
||||||
return (table.concat({
|
|
||||||
'container[+containerLeft,+containerTop]',
|
|
||||||
' container[+buttonPadding,+buttonPadding]',
|
|
||||||
' image[0,0;+imageSize,+imageSize;+icon+colorize]',
|
|
||||||
' label[+labelLeftPos,+labelTopPos;+label]',
|
|
||||||
' container_end[]',
|
|
||||||
' +buttonType[0,0;+buttonWidth,+buttonHeight;+id;]',
|
|
||||||
'container_end[]'
|
|
||||||
}, ' '):gsub('%+%w+', {
|
|
||||||
['+containerLeft'] = c_left,
|
|
||||||
['+containerTop'] = c_top,
|
|
||||||
['+buttonType'] = def.exit_button==true and 'button_exit' or 'button',
|
|
||||||
['+buttonWidth'] = b_width,
|
|
||||||
['+buttonHeight'] = b_height,
|
|
||||||
['+buttonPadding'] = b_padding,
|
|
||||||
['+imageSize'] = i_size,
|
|
||||||
['+icon'] = 'mtimer_'..id:gsub(':', '_')..'.png',
|
|
||||||
['+colorize'] = t_values.use == false and '' or t_colorize,
|
|
||||||
['+labelLeftPos'] = l_left_pos,
|
|
||||||
['+labelTopPos'] = l_top_pos,
|
|
||||||
['+id'] = id,
|
|
||||||
['+label'] = esc(def.label or '')
|
|
||||||
}))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Build the formspec frame
|
|
||||||
--
|
|
||||||
-- This function builds and displays a formspec based on the input.
|
|
||||||
--
|
|
||||||
-- The `id` is the usual formspec ID (for example `mymod:my_formspec`) and
|
|
||||||
-- has to be provided as a simple string all other parameters are provided via
|
|
||||||
-- the `def` table. The following table is an example.
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- title = 'Nice Title' -- Automatically prefixed for orientation
|
|
||||||
-- prefix = '[Blarb] ' -- Optional title prefix
|
|
||||||
-- width = 8, -- Optional width of the content container
|
|
||||||
-- height = 3, -- Optional height of the content container
|
|
||||||
-- show_to = 'Playername', -- Name of the player to show the formspec to
|
|
||||||
-- hide_buttons = true, -- Optionally hide buttons
|
|
||||||
-- hide_title = true, -- Optionally hide title
|
|
||||||
-- icon_size = 0.5, -- Optionally set title icon size
|
|
||||||
-- content_offset = 0, -- Optionally Offset content height position
|
|
||||||
-- formspec = {} -- Table with formspec definition
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- When set the title is prefixed with the prefix value. If omitted “[mTimer] ”
|
|
||||||
-- is used. The example creates “[Blarb] Nice Title” as title. Translated
|
|
||||||
-- strings can be used here. The Title and prefix are “formspec-safe” so
|
|
||||||
-- strings that are formspec elements can be used to show them literal.
|
|
||||||
--
|
|
||||||
-- The default buttons can be hidden by adding `hide_buttons = true` to the
|
|
||||||
-- definition table. If omitted the buttons are shown. When not shown the
|
|
||||||
-- formspec size will be reduced by the amout of units the buttons would
|
|
||||||
-- have taken place. Same for the title with `hide_title = true`.
|
|
||||||
--
|
|
||||||
-- Some formspec elements do not properly start at 0,0 even if set so. The
|
|
||||||
-- `content_offset` attribute offsets the content vertically by the given
|
|
||||||
-- amount of units. Formspec height and button positions are adapted to the
|
|
||||||
-- given value.
|
|
||||||
--
|
|
||||||
-- The table entries for `formspec` are the usual formspec elements that
|
|
||||||
-- define what a formspec looks like. You can write all definition in one entry
|
|
||||||
-- or split the definition into multiple entries.
|
|
||||||
--
|
|
||||||
-- The definition defines the CONTENT of the formspec not the whole formspec so
|
|
||||||
-- you can easily start at 0,0 for your definition. The function automatically
|
|
||||||
-- places everything in relation to the formspec frame and default buttons.
|
|
||||||
--
|
|
||||||
-- The minimum formspec width and height are 10 units in width and 5 units in
|
|
||||||
-- height. So `width` and `height` can be omitted when all of your content fits
|
|
||||||
-- into the default size.
|
|
||||||
--
|
|
||||||
-- All formspec table entries can contain the following variables. Variables
|
|
||||||
-- start with a plus sign (+) and are read until any character that is not
|
|
||||||
-- a letter. Some variables are useless, some can be used quite well.
|
|
||||||
--
|
|
||||||
-- Variable Name Value Type
|
|
||||||
-- --------------------------------------------------------------------------
|
|
||||||
-- +width Width of the formspec
|
|
||||||
-- +height Height of the formspec
|
|
||||||
-- +iconSize Size of the title icon
|
|
||||||
-- +labelPositionLeft Position of the title label from left side
|
|
||||||
-- +labelPositionTop Position of the title label from top
|
|
||||||
-- +linePosition Position of the title separator line
|
|
||||||
-- +titleText The text of the title label (the dialog title)
|
|
||||||
-- +titleIcon The icon that is used in the dialog title
|
|
||||||
-- +contentPosition Position of the actual content of the dialog
|
|
||||||
-- +buttonsPosition The position where the buttons are
|
|
||||||
--
|
|
||||||
-- @param id The ID of the formspec
|
|
||||||
-- @param def The definition table as described
|
|
||||||
-- @return string the constructed “frame”
|
|
||||||
mtimer.show_formspec = function (id, def)
|
|
||||||
local title_text = def.title or ''
|
|
||||||
local title_prefix = def.prefix or '[mTimer] '
|
|
||||||
local content_offset = def.content_offset or 0
|
|
||||||
local width = (def.width or 0) <= 10 and 10 or def.width
|
|
||||||
local height = ((def.height or 0) <= 4 and 5 or def.height)+content_offset
|
|
||||||
local icon_size = def.icon_size or 0.5
|
|
||||||
local line_position = 0
|
|
||||||
local buttons = ''
|
|
||||||
local title = ''
|
|
||||||
|
|
||||||
-- Set up title
|
|
||||||
if def.hide_title ~= true then
|
|
||||||
line_position = icon_size + 0.25
|
|
||||||
content_offset = content_offset + line_position + (icon_size / 2) + 0.1
|
|
||||||
height = height + content_offset + (icon_size / 2)
|
|
||||||
title = table.concat({
|
|
||||||
'container[0.25,0.25]',
|
|
||||||
' image[0,0;+iconSize,+iconSize;+titleIcon]',
|
|
||||||
' label[+labelPositionLeft,+labelPositionTop;+titleText]',
|
|
||||||
' box[0,+linePosition;+contentWidth,0.04;#ffffff]',
|
|
||||||
'container_end[]'
|
|
||||||
}, ' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set up buttons
|
|
||||||
if def.hide_buttons ~= true then
|
|
||||||
height = height + 1
|
|
||||||
buttons = table.concat({
|
|
||||||
'container[0.25,+buttonsPosition]',
|
|
||||||
'box[0,0;+contentWidth,0.04;#ffffff]',
|
|
||||||
mtimer.get_icon_button('main_menu', {
|
|
||||||
label = S('Main Menu'),
|
|
||||||
width = 2.5, container = { top = 0.25 }
|
|
||||||
}),
|
|
||||||
'container[+contentWidth,0.25]',
|
|
||||||
mtimer.get_icon_button('exit', {
|
|
||||||
label = S('Exit'),
|
|
||||||
exit_button = true,
|
|
||||||
width = 2.5,
|
|
||||||
container = { left = -2.5 }
|
|
||||||
}),
|
|
||||||
mtimer.get_icon_button('default', {
|
|
||||||
label = S('Default'),
|
|
||||||
width = 2.5,
|
|
||||||
container = { left = -5.25 }
|
|
||||||
}),
|
|
||||||
'container_end[]', -- right side buttons
|
|
||||||
'container_end[]' -- buttons
|
|
||||||
}, ' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Build formspec
|
|
||||||
local formspec = table.concat({
|
|
||||||
'formspec_version[2]',
|
|
||||||
'size[+width,+height]',
|
|
||||||
title,
|
|
||||||
'container[0.25,+contentPosition]',
|
|
||||||
table.concat(def.formspec, ' '),
|
|
||||||
'container_end[]',
|
|
||||||
buttons
|
|
||||||
}, ' '):gsub('%+%a+', {
|
|
||||||
-- Formspec frame
|
|
||||||
['+width'] = width + 0.5,
|
|
||||||
['+height'] = height + 0.5,
|
|
||||||
['+contentWidth'] = width,
|
|
||||||
['+contentPosition'] = content_offset + 0.25,
|
|
||||||
['+iconSize'] = icon_size,
|
|
||||||
-- Title-related settings
|
|
||||||
['+labelPositionLeft'] = icon_size + (icon_size / 4),
|
|
||||||
['+labelPositionTop'] = (icon_size / 2),
|
|
||||||
['+linePosition'] = line_position,
|
|
||||||
['+titleText'] = minetest.formspec_escape(title_prefix..title_text),
|
|
||||||
['+titleIcon'] = 'mtimer_'..id:gsub('mtimer:', '')..'.png',
|
|
||||||
-- Buttons-related settings
|
|
||||||
['+buttonsPosition'] = height - 0.75,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Show formspec to the plauyer
|
|
||||||
minetest.show_formspec(def.show_to, id, formspec)
|
|
||||||
end
|
|
@ -1,102 +0,0 @@
|
|||||||
-- # vim: nowrap
|
|
||||||
--
|
|
||||||
-- Set Vim to no-wrapping mode because of some lines not fitting within the 80
|
|
||||||
-- characters width limit due to overall readability of the code.
|
|
||||||
|
|
||||||
|
|
||||||
-- Localise needed functions
|
|
||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
|
|
||||||
|
|
||||||
-- Custom Timer Formspec
|
|
||||||
--
|
|
||||||
-- This formspec shows the custom timer configuration and controls.
|
|
||||||
--
|
|
||||||
-- @see mtimer.show_formspec
|
|
||||||
-- @param player_name The name of the player to show the formspec to
|
|
||||||
mtimer.dialog.custom_timer = function (player_name)
|
|
||||||
local player_meta = minetest.get_player_by_name(player_name):get_meta()
|
|
||||||
local ctv = minetest.deserialize(player_meta:get_string(m.meta.custom_timer_settings.key))
|
|
||||||
local timer_status = (ctv.running == true) and S('running') or S('stopped')
|
|
||||||
|
|
||||||
local days = ctv.values.days or 0
|
|
||||||
local hours = ctv.values.hours or 0
|
|
||||||
local minutes = ctv.values.minutes or 0
|
|
||||||
local seconds = ctv.values.seconds or 0
|
|
||||||
|
|
||||||
local a_countdown = ctv.timer_mode == 'countdown' and 'true' or 'false'
|
|
||||||
local a_timer = ctv.timer_mode == 'timer' and 'true' or 'false'
|
|
||||||
local a_continuous = ctv.timer_mode == 'continuous' and 'true' or 'false'
|
|
||||||
|
|
||||||
local format_running = ctv.format.running or ''
|
|
||||||
local format_stopped = ctv.format.stopped or ''
|
|
||||||
local format_finished = ctv.format.finished or ''
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:custom_timer', {
|
|
||||||
title = S('Custom Timer'),
|
|
||||||
show_to = player_name,
|
|
||||||
height = 6.25,
|
|
||||||
width = 13,
|
|
||||||
formspec = {
|
|
||||||
'field_close_on_enter[v_format_running;false]',
|
|
||||||
'field_close_on_enter[v_format_stopped;false]',
|
|
||||||
'field_close_on_enter[v_format_finished;false]',
|
|
||||||
'field_close_on_enter[v_days;false]',
|
|
||||||
'field_close_on_enter[v_hours;false]',
|
|
||||||
'field_close_on_enter[v_minutes;false]',
|
|
||||||
'field_close_on_enter[v_seconds;false]',
|
|
||||||
'container[0,0]',
|
|
||||||
' label[0,0.25;'..S('Running')..'] field[2.5,0;10.5,0.5;v_format_running;;'..esc(format_running)..']',
|
|
||||||
' label[0,0.85;'..S('Stopped')..'] field[2.5,0.6;10.5,0.5;v_format_stopped;;'..esc(format_stopped)..']',
|
|
||||||
' label[0,1.45;'..S('Finished')..'] field[2.5,1.2;10.5,0.5;v_format_finished;;'..esc(format_finished)..']',
|
|
||||||
' box[0,2;+contentWidth,0.04;#ffffff]',
|
|
||||||
'container_end[]',
|
|
||||||
'container[3.75,2.4]',
|
|
||||||
' label[0,0;'..S('Information')..'] label[2.5,0;'..S('Variable')..'] label[5,0;'..S('Used Value')..']',
|
|
||||||
' box[0,0.25;7,0.02;#ffffff]',
|
|
||||||
' label[0,0.5;'..S('Days')..'] label[2.5,0.5;{days}] label[5,0.5;'..days..']',
|
|
||||||
' label[0,0.9;'..S('Hours')..'] label[2.5,0.9;{hours}] label[5,0.9;'..hours..']',
|
|
||||||
' label[0,1.3;'..S('Minutes')..'] label[2.5,1.3;{minutes}] label[5,1.3;'..minutes..']',
|
|
||||||
' label[0,1.7;'..S('Seconds')..'] label[2.5,1.7;{seconds}] label[5,1.7;'..seconds..']',
|
|
||||||
'container_end[]',
|
|
||||||
'container[0,2.3]',
|
|
||||||
' container[0,0]',
|
|
||||||
' button[0,0;0.75,0.25;c_days_p;+]',
|
|
||||||
' field[0,0.25;0.755,0.5;v_days;;'..days..']',
|
|
||||||
' button[0,0.75;0.75,0.25;c_days_m;-]',
|
|
||||||
' container_end[]',
|
|
||||||
' container[0.9,0]',
|
|
||||||
' button[0,0;0.75,0.25;c_hours_p;+]',
|
|
||||||
' field[0,0.25;0.755,0.5;v_hours;;'..hours..']',
|
|
||||||
' button[0,0.75;0.75,0.25;c_hours_m;-]',
|
|
||||||
' container_end[]',
|
|
||||||
' container[1.8,0]',
|
|
||||||
' button[0,0;0.75,0.25;c_minutes_p;+]',
|
|
||||||
' field[0,0.25;0.755,0.5;v_minutes;;'..minutes..']',
|
|
||||||
' button[0,0.75;0.75,0.25;c_minutes_m;-]',
|
|
||||||
' container_end[]',
|
|
||||||
' container[2.7,0]',
|
|
||||||
' button[0,0;0.75,0.25;c_seconds_p;+]',
|
|
||||||
' field[0,0.25;0.755,0.5;v_seconds;;'..seconds..']',
|
|
||||||
' button[0,0.75;0.75,0.25;c_seconds_m;-]',
|
|
||||||
' container_end[]',
|
|
||||||
'container_end[]',
|
|
||||||
'container[0,3.75]',
|
|
||||||
' checkbox[0,0;mode_countdown;'..S('Countdown')..';'..a_countdown..']',
|
|
||||||
' checkbox[0,0.4;mode_timer;'..S('Timer Mode')..';'..a_timer..']',
|
|
||||||
' checkbox[0,0.8;mode_continuous;'..S('Continuous Run')..';'..a_continuous..']',
|
|
||||||
'container_end[]',
|
|
||||||
'container[0,5.55]',
|
|
||||||
' box[0,-0.25;+contentWidth,0.04;#ffffff]',
|
|
||||||
' label[0,0.375;'..esc(S('The timer is currently @1', timer_status))..']',
|
|
||||||
' container[+contentWidth,0]',
|
|
||||||
mtimer.get_icon_button('ct_start', { width = 2.25, label = S('Start'), colorize = { color = '#4e9a06' }, container = { left = -7.25 } }),
|
|
||||||
mtimer.get_icon_button('ct_stop', { width = 2.25, label = S('Stop'), colorize = { color = '#a40000', ratio = 128 }, container = { left = -4.75 } }),
|
|
||||||
mtimer.get_icon_button('ct_restart', { width = 2.25, label = S('Restart'), colorize = { color = '#729fcf' }, container = { left = -2.25 } }),
|
|
||||||
' container_end[]',
|
|
||||||
'container_end[]',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,186 +0,0 @@
|
|||||||
-- Localise needed functions
|
|
||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
local line = mtimer.get_table_line
|
|
||||||
|
|
||||||
|
|
||||||
-- Formspecs are loaded and shown by individual functions. The function name
|
|
||||||
-- correlates with the formspec to show. All of the names are self-explanatory
|
|
||||||
-- and within the functions no logic is used.
|
|
||||||
--
|
|
||||||
-- Some formspec functions are separated into individual files because they are
|
|
||||||
-- very complex and/or need helper functions.
|
|
||||||
--
|
|
||||||
-- @see mtimer.show_formspec
|
|
||||||
-- @see mtimer.get_times
|
|
||||||
-- @see ./system/on_receive_fields.lua
|
|
||||||
-- @see ./system/chat_command.lua
|
|
||||||
-- @see ./system/formspecs/*
|
|
||||||
-- @see https://dev.minetest.net/formspec
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.set_visibility = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local visible = player:get_meta():get_string(m.meta.visible.key)
|
|
||||||
local status = visible == 'true' and S('visible') or S('invisible')
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:set_visibility', {
|
|
||||||
title = S('Visibility'),
|
|
||||||
show_to = player_name,
|
|
||||||
formspec = {
|
|
||||||
mtimer.get_icon_button('set_visible', {
|
|
||||||
width = 4,
|
|
||||||
label = S('Make visible')
|
|
||||||
}),
|
|
||||||
mtimer.get_icon_button('set_invisible', {
|
|
||||||
width = 4,
|
|
||||||
label = S('Make invisible'),
|
|
||||||
container = { left = 4.25 }
|
|
||||||
}),
|
|
||||||
'label[0,1.25;'..S('The timer is currently @1.', status)..']'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.ingame_time_format = function (player_name)
|
|
||||||
local time_data = mtimer.get_times(player_name).ingame_time
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:ingame_time_format', {
|
|
||||||
title = S('Ingame Time Format'),
|
|
||||||
show_to = player_name,
|
|
||||||
formspec = {
|
|
||||||
'field_close_on_enter[format;false]',
|
|
||||||
'field[0,0;+contentWidth,0.5;format;;'..esc(time_data.format)..']',
|
|
||||||
'container[0,1.5]',
|
|
||||||
line(0, '', S('Variable'), S('Current Value')),
|
|
||||||
line(1, '-'),
|
|
||||||
line(2, S('Hours (24h)'), '{24h}', time_data.hours_24),
|
|
||||||
line(3, S('Hours (12h)'), '{12h}', time_data.hours_12),
|
|
||||||
line(4, S('Minutes'), '{min}', time_data.minutes),
|
|
||||||
line(5, S('Meridiem Indicator'),'{mi}', time_data.indicator),
|
|
||||||
line(6, S('Ingame Timestamp'), '{its}', time_data.ingame_timestamp),
|
|
||||||
line(7, '-'),
|
|
||||||
line(8, S('Current Result'), esc(time_data.formatted), ''),
|
|
||||||
'container_end[]'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.real_world_time_format = function (player_name)
|
|
||||||
mtimer.dialog.real_time_universal(player_name, {
|
|
||||||
time_type = 'real_time',
|
|
||||||
formspec_name = 'mtimer:real_world_time_format',
|
|
||||||
title = S('Real-World Time Format')
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.host_time_format = function (player_name)
|
|
||||||
mtimer.dialog.real_time_universal(player_name, {
|
|
||||||
time_type = 'host_time',
|
|
||||||
formspec_name = 'mtimer:host_time_format',
|
|
||||||
title = S('Host Time Format')
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.session_start_time_format = function (player_name)
|
|
||||||
mtimer.dialog.real_time_universal(player_name, {
|
|
||||||
time_type = 'session_start_time',
|
|
||||||
formspec_name = 'mtimer:session_start_time_format',
|
|
||||||
title = S('Session Start Time Format')
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.session_duration_format = function (player_name)
|
|
||||||
local time_data = mtimer.get_times(player_name).session_duration
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:session_duration_format', {
|
|
||||||
title = S('Session Duration Format'),
|
|
||||||
show_to = player_name,
|
|
||||||
formspec = {
|
|
||||||
'field_close_on_enter[format;false]',
|
|
||||||
'field[0,0;+contentWidth,0.5;format;;'..esc(time_data.format)..']',
|
|
||||||
'container[0,1.5]',
|
|
||||||
line(0, '', S('Variable'), S('Current Value')),
|
|
||||||
line(1, '-'),
|
|
||||||
line(2, S('Days'), '{days}', time_data.days),
|
|
||||||
line(3, S('Hours'), '{hours}', time_data.hours),
|
|
||||||
line(4, S('Minutes'), '{minutes}', time_data.minutes),
|
|
||||||
line(5, S('Seconds'), '{seconds}', time_data.seconds),
|
|
||||||
line(6, '-'),
|
|
||||||
line(7, S('Current Result'), esc(time_data.formatted), ''),
|
|
||||||
'container_end[]'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.timer_format = function (player_name)
|
|
||||||
local td = mtimer.get_timer_data(player_name)
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:timer_format', {
|
|
||||||
title = S('Timer Format'),
|
|
||||||
show_to = player_name,
|
|
||||||
height = 6,
|
|
||||||
width = 11,
|
|
||||||
formspec = {
|
|
||||||
'textarea[0,0;6,2.5;format;;'..esc(td.format)..']',
|
|
||||||
'container[0,3.4]',
|
|
||||||
line(0, '', S('Variable'), S('Current Value')),
|
|
||||||
line(1, '-'),
|
|
||||||
line(2, S('Real-World Date'), '{rd}', esc(td.real_world_date)),
|
|
||||||
line(3, S('In-Game Time'), '{it}', esc(td.ingame_time)),
|
|
||||||
line(4, S('Session Start Time'),'{st}', esc(td.session_start_time)),
|
|
||||||
line(5, S('Session Duration'), '{sd}', esc(td.session_duration)),
|
|
||||||
line(6, S('Host Time'), '{ht}', esc(td.host_time)),
|
|
||||||
line(7, S('Custom Timer'), '{ct}', esc(td.custom_timer)),
|
|
||||||
'container_end[]',
|
|
||||||
'container[6.25,0]',
|
|
||||||
mtimer.get_icon_button('apply', { label = S('Apply') }),
|
|
||||||
'container_end[]'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.reset_everything = function (player_name)
|
|
||||||
local td = mtimer.get_timer_data(player_name)
|
|
||||||
local infotext = table.concat({
|
|
||||||
S('For resetting the configuration you have two options.'),
|
|
||||||
S('Usually using a soft reset is enough. The soft reset sets all values based on mTimer functionality to the default values while staying connected.'),
|
|
||||||
S('If the soft reset does not work you can hard reset the configuration. This stores a request and then kicks you from the server. On rejoining mTimer forcefully removes all stored configuration and sets the current default values.')
|
|
||||||
}, '\n\n')
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:reset_everything', {
|
|
||||||
title = S('Reset Everything'),
|
|
||||||
show_to = player_name,
|
|
||||||
width = 10,
|
|
||||||
height = 6.3,
|
|
||||||
hide_buttons = true,
|
|
||||||
formspec = {
|
|
||||||
'textarea[0,0;+contentWidth,3.5;;;'..esc(infotext)..']',
|
|
||||||
'container[0,3.8]',
|
|
||||||
line(0, '-'),
|
|
||||||
mtimer.get_icon_button('reset_soft', {
|
|
||||||
width = 10,
|
|
||||||
label = S('Soft-reset all values to their defaults')
|
|
||||||
}),
|
|
||||||
mtimer.get_icon_button('reset_hard', {
|
|
||||||
label = S('Request hard-reset (kicks you from the server!)'),
|
|
||||||
width = 10,
|
|
||||||
container = { top = 1 }
|
|
||||||
}),
|
|
||||||
mtimer.get_icon_button('reset_cancel', {
|
|
||||||
label = S('Cancel reset and return to main menu'),
|
|
||||||
width = 10,
|
|
||||||
container = { top = 2 }
|
|
||||||
}),
|
|
||||||
'container_end[]',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,130 +0,0 @@
|
|||||||
-- Localise needed functions
|
|
||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
|
|
||||||
|
|
||||||
-- Draw a scale/ruler indicator
|
|
||||||
--
|
|
||||||
-- This function draws an either horizontal or vertical scale/ruler indicator
|
|
||||||
-- of the given length and thickness in formspec units.
|
|
||||||
--
|
|
||||||
-- |--------|
|
|
||||||
--
|
|
||||||
-- It is also possible to set a color.
|
|
||||||
--
|
|
||||||
-- @param orientation Either `horizontal` or `vertical`
|
|
||||||
-- @param length Desired Length as number in formspec units
|
|
||||||
-- @param thickness Desired thicness as number in formspec units
|
|
||||||
-- @param color Color as hexadecimal string without opacity (`#rrggbb`)
|
|
||||||
--
|
|
||||||
-- @return string The generated formspec code without container
|
|
||||||
local draw_scale = function(orientation, length, thickness, color)
|
|
||||||
local startX, startY, startWidth, startHeight
|
|
||||||
local ruleX, ruleY, ruleWidth, ruleHeight
|
|
||||||
local endX, endY, endWidth, endHeight
|
|
||||||
|
|
||||||
if orientation == 'horizontal' then
|
|
||||||
startX = 0
|
|
||||||
startY = 0
|
|
||||||
startWidth = thickness
|
|
||||||
startHeight = thickness * 3
|
|
||||||
ruleX = 0 + (thickness / 4)
|
|
||||||
ruleY = thickness
|
|
||||||
ruleWidth = length - (2 * (thickness / 4))
|
|
||||||
ruleHeight = thickness
|
|
||||||
endX = length - thickness
|
|
||||||
endY = 0
|
|
||||||
endWidth = thickness
|
|
||||||
endHeight = thickness * 3
|
|
||||||
end
|
|
||||||
|
|
||||||
if orientation == 'vertical' then
|
|
||||||
startX = 0
|
|
||||||
startY = 0
|
|
||||||
startWidth = thickness * 3
|
|
||||||
startHeight = thickness
|
|
||||||
ruleX = thickness
|
|
||||||
ruleY = 0 + (thickness / 4)
|
|
||||||
ruleWidth = thickness
|
|
||||||
ruleHeight = length - (2 * (thickness / 4))
|
|
||||||
endX = 0
|
|
||||||
endY = length - thickness
|
|
||||||
endWidth = thickness * 3
|
|
||||||
endHeight = thickness
|
|
||||||
end
|
|
||||||
|
|
||||||
return (table.concat({
|
|
||||||
'box[+startX,+startY;+startWidth,+startHeight;+color]',
|
|
||||||
'box[+ruleX,+ruleY;+ruleWidth,+ruleHeight;+color]',
|
|
||||||
'box[+endX,+endY;+endWidth,+endHeight;+color]',
|
|
||||||
}, ' ')):gsub('%+%w+', {
|
|
||||||
['+startX'] = startX,
|
|
||||||
['+startY'] = startY,
|
|
||||||
['+startWidth'] = startWidth,
|
|
||||||
['+startHeight'] = startHeight,
|
|
||||||
['+ruleX'] = ruleX,
|
|
||||||
['+ruleY'] = ruleY,
|
|
||||||
['+ruleWidth'] = ruleWidth,
|
|
||||||
['+ruleHeight'] = ruleHeight,
|
|
||||||
['+endX'] = endX,
|
|
||||||
['+endY'] = endY,
|
|
||||||
['+endWidth'] = endWidth,
|
|
||||||
['+endHeight'] = endHeight,
|
|
||||||
['+color'] = color..'FF'
|
|
||||||
})
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.hud_element_offset = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local timer_data = esc(mtimer.get_timer_data(player_name).format)
|
|
||||||
local h_color = '#a40000'
|
|
||||||
local v_color = '#4e9a06'
|
|
||||||
|
|
||||||
-- Get current offset values or 0 for use in formspec
|
|
||||||
local key = m.meta.hud_element_offset.key
|
|
||||||
local offset = minetest.deserialize(player:get_meta():get_string(key))
|
|
||||||
offset.x = offset.x and offset.x or 0
|
|
||||||
offset.y = offset.y and offset.y or 0
|
|
||||||
|
|
||||||
|
|
||||||
local infotext = S('Control the HUD element offset using the input on the right side and use the screenshot and markings as orientation for what is changed. The result is shown in the HUD in real time, so check for the actual timner position using the timer HUD element itself.')
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:hud_element_offset', {
|
|
||||||
title = S('HUD Element Offset'),
|
|
||||||
show_to = player_name,
|
|
||||||
width = 11,
|
|
||||||
height = 7.5,
|
|
||||||
formspec = {
|
|
||||||
'field_close_on_enter[x_offset;false]',
|
|
||||||
'field_close_on_enter[y_offset;false]',
|
|
||||||
'container[0,0]',
|
|
||||||
' container[0,0]',
|
|
||||||
draw_scale('vertical', 4.8, 0.1, v_color),
|
|
||||||
' container_end[]',
|
|
||||||
' image[0.5,0;8,4.8;mtimer_positions_orientation.png]',
|
|
||||||
' textarea[0,5.7;8.5,1.85;;;'..esc(infotext)..']',
|
|
||||||
' box[8.75,0;0.01,7.5;#ffffff]',
|
|
||||||
' container[0.5,5.05]',
|
|
||||||
draw_scale('horizontal', 8, 0.1, h_color),
|
|
||||||
' container_end[]',
|
|
||||||
'container_end[]',
|
|
||||||
'container[9.5,0.4]',
|
|
||||||
' label[-0.5,-0.25;'..esc(S('Vertical'))..']',
|
|
||||||
' box[-0.5,0.1;0.3,0.3;'..v_color..'FF]',
|
|
||||||
' field[0,0;0.75,0.5;y_offset;;'..offset.y..']',
|
|
||||||
' button[0.8,0;0.5,0.26;y_add_1;'..S('+')..']',
|
|
||||||
' button[0.8,0.26;0.5,0.26;y_substract_1;'..S('-')..']',
|
|
||||||
'container_end[]',
|
|
||||||
'container[9.5,1.75]',
|
|
||||||
' label[-0.5,-0.25;'..esc(S('Horizontal'))..']',
|
|
||||||
' box[-0.5,0.1;0.3,0.3;'..h_color..'FF]',
|
|
||||||
' field[0,0;0.75,0.5;x_offset;;'..offset.x..']',
|
|
||||||
' button[0.8,0;0.25,0.51;x_substract_1;'..S('-')..']',
|
|
||||||
' button[1.05,0;0.25,0.51;x_add_1;'..S('+')..']',
|
|
||||||
'container_end[]'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,99 +0,0 @@
|
|||||||
-- Localise needed functions
|
|
||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
|
|
||||||
|
|
||||||
-- Draw a scale ruler
|
|
||||||
--
|
|
||||||
-- This function creates a two-colored ruler that can be used as scale for
|
|
||||||
-- scrollbars, etc. It is optionally possible to write first and last value
|
|
||||||
-- below the scale ruler.
|
|
||||||
--
|
|
||||||
-- @param steps Steps the ruler should have
|
|
||||||
-- @param length Overall length of the ruler in formspec units
|
|
||||||
-- @param height Height of the ruler in formspec units
|
|
||||||
-- @param pos A simple position table ({x=0,y=0}) for the container
|
|
||||||
-- @param c_odd Odd segment color
|
|
||||||
-- @param c_even Even segment color
|
|
||||||
-- @param mark Either nil or a number in formspec units for the markings
|
|
||||||
--
|
|
||||||
-- @return string The formspec code for the scale ruler
|
|
||||||
local draw_scale_ruler = function (steps,length,height,pos,c_odd,c_even,mark)
|
|
||||||
local elements = ''
|
|
||||||
local marks = ''
|
|
||||||
local step_width = length / steps
|
|
||||||
|
|
||||||
-- Build scale
|
|
||||||
for step=1,steps,1 do
|
|
||||||
elements = elements..' '..(('box[+x,+y;+w,+h;+c]'):gsub('%+%w', {
|
|
||||||
['+x'] = step_width * (step - 1),
|
|
||||||
['+y'] = 0,
|
|
||||||
['+w'] = step_width,
|
|
||||||
['+h'] = height,
|
|
||||||
['+c'] = (step % 2 == 0) and c_even or c_odd,
|
|
||||||
}))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Build marks (start, end)
|
|
||||||
if type(mark) == 'number' then
|
|
||||||
local template = 'image_button[+x,+y;+w,+h;+t;;+l;;false]'
|
|
||||||
|
|
||||||
local m_start = template:gsub('%+%w',{
|
|
||||||
['+x'] = 0,
|
|
||||||
['+y'] = 0,
|
|
||||||
['+w'] = step_width,
|
|
||||||
['+h'] = 0.5,
|
|
||||||
['+t'] = 'mtimer_transparent.png',
|
|
||||||
['+l'] = length / steps
|
|
||||||
})
|
|
||||||
local m_end = template:gsub('%+%w', {
|
|
||||||
['+x'] = (step_width * steps) - step_width,
|
|
||||||
['+y'] = 0,
|
|
||||||
['+w'] = step_width,
|
|
||||||
['+h'] = 0.5,
|
|
||||||
['+t'] = 'mtimer_transparent.png',
|
|
||||||
['+l'] = steps
|
|
||||||
})
|
|
||||||
|
|
||||||
marks = 'container[0,'..mark..'] '..m_start..m_end..' container_end[]'
|
|
||||||
end
|
|
||||||
|
|
||||||
return table.concat({
|
|
||||||
'container['..pos.x..','..pos.y..']',
|
|
||||||
elements,
|
|
||||||
marks,
|
|
||||||
'container_end[]'
|
|
||||||
}, ' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.hud_element_scale = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local scale = player:get_meta():get_string(m.meta.hud_element_scale.key)
|
|
||||||
|
|
||||||
local sb_options = table.concat({
|
|
||||||
'min=1',
|
|
||||||
'max=10',
|
|
||||||
'smallstep=1',
|
|
||||||
'largestep=10',
|
|
||||||
'thumbsize=1',
|
|
||||||
'arrows=hide'
|
|
||||||
}, ';')
|
|
||||||
|
|
||||||
local infotext = S('The HUD element can be scaled between 1x (original size) and 10x (largest size due to performance reasons). Use the slider above to adjust the scaling to your needs.')
|
|
||||||
|
|
||||||
infotext = infotext..'\n\n'..S('Due to technical reasons the slider position does not reset when clicking the button to set to default values. The HUD element itself resets, and when re-entering this dialog the slider position is properly set.')
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:hud_element_scale', {
|
|
||||||
title = S('HUD Element Scale'),
|
|
||||||
show_to = player_name,
|
|
||||||
formspec = {
|
|
||||||
draw_scale_ruler(10,10,0.25,{x=0,y=0},'#729fcf','#73f216',0.45),
|
|
||||||
'scrollbaroptions['..sb_options..']',
|
|
||||||
'scrollbar[0,0.25;10,0.25;horizontal;new_value;'..scale..']',
|
|
||||||
'box[0,1.13;+contentWidth,0.01;#ffffff]',
|
|
||||||
'textarea[0,1.5;10,3;;;'..esc(infotext)..']',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,88 +0,0 @@
|
|||||||
-- # vim: nowrap
|
|
||||||
--
|
|
||||||
-- Set Vim to no-wrapping mode because of some lines not fitting within the 80
|
|
||||||
-- characters width limit due to overall readability of the code.
|
|
||||||
|
|
||||||
|
|
||||||
-- Localise needed functions
|
|
||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
|
|
||||||
|
|
||||||
-- Create buttons at the given position in the main menu formspec
|
|
||||||
--
|
|
||||||
-- This function takes a column and a row and translates that to values used
|
|
||||||
-- by the icon button function. All buttons are 5 units wide and the image
|
|
||||||
-- size is 0.5 units.
|
|
||||||
--
|
|
||||||
-- @param column The desired column, starting with 1
|
|
||||||
-- @param row The desired row, starting with 1
|
|
||||||
-- @param id The button’s ID
|
|
||||||
-- @param label The button’s label
|
|
||||||
-- @return string The parsed main menu button
|
|
||||||
local menu_button = function (column, row, id, label)
|
|
||||||
local b_width = 5
|
|
||||||
local i_size = 0.5
|
|
||||||
|
|
||||||
-- Calculations
|
|
||||||
local b_padding = i_size / 4
|
|
||||||
local b_height = (b_padding * 2) + i_size
|
|
||||||
local b_top_position = (row - 1) * b_height
|
|
||||||
local b_top_spacing = b_top_position == 0 and 0 or b_padding * 1.5
|
|
||||||
local c_position = (column - 1) * b_width
|
|
||||||
local c_spacing = c_position == 0 and 0 or b_padding * 3
|
|
||||||
local bc_top = b_top_position + (b_top_spacing * (row - 1))
|
|
||||||
local bc_left = c_position + (c_spacing * (column - 1))
|
|
||||||
|
|
||||||
return mtimer.get_icon_button(id, {
|
|
||||||
label = esc(label),
|
|
||||||
width = b_width,
|
|
||||||
image_size = i_size,
|
|
||||||
container = {
|
|
||||||
top = bc_top,
|
|
||||||
left = bc_left
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Main Menu generation
|
|
||||||
--
|
|
||||||
-- @see mtimer.show_formspec
|
|
||||||
-- @param player_name The name of the player to show the formspec to
|
|
||||||
mtimer.dialog.main_menu = function (player_name)
|
|
||||||
mtimer.show_formspec('mtimer:main_menu', {
|
|
||||||
width = 15.75,
|
|
||||||
height = 5.75,
|
|
||||||
hide_buttons = true,
|
|
||||||
hide_title = true,
|
|
||||||
show_to = player_name,
|
|
||||||
formspec = {
|
|
||||||
-- Visuals
|
|
||||||
menu_button(1, 1, 'set_visibility', S('Visibility')),
|
|
||||||
menu_button(1, 2, 'set_position', S('Position')),
|
|
||||||
menu_button(1, 3, 'set_color', S('Color')),
|
|
||||||
menu_button(1, 4, 'hud_element_scale', S('HUD Element Scale')),
|
|
||||||
menu_button(1, 5, 'hud_element_offset', S('HUD Element Offset')),
|
|
||||||
-- Time Representation
|
|
||||||
menu_button(2, 1, 'ingame_time_format', S('Ingame Time Format')),
|
|
||||||
menu_button(2, 2, 'real_world_time_format', S('Real-World Time Format')),
|
|
||||||
menu_button(2, 3, 'session_start_time_format', S('Session Start Time Format')),
|
|
||||||
menu_button(2, 4, 'session_duration_format', S('Session Duration Format')),
|
|
||||||
menu_button(2, 5, 'host_time_format', S('Host Time Format')),
|
|
||||||
-- Timer configuration
|
|
||||||
menu_button(3, 1, 'timer_format', S('Timer Format')),
|
|
||||||
menu_button(3, 2, 'timezone_offset', S('Timezone Offset')),
|
|
||||||
menu_button(3, 3, 'custom_timer', S('Custom Timer')),
|
|
||||||
-- Custom buttons
|
|
||||||
'container[0,4.75]',
|
|
||||||
' box[0,0;+contentWidth,0.04;#ffffff]',
|
|
||||||
' container[+contentWidth,0]',
|
|
||||||
mtimer.get_icon_button('reset_everything', { label = S('Reset Everything'), width = 4, container = { top = 0.25, left = -6.75 } }),
|
|
||||||
mtimer.get_icon_button('exit', { label = S('Exit'), exit_button = true, width = 2.5, container = { top = 0.25, left = -2.5 } }),
|
|
||||||
' container_end[]',
|
|
||||||
'container_end[]'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,53 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
local line = mtimer.get_table_line
|
|
||||||
|
|
||||||
|
|
||||||
-- Real Time Universal Formspec
|
|
||||||
--
|
|
||||||
-- This formspec can be used to show formatting options for all real-world time
|
|
||||||
-- values that can be formatted within mTimer. Since all the real-world times
|
|
||||||
-- are defined identically this formspec exists so it has to be defined only
|
|
||||||
-- once and can be re-used as needed.
|
|
||||||
--
|
|
||||||
-- @param player_name The name of the player to show the formspec to
|
|
||||||
-- @config time_type A time type that is provided by the `get_times` function
|
|
||||||
-- @return void
|
|
||||||
-- @see mtimer.get_times
|
|
||||||
mtimer.dialog.real_time_universal = function (player_name, config)
|
|
||||||
local time_data = mtimer.get_times(player_name)[config.time_type]
|
|
||||||
local vars = time_data.variables
|
|
||||||
|
|
||||||
mtimer.show_formspec(config.formspec_name, {
|
|
||||||
title = config.title,
|
|
||||||
show_to = player_name,
|
|
||||||
height = 9,
|
|
||||||
formspec = {
|
|
||||||
'field_close_on_enter[format;false]',
|
|
||||||
'field[0,0;+contentWidth,0.5;format;;'..esc(time_data.format)..']',
|
|
||||||
'container[0,1.5]',
|
|
||||||
line(0, '', S('Variable'), S('Current Value')),
|
|
||||||
line(1, '-'),
|
|
||||||
line(2, S('Hours (24h)'), '{24h}', vars.hours_24),
|
|
||||||
line(3, S('Hours (12h)'), '{12h}', vars.hours_12),
|
|
||||||
line(4, S('Minutes'), '{min}', vars.minutes),
|
|
||||||
line(5, S('Seconds'), '{sec}', vars.seconds),
|
|
||||||
line(6, S('Meridiem Indicator'), '{mi}', vars.indicator),
|
|
||||||
line(7, '-'),
|
|
||||||
line(8, S('Day Name'), '{dname}', vars.dayname),
|
|
||||||
line(9, S('Month Name'), '{mname}', vars.monthname),
|
|
||||||
line(10, '-'),
|
|
||||||
line(11, S('Year'), '{year}', vars.year),
|
|
||||||
line(12, S('Month'), '{month}', vars.month),
|
|
||||||
line(13, S('Day'), '{day}', vars.day),
|
|
||||||
line(14, '-'),
|
|
||||||
line(15, S('ISO 8601 Date'), '{isodate}', vars.iso8601_date),
|
|
||||||
line(16, S('ISO 8601 Time'), '{isotime}', vars.iso8601_time),
|
|
||||||
line(17, S('Timestamp'), '{timestamp}', vars.timestamp),
|
|
||||||
line(18, '-'),
|
|
||||||
line(19, S('Current Result'), esc(time_data.formatted), ''),
|
|
||||||
'container_end[]'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,76 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
|
|
||||||
|
|
||||||
-- Tango palette
|
|
||||||
--
|
|
||||||
-- @see http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines
|
|
||||||
local palette_entries = {
|
|
||||||
'fce94f', 'edd400', 'c4a000', 'fcaf3e', 'f57900', 'ce5c00', 'e9b96e',
|
|
||||||
'c17d11', '8f5902', '8ae234', '73d216', '4e9a06', '729fcf', '3465a4',
|
|
||||||
'204a87', 'ad7fa8', '75507b', '5c3566', 'ef2929', 'cc0000', 'a40000',
|
|
||||||
'eeeeec', 'd3d7cf', 'babdb6', '888a85', '555753', '2e3436', '000000',
|
|
||||||
'ff0000', '00ff00', '0000ff', 'ffff00', '00ffff', 'ff00ff', 'c0c0c0',
|
|
||||||
'808080', '800000', '808000', '008000', '800080', '008080', '000080',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local hexformat = table.concat({
|
|
||||||
'#',
|
|
||||||
minetest.colorize('#ce5c00', 'rr'),
|
|
||||||
minetest.colorize('#4e9a06', 'gg'),
|
|
||||||
minetest.colorize('#729fcf', 'bb')
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.set_color = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local color = player:get_meta():get_string(m.meta.color.key)
|
|
||||||
local palette = {}
|
|
||||||
local col = 0
|
|
||||||
local row = 1
|
|
||||||
|
|
||||||
for _,color in pairs(palette_entries) do
|
|
||||||
local cb_height = 0.6
|
|
||||||
local cb_width = 1.39
|
|
||||||
local cb_style = 'style[+name;bgcolor=#+color;textcolor=#+color]'
|
|
||||||
local cb_button = 'button[+left,+top;+width,+height;+name;+label]'
|
|
||||||
local cb_complete = cb_style..' '..cb_button
|
|
||||||
|
|
||||||
col = col + 1
|
|
||||||
if col > 7 then
|
|
||||||
col = 1
|
|
||||||
row = row + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(palette, ((cb_complete):gsub('%+%w+', {
|
|
||||||
['+top'] = (row - 1) * (cb_height + 0.05),
|
|
||||||
['+left'] = (col - 1) * (cb_width + 0.05),
|
|
||||||
['+width'] = cb_width,
|
|
||||||
['+height'] = cb_height,
|
|
||||||
['+name'] = 'set_color',
|
|
||||||
['+color'] = color,
|
|
||||||
['+label'] = color
|
|
||||||
})))
|
|
||||||
end
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:set_color', {
|
|
||||||
title = S('Color'),
|
|
||||||
show_to = player_name,
|
|
||||||
width = 10,
|
|
||||||
height = 6.2,
|
|
||||||
formspec = {
|
|
||||||
'field_close_on_enter[color;false]',
|
|
||||||
'field[0,0;3,0.5;color;;'..color..']',
|
|
||||||
'box[3.25,0;0.5,0.5;'..color..'ff]',
|
|
||||||
'tooltip[3.25,0;0.5,0.5;'..S('Current color: @1', color)..']',
|
|
||||||
'label[0,1;'..S('Use `@1` format only!', hexformat)..']',
|
|
||||||
'container[0,1.85]',
|
|
||||||
' box[0,-0.4;+contentWidth,0.04;#ffffff]',
|
|
||||||
' label[0,0;'..esc(S('Set a predefined color'))..']',
|
|
||||||
' container[0,0.4]'..table.concat(palette, ' ')..'container_end[]',
|
|
||||||
'container_end[]'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,70 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
|
|
||||||
|
|
||||||
-- Image width and height for setting the screenshot in position and do the
|
|
||||||
-- button calculations
|
|
||||||
local i_width = 10
|
|
||||||
local i_height = 6
|
|
||||||
|
|
||||||
|
|
||||||
-- Position names for the current position information string
|
|
||||||
local p_names = {
|
|
||||||
['t'] = S('top'),
|
|
||||||
['m'] = S('middle'),
|
|
||||||
['b'] = S('bottom'),
|
|
||||||
['l'] = S('left'),
|
|
||||||
['c'] = S('center'),
|
|
||||||
['r'] = S('right')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
-- Return parsed position button
|
|
||||||
--
|
|
||||||
-- This function shows a button on the given position that sets the position
|
|
||||||
-- of the GUI element accordingly. The `position` is one of the following.
|
|
||||||
--
|
|
||||||
-- tl, tc, tr = top left, center, right
|
|
||||||
-- ml, mc, mr = middle left, center, right
|
|
||||||
-- bl, bc, br = bottom left, center right
|
|
||||||
--
|
|
||||||
-- @param top The position of the button from the top
|
|
||||||
-- @param left The position of the button from the left
|
|
||||||
-- @param position GUI element position to set with this button
|
|
||||||
local b_define = function(top, left, position)
|
|
||||||
return ('image_button[+l,+t;+w,+h;+i;pos_+p;d;;false]'):gsub('%+%w', {
|
|
||||||
['+l'] = (left - 1) * (i_width / 3),
|
|
||||||
['+t'] = (top - 1) * (i_height / 3),
|
|
||||||
['+w'] = i_width / 3,
|
|
||||||
['+h'] = i_height / 3,
|
|
||||||
['+i'] = 'mtimer_transparent.png',
|
|
||||||
['+p'] = position,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.set_position = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local howto = S('Click the position you want to place the timer at.')
|
|
||||||
local image = 'mtimer_positions_orientation.png'
|
|
||||||
|
|
||||||
-- Get current position name
|
|
||||||
local p_value = player:get_meta():get_string(m.meta.position.key)
|
|
||||||
local p_name = p_names[p_value:sub(1,1)]..' '..p_names[p_value:sub(2,2)]
|
|
||||||
local p_info = S('Current position: @1', p_name)
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:set_position', {
|
|
||||||
title = S('Position'),
|
|
||||||
height = 7.2,
|
|
||||||
width = 10,
|
|
||||||
show_to = player_name,
|
|
||||||
formspec = {
|
|
||||||
'image[0,0;'..i_width..','..i_height..';'..image..']',
|
|
||||||
b_define(1, 1, 'tl'), b_define(1, 2, 'tc'), b_define(1, 3, 'tr'),
|
|
||||||
b_define(2, 1, 'ml'), b_define(2, 2, 'mc'), b_define(2, 3, 'mr'),
|
|
||||||
b_define(3, 1, 'bl'), b_define(3, 2, 'bc'), b_define(3, 3, 'br'),
|
|
||||||
'label[0,6.5;'..howto..'\n'..p_info..']'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,79 +0,0 @@
|
|||||||
-- # vim: nowrap
|
|
||||||
--
|
|
||||||
-- Set Vim to no-wrapping mode because of some lines not fitting within the 80
|
|
||||||
-- characters width limit due to overall readability of the code.
|
|
||||||
|
|
||||||
|
|
||||||
-- Localise needed functions
|
|
||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local esc = minetest.formspec_escape
|
|
||||||
|
|
||||||
|
|
||||||
-- Render the world map
|
|
||||||
--
|
|
||||||
-- This function renders the world map with the marker of the current time
|
|
||||||
-- zone offset and the buttons for selecting the new time zone.
|
|
||||||
--
|
|
||||||
-- @param offset The current offset as number
|
|
||||||
-- @return string The formspec code for the rendered world map
|
|
||||||
local render_world_map = function (offset)
|
|
||||||
local zones_multiplicator = 10/25
|
|
||||||
local marker_pos = (5 + (offset * zones_multiplicator)) - 0.2
|
|
||||||
local buttons = ''
|
|
||||||
|
|
||||||
for zone = -12,12,1 do
|
|
||||||
local position = (5 + (zone * zones_multiplicator)) - 0.2
|
|
||||||
local template = 'image_button[+position,0;0.4,5;+texture;+id;;;false]'
|
|
||||||
local infotext = S('Set timezone offset to @1', zone)
|
|
||||||
local tooltip = 'tooltip[new_offset_'..zone..';'..infotext..']'
|
|
||||||
|
|
||||||
local button = template:gsub('%+%w+',{
|
|
||||||
['+position'] = position,
|
|
||||||
['+texture'] = 'mtimer_transparent.png',
|
|
||||||
['+id'] = 'new_offset_'..zone
|
|
||||||
})
|
|
||||||
|
|
||||||
buttons = buttons..' '..button..tooltip
|
|
||||||
end
|
|
||||||
|
|
||||||
return table.concat({
|
|
||||||
'image[0,0;10,5;mtimer_world_map.png^[opacity:96]',
|
|
||||||
'box[0,0;10,5;#00000060]', -- background
|
|
||||||
'box['..marker_pos..',0;0.4,5;#729fcf]',
|
|
||||||
buttons
|
|
||||||
}, ' ')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mtimer.dialog.timezone_offset = function (player_name)
|
|
||||||
local time_data = mtimer.get_times(player_name).real_time
|
|
||||||
local offset = time_data.times.offset
|
|
||||||
|
|
||||||
local dst_info = esc(S('Please note that daylight saving time (DST) is ignored entirely due to minimizing implementation complexity. You need to manually adjust the time zone in order to adapt to any DST changes. This messes up the visual representation a bit (but it’s not very accurate anyways …).'))
|
|
||||||
|
|
||||||
mtimer.show_formspec('mtimer:timezone_offset', {
|
|
||||||
title = S('Timezone Offset'),
|
|
||||||
show_to = player_name,
|
|
||||||
width = 10,
|
|
||||||
height = 9.5,
|
|
||||||
formspec = {
|
|
||||||
'container[0,0]',
|
|
||||||
'field_close_on_enter[offset;false]',
|
|
||||||
'label[3.25,0.25;'..S('set a value between -12 and +12 hours')..']',
|
|
||||||
'field[0,0;3,0.5;offset;;'..offset..']',
|
|
||||||
'box[0,0.75;+contentWidth,0.02;#ffffff]',
|
|
||||||
'container_end[]',
|
|
||||||
'container[0,1]',
|
|
||||||
render_world_map(offset),
|
|
||||||
'box[0,5.25;+contentWidth,0.02;#ffffff]',
|
|
||||||
'container_end[]',
|
|
||||||
'container[0,6.625]',
|
|
||||||
'label[0,0;'..S('Current server time: @1', time_data.times.server_time)..']',
|
|
||||||
'label[0,0.4;'.. S('Calculated local time: @1', time_data.times.local_time)..']',
|
|
||||||
'box[0,0.75;+contentWidth,0.02;#ffffff]',
|
|
||||||
'textarea[0,1;10,3;;;'..dst_info..']',
|
|
||||||
'container_end[]',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
@ -1,44 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
|
|
||||||
|
|
||||||
-- Get parsed timer data
|
|
||||||
--
|
|
||||||
-- Returns the parsed timer data (i.e. all variables are replaced with their
|
|
||||||
-- respective values) for the given player referenced by the name.
|
|
||||||
--
|
|
||||||
-- The returned table holds the formatted version as well as the individual
|
|
||||||
-- times (session start, current date, etc.) as configured via the respective
|
|
||||||
-- dialogs. This will be used for the Timer itself as well as in the
|
|
||||||
-- configuration formspec.
|
|
||||||
--
|
|
||||||
-- @param player_name The name of the player to get the timer data for
|
|
||||||
-- @return table The timer data of the player
|
|
||||||
mtimer.get_timer_data = function (player_name)
|
|
||||||
local player_meta = minetest.get_player_by_name(player_name):get_meta()
|
|
||||||
local time_data = mtimer.get_times(player_name)
|
|
||||||
local ingame_time = time_data.ingame_time.formatted
|
|
||||||
local session_start_time = time_data.session_start_time.formatted
|
|
||||||
local session_duration = time_data.session_duration.formatted
|
|
||||||
|
|
||||||
local values = {
|
|
||||||
format = player_meta:get_string(m.meta.timer_format.key),
|
|
||||||
real_world_date = time_data.real_time.formatted,
|
|
||||||
ingame_time = time_data.ingame_time.formatted,
|
|
||||||
session_start_time = time_data.session_start_time.formatted,
|
|
||||||
session_duration = time_data.session_duration.formatted,
|
|
||||||
host_time = time_data.host_time.formatted,
|
|
||||||
custom_timer = time_data.custom_timer.formatted
|
|
||||||
}
|
|
||||||
|
|
||||||
values['formatted'] = values.format:gsub('{[0-9a-z]+}', {
|
|
||||||
['{rd}'] = values.real_world_date,
|
|
||||||
['{it}'] = values.ingame_time,
|
|
||||||
['{st}'] = values.session_start_time,
|
|
||||||
['{sd}'] = values.session_duration,
|
|
||||||
['{ht}'] = values.host_time,
|
|
||||||
['{ct}'] = values.custom_timer
|
|
||||||
})
|
|
||||||
|
|
||||||
return values
|
|
||||||
end
|
|
@ -1,379 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local S = m.translator
|
|
||||||
local ds = minetest.deserialize
|
|
||||||
|
|
||||||
|
|
||||||
-- Manually calculate am/pm
|
|
||||||
--
|
|
||||||
-- Because %p returns am/pm or nothing depending on current locale it is not
|
|
||||||
-- reliable to use it. This function takes a 24h hours value and returns the
|
|
||||||
-- correct meridiem indicator.
|
|
||||||
--
|
|
||||||
-- @param hour The hour to get the indicator for in 24h format
|
|
||||||
-- @return string The meridiem indicator for that hour
|
|
||||||
local get_mi = function (hour)
|
|
||||||
local s_hour = tonumber(hour)
|
|
||||||
if s_hour >= 0 and s_hour <= 11 then return S('am') end -- midnight->noon
|
|
||||||
if s_hour >= 12 and s_hour <= 23 then return S('pm') end -- noon->midnight
|
|
||||||
return S('(ERROR)')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Get translated date names
|
|
||||||
--
|
|
||||||
-- This helper function takes a table containing a numerical month and a
|
|
||||||
-- numerical day of the week and returns the respecive names that are ready
|
|
||||||
-- for being translated.
|
|
||||||
--
|
|
||||||
-- { day = 1, month = 6 } -> { day = S('Monday'), month = S('May') }
|
|
||||||
--
|
|
||||||
-- @param dates A table of dates as described
|
|
||||||
-- @return table The table containing the date names
|
|
||||||
local get_date_names = function (dates)
|
|
||||||
-- %w -> weekday [0-6 = Sunday-Saturday]
|
|
||||||
local weekdays = {
|
|
||||||
S('Sunday'), S('Monday'), S('Tuesday'), S('Wednesday'), S('Thursday'),
|
|
||||||
S('Friday'), S('Saturday')
|
|
||||||
}
|
|
||||||
-- %m -> month [01-12 = January-December]
|
|
||||||
local months = {
|
|
||||||
S('January'), S('February'), S('March'), S('April'), S('May'),
|
|
||||||
S('June'), S('July'), S('August'), S('September'), S('October'),
|
|
||||||
S('November'), S('December')
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
day = weekdays[tonumber(dates.day+1)],
|
|
||||||
month = months[tonumber(dates.month)]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Real-world time handling
|
|
||||||
--
|
|
||||||
-- This function returns the formatted string as well as the raw format string
|
|
||||||
-- and all the replacement values for the variables basing on what time type
|
|
||||||
-- was requested. The types are `real` for the real-world time or `session`
|
|
||||||
-- for the session start time.
|
|
||||||
--
|
|
||||||
-- Both of the times use the same syntax and have the same variables to set so
|
|
||||||
-- one function is used for both when getting the times with `mtimer.get_times`
|
|
||||||
-- where needed.
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- times = {
|
|
||||||
-- server_time = ISO 8601 date of the server’s timestamp,
|
|
||||||
-- server_local = ISO 8601 date of the local ofsetted timestamp,
|
|
||||||
-- offset = timezone offset as set by the player
|
|
||||||
-- },
|
|
||||||
-- variables = {
|
|
||||||
-- hours_24 = 24h representation of the time,
|
|
||||||
-- hours_12 = 12h representation of the time,
|
|
||||||
-- minutes = minutes for the requested time,
|
|
||||||
-- seconds = seconds for the requested time,
|
|
||||||
-- dayname = name of the day for the requested time,
|
|
||||||
-- monthname = name of the month for the requested time,
|
|
||||||
-- year = year of the requested time,
|
|
||||||
-- month = month of the requested time,
|
|
||||||
-- day = day of the requested time,
|
|
||||||
-- iso8601_date = ISO 8601 date part based on the requested time,
|
|
||||||
-- iso8601_time = ISO 8601 time part based on the requested time,
|
|
||||||
-- timestamp = the date’s timestamp
|
|
||||||
-- },
|
|
||||||
-- format = raw string for formatting the requeste time type,
|
|
||||||
-- formatted = the formatted (all variables replaced) string
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- @param player_name The name of the player to get the times for
|
|
||||||
-- @param time_type A Time type as described
|
|
||||||
-- @return table The table containing the data as described
|
|
||||||
local get_real_time_universal = function (player_name, time_type)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local player_meta = player:get_meta()
|
|
||||||
local m_meta = m.meta
|
|
||||||
local timezone_offset = player_meta:get_string(m_meta.timezone_offset.key)
|
|
||||||
local server_timestamp = ''
|
|
||||||
local local_timestamp = ''
|
|
||||||
local format = ''
|
|
||||||
local force_utc = '!'
|
|
||||||
|
|
||||||
if time_type == 'real' then
|
|
||||||
server_timestamp = os.time()
|
|
||||||
local_timestamp = server_timestamp + ((timezone_offset*60)*60)
|
|
||||||
format = player_meta:get_string(m_meta.real_time_format.key)
|
|
||||||
elseif time_type == 'session' then
|
|
||||||
server_timestamp = player_meta:get('mtimer:session_start')
|
|
||||||
local_timestamp = server_timestamp + ((timezone_offset*60)*60)
|
|
||||||
format = player_meta:get_string(m_meta.session_start_time_format.key)
|
|
||||||
elseif time_type == 'host' then
|
|
||||||
server_timestamp = os.time()
|
|
||||||
local_timestamp = server_timestamp
|
|
||||||
format = player_meta:get_string(m_meta.host_time_format.key)
|
|
||||||
force_utc = ''
|
|
||||||
end
|
|
||||||
|
|
||||||
local date_names = get_date_names({
|
|
||||||
day = os.date('!%w', local_timestamp),
|
|
||||||
month = os.date('!%m', local_timestamp)
|
|
||||||
})
|
|
||||||
|
|
||||||
local values = {
|
|
||||||
times = {
|
|
||||||
server_time = os.date('%Y-%m-%dT%H:%M:%S', server_timestamp),
|
|
||||||
local_time = os.date('!%Y-%m-%dT%H:%M:%S', local_timestamp),
|
|
||||||
offset = timezone_offset,
|
|
||||||
},
|
|
||||||
variables = {
|
|
||||||
hours_24 = os.date(force_utc..'%H', local_timestamp),
|
|
||||||
hours_12 = os.date(force_utc..'%I', local_timestamp),
|
|
||||||
minutes = os.date(force_utc..'%M', local_timestamp),
|
|
||||||
seconds = os.date(force_utc..'%S', local_timestamp),
|
|
||||||
indicator = get_mi(os.date(force_utc..'%H', local_timestamp)),
|
|
||||||
dayname = date_names.day,
|
|
||||||
monthname = date_names.month,
|
|
||||||
year = os.date(force_utc..'%Y', local_timestamp),
|
|
||||||
month = os.date(force_utc..'%m', local_timestamp),
|
|
||||||
day = os.date(force_utc..'%d', local_timestamp),
|
|
||||||
iso8601_date = os.date(force_utc..'%Y-%m-%d', local_timestamp),
|
|
||||||
iso8601_time = os.date(force_utc..'%H:%M:%S', local_timestamp),
|
|
||||||
timestamp = local_timestamp
|
|
||||||
},
|
|
||||||
format = format
|
|
||||||
}
|
|
||||||
|
|
||||||
values['formatted'] = format:gsub('{[a-z0-9]+}', {
|
|
||||||
['{24h}'] = values.variables.hours_24,
|
|
||||||
['{12h}'] = values.variables.hours_12,
|
|
||||||
['{min}'] = values.variables.minutes,
|
|
||||||
['{sec}'] = values.variables.seconds,
|
|
||||||
['{mi}'] = values.variables.indicator,
|
|
||||||
['{dname}'] = values.variables.dayname,
|
|
||||||
['{mname}'] = values.variables.monthname,
|
|
||||||
['{year}'] = values.variables.year,
|
|
||||||
['{month}'] = values.variables.month,
|
|
||||||
['{day}'] = values.variables.day,
|
|
||||||
['{isodate}'] = values.variables.iso8601_date,
|
|
||||||
['{isotime}'] = values.variables.iso8601_time,
|
|
||||||
['{timestamp}'] = values.variables.timestamp
|
|
||||||
})
|
|
||||||
|
|
||||||
return values
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Getting the ingame time
|
|
||||||
--
|
|
||||||
-- This function gets and parses the ingame time based on the configuration set
|
|
||||||
-- by the player. The following table is returned.
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- hours_24 = 24h representation of the time,
|
|
||||||
-- hours_12 = 12h representation of the time,
|
|
||||||
-- minutes = minutes for the requested time,
|
|
||||||
-- ingame_timestamp = timestamp of the ingame time (seconds since 0),
|
|
||||||
-- format = raw string for formatting the time,
|
|
||||||
-- formatted = the formatted (all variables replaced) string
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- Calculation: The function `minetest.get_timeofday()` returns a fraction
|
|
||||||
-- between 0 and 1 for the time of the day. Multiplication with
|
|
||||||
-- 24000 converts this number to a millihours value (mh). By
|
|
||||||
-- multiplication with 3.6 the mh value is converted into a
|
|
||||||
-- seconds value that can be used as timestamp.
|
|
||||||
--
|
|
||||||
-- Usabiliy: After 86400 seconds (or 24000 mh) the timestamp returns to 0 and
|
|
||||||
-- thus is only useful to represent the time of the day and nothing
|
|
||||||
-- else like the date or something like that.
|
|
||||||
--
|
|
||||||
-- The generated timestamp is then passed to the os.date() default Lua function
|
|
||||||
-- to parse the human-readable interpretations. Technically this is our own
|
|
||||||
-- epoch timestamp just being reset after 86400 seconds.
|
|
||||||
--
|
|
||||||
-- @param player_name The name of the player to get the time for
|
|
||||||
-- @return table The table as described
|
|
||||||
local get_ingame_time = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local format = player:get_meta():get_string(m.meta.ingame_time_format.key)
|
|
||||||
local time_of_day = math.floor((minetest.get_timeofday() * 24000) * 3.6)
|
|
||||||
local ingame_timestamp = tonumber(string.format('%.0f', time_of_day))
|
|
||||||
|
|
||||||
local values = {
|
|
||||||
hours_24 = os.date('!%H', ingame_timestamp),
|
|
||||||
hours_12 = os.date('!%I', ingame_timestamp),
|
|
||||||
minutes = os.date('!%M', ingame_timestamp),
|
|
||||||
indicator = get_mi(os.date(os.date('!%H', ingame_timestamp))),
|
|
||||||
ingame_timestamp = ingame_timestamp,
|
|
||||||
format = format
|
|
||||||
}
|
|
||||||
|
|
||||||
values['formatted'] = format:gsub('{[a-z0-9]+}', {
|
|
||||||
['{24h}'] = values.hours_24,
|
|
||||||
['{12h}'] = values.hours_12,
|
|
||||||
['{min}'] = values.minutes,
|
|
||||||
['{mi}'] = values.indicator,
|
|
||||||
['{its}'] = values.ingame_timestamp
|
|
||||||
})
|
|
||||||
|
|
||||||
return values
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Getting the session duration
|
|
||||||
--
|
|
||||||
-- This function gets the session start timestamp and the current timestamp and
|
|
||||||
-- calculates the difference in days, hours, minutes, and seconds. The values
|
|
||||||
-- are added to the return table as shown below. Additionaly the format string
|
|
||||||
-- and the formatted result string are added to this table
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- format = raw string for formatting the time,
|
|
||||||
-- difference = the raw difference in seconds,
|
|
||||||
-- days = days the difference is long,
|
|
||||||
-- hours = hours the difference is long,
|
|
||||||
-- minutes = minutes the difference is long,
|
|
||||||
-- seconds = seconds the difference is long,
|
|
||||||
-- formatted = the formatted (all variables replaced) string
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- @param player_name The name of the player to get the duration for
|
|
||||||
-- @return table The table as described
|
|
||||||
local get_session_duration = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local player_meta = player:get_meta()
|
|
||||||
local format = player_meta:get_string(m.meta.session_duration_format.key)
|
|
||||||
local start_timestamp = player_meta:get_string('mtimer:session_start')
|
|
||||||
local current_timestamp = os.time()
|
|
||||||
local difference = current_timestamp - start_timestamp
|
|
||||||
|
|
||||||
local values = {
|
|
||||||
format = format,
|
|
||||||
difference = difference,
|
|
||||||
days = string.format('%02d', math.floor(difference/86400)),
|
|
||||||
hours = string.format('%02d', math.floor((difference % 86400)/3600)),
|
|
||||||
minutes = string.format('%02d', math.floor((difference % 3600)/60)),
|
|
||||||
seconds = string.format('%02d', math.floor((difference % 60)))
|
|
||||||
}
|
|
||||||
|
|
||||||
values['formatted'] = format:gsub('{[a-z0-9]+}', {
|
|
||||||
['{days}'] = values.days,
|
|
||||||
['{hours}'] = values.hours,
|
|
||||||
['{minutes}'] = values.minutes,
|
|
||||||
['{seconds}'] = values.seconds
|
|
||||||
})
|
|
||||||
|
|
||||||
return values
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Custom timer
|
|
||||||
--
|
|
||||||
-- The timer values are loaded from the meta entry and are calculated on
|
|
||||||
-- runtime. The timer knows thre modes.
|
|
||||||
--
|
|
||||||
-- 1. continuous run
|
|
||||||
--
|
|
||||||
-- In this mode the time just runs in a continuous way and all that is
|
|
||||||
-- calculated is the difference between the current timestamp and the
|
|
||||||
-- timestamp from when the timer was started.
|
|
||||||
--
|
|
||||||
-- 2. countdown
|
|
||||||
--
|
|
||||||
-- For the countdown the given input values and the start timestamp are
|
|
||||||
-- added together, then the current timestamp is substracted from this.
|
|
||||||
-- This results in the difference getting smaller and eventually being
|
|
||||||
-- equal or less than 0. In this case the format is changed to the “timer
|
|
||||||
-- finished” format.
|
|
||||||
--
|
|
||||||
-- 3. timer
|
|
||||||
--
|
|
||||||
-- The timer mode calculated the difference like the continuous run mode
|
|
||||||
-- but also calculates a target from the starting timestamp and the input
|
|
||||||
-- values. When the difference is equal or larger than the target the format
|
|
||||||
-- is changed to the “timer finished” format.
|
|
||||||
--
|
|
||||||
-- The output is parsed outside the mode-specific calculations. Also every
|
|
||||||
-- format is parsed with the output time parts. This automatically allows all
|
|
||||||
-- time parts in all formats – wich makes no sense because the difference
|
|
||||||
-- calculation is messed up outside the specific boundaries.
|
|
||||||
local get_custom_timer = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local player_meta = player:get_meta()
|
|
||||||
local ctv = ds(player_meta:get_string(m.meta.custom_timer_settings.key))
|
|
||||||
local current_timestamp = os.time(os.date('!*t'))
|
|
||||||
|
|
||||||
local running = ctv.running
|
|
||||||
local difference = 0
|
|
||||||
local format = ''
|
|
||||||
local finished = false
|
|
||||||
|
|
||||||
if running == false then format = ctv.format.stopped end
|
|
||||||
if running == true and finished == true then format=ctv.format.finished end
|
|
||||||
if running == true and finished == false then format=ctv.format.running end
|
|
||||||
|
|
||||||
-- Calculate seconds from the given input values
|
|
||||||
local value_seconds = 0
|
|
||||||
value_seconds = value_seconds + ctv.values.seconds
|
|
||||||
value_seconds = value_seconds + (ctv.values.minutes * 60)
|
|
||||||
value_seconds = value_seconds + (ctv.values.hours * 3600)
|
|
||||||
value_seconds = value_seconds + (ctv.values.days * 86400)
|
|
||||||
|
|
||||||
-- Continuous run
|
|
||||||
if running == true and ctv.timer_mode == 'continuous' then
|
|
||||||
difference = current_timestamp - (ctv.start_timestamp - value_seconds)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Countdown
|
|
||||||
if running == true and ctv.timer_mode == 'countdown' then
|
|
||||||
difference = (ctv.start_timestamp + value_seconds) - current_timestamp
|
|
||||||
if difference <= 0 then format = ctv.format.finished end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Timer
|
|
||||||
if running == true and ctv.timer_mode == 'timer' then
|
|
||||||
difference = current_timestamp - ctv.start_timestamp
|
|
||||||
local target = ctv.start_timestamp + value_seconds
|
|
||||||
if current_timestamp >= target then format = ctv.format.finished end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Parse values into time parts
|
|
||||||
local result_values = {
|
|
||||||
days = string.format('%02d', math.floor(difference/86400)),
|
|
||||||
hours = string.format('%02d', math.floor((difference % 86400)/3600)),
|
|
||||||
minutes = string.format('%02d', math.floor((difference % 3600)/60)),
|
|
||||||
seconds = string.format('%02d', math.floor((difference % 60)))
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
formatted = format:gsub('{[a-z0-9]+}', {
|
|
||||||
['{days}'] = result_values.days or 0,
|
|
||||||
['{hours}'] = result_values.hours or 0,
|
|
||||||
['{minutes}'] = result_values.minutes or 0,
|
|
||||||
['{seconds}'] = result_values.seconds or 0
|
|
||||||
})
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Get the times
|
|
||||||
--
|
|
||||||
-- Returns the times for the given player referenced by the player’s name as
|
|
||||||
-- a table as shown below.
|
|
||||||
--
|
|
||||||
-- {
|
|
||||||
-- session_start_time = @see get_real_time_universal,
|
|
||||||
-- session_duration = @see get_session_duration,
|
|
||||||
-- real_time = @see get_real_time_universal,
|
|
||||||
-- ingame_time = @see get_ingame_time
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- @param player_name The name of the player to get the times for
|
|
||||||
-- @return table The table containing the times as described
|
|
||||||
mtimer.get_times = function (player_name)
|
|
||||||
return {
|
|
||||||
ingame_time = get_ingame_time(player_name),
|
|
||||||
real_time = get_real_time_universal(player_name, 'real'),
|
|
||||||
host_time = get_real_time_universal(player_name, 'host'),
|
|
||||||
session_start_time = get_real_time_universal(player_name, 'session'),
|
|
||||||
session_duration = get_session_duration(player_name),
|
|
||||||
custom_timer = get_custom_timer(player_name)
|
|
||||||
}
|
|
||||||
end
|
|
@ -1,133 +0,0 @@
|
|||||||
local S = mtimer.translator
|
|
||||||
local worldpath = minetest.get_worldpath()..DIR_DELIM
|
|
||||||
local worldconfig = Settings(worldpath..DIR_DELIM..'_mtimer.conf')
|
|
||||||
|
|
||||||
|
|
||||||
-- Set an option in mtimer.meta configuration table.
|
|
||||||
--
|
|
||||||
-- The function takes an unprefixed key name and tries to get this key’s
|
|
||||||
-- configuration option and sets the table entry with that option and the
|
|
||||||
-- meta key name for that key. Because the meta settings system only allows
|
|
||||||
-- to write strings all values are converted to strings.
|
|
||||||
--
|
|
||||||
-- set('my_cool_key', 1337)
|
|
||||||
--
|
|
||||||
-- This setting creates the following table entry:
|
|
||||||
--
|
|
||||||
-- mtimer.meta.my_cool_key = {
|
|
||||||
-- key = 'mtimer:my_cool_key',
|
|
||||||
-- default = '1337'
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- The default value is searched in the following order When the setting is
|
|
||||||
-- not found in any of the locations an empty string is used
|
|
||||||
--
|
|
||||||
-- 1. Standard `minetest.conf` file that is used for the server
|
|
||||||
-- 2. `_mtimer.conf` in the loaded world’s directory
|
|
||||||
-- 3. Provided default value when calling the function
|
|
||||||
--
|
|
||||||
-- If the value `return_only` is set then the function does only return the
|
|
||||||
-- determined value instead of writing the meta table entry.
|
|
||||||
--
|
|
||||||
-- If `replace` is a key-value table then occurrences of the key in a special
|
|
||||||
-- variable in the configuration value are replaced.
|
|
||||||
--
|
|
||||||
-- replace = {
|
|
||||||
-- foobar = 'My Foobar Value'
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- This example searches for all variables `{_foobar}` and replaces them with
|
|
||||||
-- `'My Foobar Value'`. Note the underscore. The underscore prevents confusion
|
|
||||||
-- with timer-related variables.
|
|
||||||
--
|
|
||||||
-- @param key_name The unprefixed name of the key to get
|
|
||||||
-- @param default_value What to return when the configuration option is missing
|
|
||||||
-- @param return_only Only return the configuration value and do nothing
|
|
||||||
-- @param replace A replacement table as described
|
|
||||||
-- @return string Either the configuration option’s value or an empty string
|
|
||||||
local set = function (key_name, default_value, return_only, replace)
|
|
||||||
local meta_key = 'mtimer:'..key_name
|
|
||||||
local config_option = 'mtimer_'..key_name
|
|
||||||
local value = default_value
|
|
||||||
|
|
||||||
-- Get the setting from one of the possible locations
|
|
||||||
local global_setting = minetest.settings:get(config_option)
|
|
||||||
local world_setting = worldconfig:get(config_option)
|
|
||||||
|
|
||||||
-- Define value
|
|
||||||
value = world_setting or global_setting or default_value or ''
|
|
||||||
if type(replace) == 'table' then value=value:gsub('{_([^}]*)}',replace) end
|
|
||||||
|
|
||||||
-- Return or store value
|
|
||||||
if return_only == true then return tostring(value) end
|
|
||||||
mtimer.meta[key_name] = { key = meta_key, default = tostring(value) }
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set HUD element offset table using the custom values
|
|
||||||
set('hud_element_offset', minetest.serialize({
|
|
||||||
x = set('hud_element_offset_x', 0, true),
|
|
||||||
y = set('hud_element_offset_y', 0, true)
|
|
||||||
}))
|
|
||||||
|
|
||||||
|
|
||||||
-- Display settings
|
|
||||||
set('color', '#ffffff')
|
|
||||||
set('hud_element_scale', 1)
|
|
||||||
set('position', 'bl')
|
|
||||||
set('timezone_offset', 0)
|
|
||||||
set('visible', true)
|
|
||||||
|
|
||||||
|
|
||||||
-- Formatting settings
|
|
||||||
set('host_time_format', '{24h}:{min} ({isodate})')
|
|
||||||
set('ingame_time_format', '{24h}:{min}')
|
|
||||||
set('real_time_format', '{24h}:{min} ({isodate})')
|
|
||||||
set('session_duration_format', '{hours}:{minutes}')
|
|
||||||
set('session_start_time_format', '{isodate}T{isotime}')
|
|
||||||
|
|
||||||
|
|
||||||
-- Custom timer settings
|
|
||||||
--
|
|
||||||
-- `timer_mode` can be one of the following:
|
|
||||||
--
|
|
||||||
-- 'countdown': Counting backwards from the calculated starting point to the
|
|
||||||
-- `start_timestamp` value. The starting point is calculated
|
|
||||||
-- using the input values and `start_timestamp`.
|
|
||||||
--
|
|
||||||
-- 'timer': Counting up from the `start_timestamp` value to the calculated
|
|
||||||
-- target. The target is calculated by the `start_timestamp` and the
|
|
||||||
-- given `input_values`.
|
|
||||||
--
|
|
||||||
-- 'continuous': The timer shows the difference between the current timestamp
|
|
||||||
-- and the stored `start_timestamp`. Here the `target_message`
|
|
||||||
-- is ignored and will never be shown.
|
|
||||||
set('custom_timer_settings', minetest.serialize({
|
|
||||||
values = {
|
|
||||||
days = tonumber(set('custom_timer_value_days', 0, true)),
|
|
||||||
hours = tonumber(set('custom_timer_value_hours', 0, true)),
|
|
||||||
minutes = tonumber(set('custom_timer_value_minutes', 0, true)),
|
|
||||||
seconds = tonumber(set('custom_timer_value_seconds', 0, true))
|
|
||||||
},
|
|
||||||
start_timestamp = 0,
|
|
||||||
format = {
|
|
||||||
running = set('custom_timer_running_format', 'd: {days}, h: {hours}, m: {minutes}, s: {seconds}', true),
|
|
||||||
stopped = set('custom_timer_stopped_format', S('The timer is stopped'), true),
|
|
||||||
finished = set('custom_timer_finished_format', S('The timer has finished'), true)
|
|
||||||
},
|
|
||||||
timer_mode = set('custom_timer_mode', 'countdown', true),
|
|
||||||
running = false
|
|
||||||
}))
|
|
||||||
|
|
||||||
|
|
||||||
-- Timer display format (the HUD element’s content)
|
|
||||||
set('timer_format', table.concat({
|
|
||||||
S('Current Date: @1', '{rd}'),
|
|
||||||
S('Ingame Time: @1', '{it}'),
|
|
||||||
S('Session Start: @1', '{st}'),
|
|
||||||
S('Session Duration: @1', '{sd}')
|
|
||||||
}, '{_n}'), false, { n = '\n' })
|
|
||||||
|
|
||||||
|
|
||||||
-- Hard reset indicator
|
|
||||||
set('hard_reset_everything', 'false')
|
|
@ -1,46 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
|
|
||||||
|
|
||||||
-- When a player joins
|
|
||||||
--
|
|
||||||
-- 1. Check if a hard reset was requested and perform it if it was
|
|
||||||
-- 2. Set default values if not set
|
|
||||||
-- 3. Set session start timestamp
|
|
||||||
-- 4. Set “empty” HUD element and write ID to meta data for later use
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
local meta = player:get_meta()
|
|
||||||
local name = player:get_player_name()
|
|
||||||
local re = meta:get_int('mtimer:hard_reset_everything')
|
|
||||||
|
|
||||||
-- Forecefully remove all meta data set in the player object that starts
|
|
||||||
-- with `mtimer:` prefix (perform the requested reset everything).
|
|
||||||
if re > 0 then
|
|
||||||
local message = m.translator('All configuration was reset. Server time of the requested: @1', os.date('%c', re))
|
|
||||||
for fname,fvalue in pairs(meta:to_table().fields) do
|
|
||||||
if fname:sub(1,7) == 'mtimer:' then
|
|
||||||
meta:set_string(fname, '')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
minetest.chat_send_player(name, '[mTimer] '..message)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set all unset metadata to their defined default values
|
|
||||||
for _,def in pairs(m.meta) do
|
|
||||||
local current = meta:get_string(def.key)
|
|
||||||
if current == '' then meta:set_string(def.key, def.default) end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Always set session start timestamp for using it within the custom timer
|
|
||||||
meta:set_string('mtimer:session_start', os.time())
|
|
||||||
|
|
||||||
-- Initially set empty HUD element to store the ID for updates
|
|
||||||
meta:set_string('mtimer:hud_id', player:hud_add({
|
|
||||||
hud_elem_type = 'text',
|
|
||||||
text = '',
|
|
||||||
number = '0x000000',
|
|
||||||
position = {x=0,y=0},
|
|
||||||
alignment = {x=0,y=0},
|
|
||||||
size = {x=0,y=0},
|
|
||||||
offset = {x=0,y=0}
|
|
||||||
}))
|
|
||||||
end)
|
|
@ -1,350 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local d = mtimer.dialog
|
|
||||||
|
|
||||||
|
|
||||||
-- When formspec data is sent to the server check for the formname and run the
|
|
||||||
-- specific action for the given form. See Individual descriptions. The code
|
|
||||||
-- for this is very simple because most of the logic is handled in the
|
|
||||||
-- timer functions and not in the formspec code.
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
||||||
if not player:is_player() then return end
|
|
||||||
local meta = player:get_meta()
|
|
||||||
local name = player:get_player_name()
|
|
||||||
|
|
||||||
|
|
||||||
-- Select what formspec to show basing on main menu button
|
|
||||||
if formname == 'mtimer:main_menu' then
|
|
||||||
if fields.set_visibility then d.set_visibility(name) end
|
|
||||||
if fields.set_position then d.set_position(name) end
|
|
||||||
if fields.set_color then d.set_color(name) end
|
|
||||||
if fields.timezone_offset then d.timezone_offset(name) end
|
|
||||||
if fields.ingame_time_format then d.ingame_time_format(name) end
|
|
||||||
if fields.real_world_time_format then d.real_world_time_format(name) end
|
|
||||||
if fields.host_time_format then d.host_time_format(name) end
|
|
||||||
if fields.session_start_time_format then
|
|
||||||
d.session_start_time_format(name)
|
|
||||||
end
|
|
||||||
if fields.session_duration_format then
|
|
||||||
d.session_duration_format(name)
|
|
||||||
end
|
|
||||||
if fields.hud_element_scale then d.hud_element_scale(name) end
|
|
||||||
if fields.hud_element_offset then d.hud_element_offset(name) end
|
|
||||||
if fields.timer_format then d.timer_format(name) end
|
|
||||||
if fields.custom_timer then d.custom_timer(name) end
|
|
||||||
if fields.reset_everything then d.reset_everything(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set timer visibility
|
|
||||||
if formname == 'mtimer:set_visibility' then
|
|
||||||
local attr = m.meta.visible
|
|
||||||
if fields.set_visible then meta:set_string(attr.key, 'true') end
|
|
||||||
if fields.set_invisible then meta:set_string(attr.key, 'false') end
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.set_visibility(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set timer position
|
|
||||||
if formname == 'mtimer:set_position' then
|
|
||||||
local attr = m.meta.position
|
|
||||||
for p,_ in pairs(fields) do
|
|
||||||
if p == 'default' then
|
|
||||||
meta:set_string(attr.key, attr.default)
|
|
||||||
elseif p:gsub('_.*', '') == 'pos' then
|
|
||||||
local new_pos = p:gsub('pos_', '')
|
|
||||||
if new_pos ~= 'xx' then meta:set_string(attr.key, new_pos) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not fields.quit then d.set_position(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set timer text color
|
|
||||||
if formname == 'mtimer:set_color' then
|
|
||||||
local attr = m.meta.color
|
|
||||||
local color = ''
|
|
||||||
|
|
||||||
-- Set fields.color to predefined color if a button was clicked
|
|
||||||
if fields.set_color ~= nil then
|
|
||||||
fields.color = '#'..fields.set_color
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Validate the given color and set it
|
|
||||||
if fields.color then
|
|
||||||
local valid = fields.color:match('^#'..('[0-9a-fA-F]'):rep(6)..'$')
|
|
||||||
local color = valid and fields.color or attr.default
|
|
||||||
meta:set_string(attr.key, color)
|
|
||||||
end
|
|
||||||
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.set_color(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Configure timezone offset
|
|
||||||
if formname == 'mtimer:timezone_offset' then
|
|
||||||
local attr = m.meta.timezone_offset
|
|
||||||
local value = tonumber(fields.offset) or attr.default
|
|
||||||
|
|
||||||
-- Check if a timezone offset button was clicked
|
|
||||||
for p,_ in pairs(fields) do
|
|
||||||
if string.sub(p,1,11) == 'new_offset_' then
|
|
||||||
value = tonumber((p:gsub('new_offset_', '')))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Validate and set new timezone offset
|
|
||||||
if fields.offset then
|
|
||||||
if value > 12 then value = 12 end
|
|
||||||
if value < -12 then value = -12 end
|
|
||||||
meta:set_string(attr.key, value)
|
|
||||||
end
|
|
||||||
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.timezone_offset(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set ingame time format
|
|
||||||
if formname == 'mtimer:ingame_time_format' then
|
|
||||||
local attr = m.meta.ingame_time_format
|
|
||||||
local value = fields.format or attr.default
|
|
||||||
meta:set_string(attr.key, value)
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.ingame_time_format(name)end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set real-time format
|
|
||||||
if formname == 'mtimer:real_world_time_format' then
|
|
||||||
local attr = m.meta.real_time_format
|
|
||||||
local value = fields.format or attr.default
|
|
||||||
meta:set_string(attr.key, value)
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.real_world_time_format(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set host time format
|
|
||||||
if formname == 'mtimer:host_time_format' then
|
|
||||||
local attr = m.meta.host_time_format
|
|
||||||
local value = fields.format or attr.default
|
|
||||||
meta:set_string(attr.key, value)
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.host_time_format(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set session start time format
|
|
||||||
if formname == 'mtimer:session_start_time_format' then
|
|
||||||
local attr = m.meta.session_start_time_format
|
|
||||||
local value = fields.format or attr.default
|
|
||||||
meta:set_string(attr.key, value)
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.session_start_time_format(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set session duration format
|
|
||||||
if formname == 'mtimer:session_duration_format' then
|
|
||||||
local attr = m.meta.session_duration_format
|
|
||||||
local value = fields.format or attr.default
|
|
||||||
meta:set_string(attr.key, value)
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.session_duration_format(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set scale of the timer HUD element
|
|
||||||
if formname == 'mtimer:hud_element_scale' then
|
|
||||||
local attr = m.meta.hud_element_scale
|
|
||||||
local value = tonumber(attr.default)
|
|
||||||
local nv_data = minetest.explode_scrollbar_event(fields.new_value)
|
|
||||||
|
|
||||||
-- Set new value if value was changed
|
|
||||||
if nv_data.type == 'CHG' then
|
|
||||||
value = nv_data.value
|
|
||||||
if value < 1 then value = 1 end
|
|
||||||
if value > 10 then value = 10 end
|
|
||||||
meta:set_string(attr.key, value)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- DEVELOPERS: Ideally this formspec would fully reset (like when
|
|
||||||
-- closed and re-opened) to reflect the scale position when
|
|
||||||
-- clicking the “Default” button. But for whatever reason
|
|
||||||
-- this does not work. The scollbar position is simply
|
|
||||||
-- not set accordingly no matter what I tried.
|
|
||||||
--
|
|
||||||
-- A pesky pseudosolution is to accept what it is and just
|
|
||||||
-- inform the player about this fact.
|
|
||||||
--
|
|
||||||
-- Trust me, I tried for roughly 1-2 hours before giving
|
|
||||||
-- up, without having either the formspec not reset when
|
|
||||||
-- clicking the default button or not being able to drag
|
|
||||||
-- the scollbar because the formspec gets re-sent.
|
|
||||||
--
|
|
||||||
-- I even tried to manually closing the formspec and
|
|
||||||
-- re-opening it via `minetest.after` to prevent race
|
|
||||||
-- conditions. This worked with a delay of 0.1 seconds
|
|
||||||
-- every now and then and with smaller delays the whole
|
|
||||||
-- screen looked like it “flashed” because, well, the
|
|
||||||
-- formspec was closed and then re-opened after the delay.
|
|
||||||
--
|
|
||||||
-- But I absolutely hate the solution so I just accepted
|
|
||||||
-- how it works. If everyone ever reading this and knows
|
|
||||||
-- a proper solution to re-sent the formspec and have it
|
|
||||||
-- using the actual value instead of keeping the previous
|
|
||||||
-- value I’d be glad hearing from you :)
|
|
||||||
--
|
|
||||||
-- Have awonderful day!
|
|
||||||
--
|
|
||||||
-- Kind regards,
|
|
||||||
-- Dirk
|
|
||||||
if fields.default then
|
|
||||||
-- This works as expected
|
|
||||||
meta:set_string(attr.key, attr.default)
|
|
||||||
-- it should reset the scrollbar position here when clicking the
|
|
||||||
-- default button but it doesn’t …
|
|
||||||
d.hud_element_scale(name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set offset (used as border/padding) of the timer HUD element
|
|
||||||
if formname == 'mtimer:hud_element_offset' then
|
|
||||||
local attr = m.meta.hud_element_offset
|
|
||||||
local default = minetest.deserialize(attr.default)
|
|
||||||
local x_offset = tonumber(fields.x_offset) or default.x
|
|
||||||
local y_offset = tonumber(fields.y_offset) or default.y
|
|
||||||
|
|
||||||
if fields.x_add_1 then x_offset = x_offset + 1 end
|
|
||||||
if fields.y_add_1 then y_offset = y_offset + 1 end
|
|
||||||
if fields.x_substract_1 then x_offset = x_offset - 1 end
|
|
||||||
if fields.y_substract_1 then y_offset = y_offset - 1 end
|
|
||||||
|
|
||||||
meta:set_string(attr.key, minetest.serialize({
|
|
||||||
x = x_offset,
|
|
||||||
y = y_offset
|
|
||||||
}))
|
|
||||||
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.hud_element_offset(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set timer text
|
|
||||||
if formname == 'mtimer:timer_format' then
|
|
||||||
local attr = m.meta.timer_format
|
|
||||||
local value = fields.format or attr.default
|
|
||||||
meta:set_string(attr.key, value)
|
|
||||||
if fields.default then meta:set_string(attr.key, attr.default) end
|
|
||||||
if not fields.quit then d.timer_format(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Custom timer setting and configuration
|
|
||||||
if formname == 'mtimer:custom_timer' then
|
|
||||||
local attr = m.meta.custom_timer_settings
|
|
||||||
local ctv = minetest.deserialize(meta:get_string(attr.key))
|
|
||||||
local entered = fields.key_enter_field or ''
|
|
||||||
|
|
||||||
-- Set mode
|
|
||||||
if fields.mode_countdown ~= nil then ctv.timer_mode='countdown' end
|
|
||||||
if fields.mode_timer ~= nil then ctv.timer_mode='timer' end
|
|
||||||
if fields.mode_continuous ~= nil then ctv.timer_mode='continuous' end
|
|
||||||
|
|
||||||
-- Validate direct input
|
|
||||||
local days = tonumber(fields.v_days) or 0
|
|
||||||
local hours = tonumber(fields.v_hours) or 0
|
|
||||||
local minutes = tonumber(fields.v_minutes) or 0
|
|
||||||
local seconds = tonumber(fields.v_seconds) or 0
|
|
||||||
|
|
||||||
-- Set values from plus/minus input
|
|
||||||
if fields.c_days_p then days = days + 1 end
|
|
||||||
if fields.c_hours_p then hours = hours + 1 end
|
|
||||||
if fields.c_minutes_p then minutes = minutes + 1 end
|
|
||||||
if fields.c_seconds_p then seconds = seconds + 1 end
|
|
||||||
if fields.c_days_m then days = days - 1 end
|
|
||||||
if fields.c_hours_m then hours = hours - 1 end
|
|
||||||
if fields.c_minutes_m then minutes = minutes - 1 end
|
|
||||||
if fields.c_seconds_m then seconds = seconds - 1 end
|
|
||||||
|
|
||||||
-- Validate values
|
|
||||||
if seconds >= 60 then seconds = 0 minutes = minutes + 1 end
|
|
||||||
if minutes >= 60 then minutes = 0 hours = hours + 1 end
|
|
||||||
if hours >= 24 then hours = 0 days = days + 1 end
|
|
||||||
if seconds < 0 then seconds = 59 minutes = minutes - 1 end
|
|
||||||
if minutes < 0 then minutes = 59 hours = hours - 1 end
|
|
||||||
if hours < 0 then hours = 23 days = days - 1 end
|
|
||||||
if days < 0 then days = 0 end
|
|
||||||
|
|
||||||
-- set relevant values
|
|
||||||
ctv.format = {
|
|
||||||
running = fields.v_format_running,
|
|
||||||
stopped = fields.v_format_stopped,
|
|
||||||
finished = fields.v_format_finished
|
|
||||||
}
|
|
||||||
ctv.values = {
|
|
||||||
days = days,
|
|
||||||
hours = hours,
|
|
||||||
minutes = minutes,
|
|
||||||
seconds = seconds
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Set default values if requested and instantly return to prevent the
|
|
||||||
-- rest of the configuration to be executed. At this point only
|
|
||||||
-- resetting all values is desired.
|
|
||||||
if fields.default then
|
|
||||||
meta:set_string(attr.key, attr.default)
|
|
||||||
d.custom_timer(name)
|
|
||||||
m.update_timer(name)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set values if not quitting
|
|
||||||
if not fields.quit then
|
|
||||||
meta:set_string(attr.key, minetest.serialize(ctv))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Control timer if one of the control buttons was pressed. This is run
|
|
||||||
-- after the values safing in order to use the new values instead of
|
|
||||||
-- the values that were stored before.
|
|
||||||
local ct_update = false
|
|
||||||
if fields.ct_start then ct_update = { action = 'start' } end
|
|
||||||
if fields.ct_stop then ct_update = { action = 'stop' } end
|
|
||||||
if fields.ct_restart then ct_update = { action = 'restart' } end
|
|
||||||
if ct_update~=false then mtimer.update_custom_timer(name,ct_update) end
|
|
||||||
|
|
||||||
-- Show the timer formspec if not quitting
|
|
||||||
if not fields.quit then d.custom_timer(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Reset everything
|
|
||||||
if formname == 'mtimer:reset_everything' then
|
|
||||||
local kick_message = m.translator('You requested a hard reset of the mTimer configuration. This request was stored. As described, you were kicked from the server in order to have the hard reset performed. Please rejoin the server. On rejoin all previously stored configuration regarding mTimer will be deleted.')
|
|
||||||
|
|
||||||
-- Perform a soft reset
|
|
||||||
if fields.reset_soft then
|
|
||||||
for _,def in pairs(m.meta) do
|
|
||||||
meta:set_string(def.key, def.default)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Request hard reset and kick the player with informational message
|
|
||||||
if fields.reset_hard then
|
|
||||||
meta:set_int(m.meta.hard_reset_everything.key, os.time())
|
|
||||||
minetest.kick_player(name, kick_message)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Show main menu formspec when cancelled or close on fields.quit
|
|
||||||
if fields.reset_cancel then d.main_menu(name) return end
|
|
||||||
if not fields.quit then d.reset_everything(name) end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Back to menu from all formspecs and conditionally update timer
|
|
||||||
if fields.main_menu then d.main_menu(name) end
|
|
||||||
if formname ~= 'mtimer:main_menu' then m.update_timer(name) end
|
|
||||||
end)
|
|
@ -1,19 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local update_timer = m.update_timer
|
|
||||||
local connected_players = minetest.get_connected_players
|
|
||||||
local timer = 0
|
|
||||||
|
|
||||||
|
|
||||||
-- The globalstep iterates over all players every second and updates the timers
|
|
||||||
-- by invoking the `mtimer.update_timer` function that has been localized to
|
|
||||||
-- `update_timer` for faster access.
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer + dtime;
|
|
||||||
if timer < 1 then return end
|
|
||||||
|
|
||||||
for _,player in pairs(connected_players()) do
|
|
||||||
update_timer(player:get_player_name())
|
|
||||||
end
|
|
||||||
|
|
||||||
timer = 0
|
|
||||||
end)
|
|
@ -1,182 +0,0 @@
|
|||||||
local m = mtimer
|
|
||||||
local deserialize = minetest.deserialize
|
|
||||||
local cs = minetest.chat_send_player
|
|
||||||
local S = m.translator
|
|
||||||
|
|
||||||
|
|
||||||
-- Calculate HUD positions and offsets
|
|
||||||
--
|
|
||||||
-- Based on the given named position a table of positional tables is returned
|
|
||||||
-- by this helper function. When an invalid named position is provided all
|
|
||||||
-- tables only contain 0 values. Valid positions shown in the diagram below.
|
|
||||||
--
|
|
||||||
-- +--------------------------------+
|
|
||||||
-- | tl tc tr |
|
|
||||||
-- | |
|
|
||||||
-- | |
|
|
||||||
-- | ml mc mr |
|
|
||||||
-- | |
|
|
||||||
-- | |
|
|
||||||
-- | bl bc br |
|
|
||||||
-- +--------------------------------+
|
|
||||||
--
|
|
||||||
-- For orientation: `mc` is the center of the screen (where the crosshair is).
|
|
||||||
-- `bc` is the location of the hotbar and health bars, etc.
|
|
||||||
-- Both are valid positions but should not be used.
|
|
||||||
--
|
|
||||||
-- Provided offsets will be added or substracted according to the position. In
|
|
||||||
-- result the pffset behaves like a border
|
|
||||||
--
|
|
||||||
-- @param pos A positional string as described
|
|
||||||
-- @param poffset An offset table like { x=1, y=1 }
|
|
||||||
-- @return table a Table containing the positional tables based on the string
|
|
||||||
local get_hud_positions = function (pos, offset)
|
|
||||||
local p = { x = 0, y = 0 }
|
|
||||||
local a = { x = 0, y = 0 }
|
|
||||||
local o = { x = 0, y = 0 }
|
|
||||||
|
|
||||||
if pos == 'tl' then
|
|
||||||
p = { x = 0, y = 0 }
|
|
||||||
a = { x = 1, y = 1 }
|
|
||||||
o = { x = 5 + offset.x, y = 3 + offset.y }
|
|
||||||
end
|
|
||||||
if pos == 'tc' then
|
|
||||||
p = { x = 0.5, y = 0 }
|
|
||||||
a = { x = 0, y = 1 }
|
|
||||||
o = { x = 0 - offset.x, y = 3 + offset.y }
|
|
||||||
end
|
|
||||||
if pos == 'tr' then
|
|
||||||
p = { x = 1, y = 0 }
|
|
||||||
a = { x=-1, y = 1 }
|
|
||||||
o = { x = -6 - offset.x, y = 3 + offset.y }
|
|
||||||
end
|
|
||||||
if pos == 'ml' then
|
|
||||||
p = { x = 0, y = 0.5 }
|
|
||||||
a = { x = 1, y = 0 }
|
|
||||||
o = { x = 5 + offset.x, y = 0 + offset.y }
|
|
||||||
end
|
|
||||||
if pos == 'mc' then
|
|
||||||
p = { x = 0.5,y = 0.5 }
|
|
||||||
a = { x = 0, y = 0 }
|
|
||||||
o = { x = 0 + offset.x, y = 0 + offset.y }
|
|
||||||
end
|
|
||||||
if pos == 'mr' then
|
|
||||||
p = { x = 1, y = 0.5 }
|
|
||||||
a = { x = -1,y = 0 }
|
|
||||||
o = { x = -6 - offset.x, y = 0 + offset.y }
|
|
||||||
end
|
|
||||||
if pos == 'bl' then
|
|
||||||
p = { x = 0, y = 1 }
|
|
||||||
a = { x = 1, y = -1 }
|
|
||||||
o = { x = 5 + offset.x, y = 0 - offset.y }
|
|
||||||
end
|
|
||||||
if pos == 'bc' then
|
|
||||||
p = { x = 0.5, y = 1 }
|
|
||||||
a = { x = 0, y = -1 }
|
|
||||||
o = { x = 0 + offset.x, y = 0 - offset.y }
|
|
||||||
end
|
|
||||||
if pos == 'br' then
|
|
||||||
p = { x = 1, y = 1 }
|
|
||||||
a = { x = -1, y = -1 }
|
|
||||||
o = { x = -6 - offset.x, y = 0 - offset.y }
|
|
||||||
end
|
|
||||||
|
|
||||||
return { position = p, alignment = a, offset = o }
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Update the timer
|
|
||||||
--
|
|
||||||
-- This function updates the timer for the given player referenced by the
|
|
||||||
-- player’s name. The function is called when a formspec update (fields) is
|
|
||||||
-- sent to the server and is automatically called by the registered globalstep.
|
|
||||||
--
|
|
||||||
-- The function sets the needed values based on the player meta data and uses
|
|
||||||
-- the `mtimer.get_timer_data` function for the actual data to be shown.
|
|
||||||
--
|
|
||||||
-- @param player_name Name of the player to update the timer for
|
|
||||||
-- @return void
|
|
||||||
mtimer.update_timer = function (player_name)
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local meta = player:get_meta()
|
|
||||||
local m = m.meta
|
|
||||||
local hud_id = meta:get_string('mtimer:hud_id')
|
|
||||||
|
|
||||||
local text = mtimer.get_timer_data(player_name).formatted
|
|
||||||
local number = meta:get_string(m.color.key):gsub('#', '0x')
|
|
||||||
local scale = meta:get_string(m.hud_element_scale.key)
|
|
||||||
|
|
||||||
local position = meta:get_string(m.position.key)
|
|
||||||
local offset = deserialize(meta:get_string(m.hud_element_offset.key))
|
|
||||||
local orientation = get_hud_positions(position, offset)
|
|
||||||
|
|
||||||
if meta:get_string(m.visible.key) == 'false' then text = '' end
|
|
||||||
|
|
||||||
player:hud_change(hud_id, 'text', text)
|
|
||||||
player:hud_change(hud_id, 'number', number)
|
|
||||||
player:hud_change(hud_id, 'position', orientation.position)
|
|
||||||
player:hud_change(hud_id, 'alignment', orientation.alignment)
|
|
||||||
player:hud_change(hud_id, 'size', {x=scale, y=scale})
|
|
||||||
player:hud_change(hud_id, 'offset', orientation.offset)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Update the custom timer
|
|
||||||
--
|
|
||||||
-- This function handles updates for the custom timer for the player referenced
|
|
||||||
-- by the provided `name` parameter. This needs to be a player name string.
|
|
||||||
--
|
|
||||||
-- The update is performed based on the provided table.
|
|
||||||
--
|
|
||||||
-- update_parameters = {
|
|
||||||
-- action = 'the_action'
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- Currently the only actions are `start`, `stop`, and `restart`.
|
|
||||||
--
|
|
||||||
-- @param player_name The name of the player to update the custom timer for
|
|
||||||
-- @param update_parameters The update parameters table as described
|
|
||||||
mtimer.update_custom_timer = function (player_name, update_parameters)
|
|
||||||
local up = update_parameters or {}
|
|
||||||
local player = minetest.get_player_by_name(player_name)
|
|
||||||
local player_meta = player:get_meta()
|
|
||||||
local current_timestamp = os.time(os.date('!*t'))
|
|
||||||
local ctv_key = m.meta.custom_timer_settings.key
|
|
||||||
local ctv = minetest.deserialize(player_meta:get_string(ctv_key))
|
|
||||||
|
|
||||||
-- Start timer if not running
|
|
||||||
if up.action == 'start' then
|
|
||||||
if ctv.running ~= true then
|
|
||||||
ctv.running = true
|
|
||||||
ctv.start_timestamp = current_timestamp
|
|
||||||
cs(player_name, S('The custom timer was started'))
|
|
||||||
else
|
|
||||||
cs(player_name, S('The custom timer is already running'))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Stop timer if running
|
|
||||||
if up.action == 'stop' then
|
|
||||||
if ctv.running ~= false then
|
|
||||||
ctv.running = false
|
|
||||||
ctv.start_timestamp = 0
|
|
||||||
cs(player_name, S('The custom timer was stopped'))
|
|
||||||
else
|
|
||||||
cs(player_name, S('The custom timer is not running'))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Restart timer
|
|
||||||
if up.action == 'restart' then
|
|
||||||
if ctv.running == true then
|
|
||||||
ctv.start_timestamp = current_timestamp
|
|
||||||
cs(player_name, S('The custom timer was restarted'))
|
|
||||||
else
|
|
||||||
cs(player_name, S('The custom timer is not running'))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Write timer update to player meta data
|
|
||||||
player_meta:set_string(ctv_key, minetest.serialize(ctv))
|
|
||||||
end
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
## License
|
|
||||||
|
|
||||||
If not specified otherwise: All textures are released under CC-BY-SA 4.0 or newer.
|
|
||||||
|
|
||||||
* <https://creativecommons.org/licenses/by-sa/4.0/>
|
|
||||||
|
|
||||||
## Buttons and Icons
|
|
||||||
|
|
||||||
All textures within the `buttons` or `icons` directories are taken from the Tango icon library base icon theme. This base icon theme is released under Public Domain by the Tango Desktop Project at freedesktop.org.
|
|
||||||
|
|
||||||
* <http://tango.freedesktop.org/Tango_Icon_Library>
|
|
||||||
* <http://tango.freedesktop.org/Tango_Desktop_Project>
|
|
||||||
* <https://www.freedesktop.org>
|
|
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 229 KiB |
Before Width: | Height: | Size: 75 B |
Before Width: | Height: | Size: 2.1 KiB |
BIN
thumbnail.png
Before Width: | Height: | Size: 563 KiB |