Giter Site home page Giter Site logo

xp_redo's Introduction

Minetest XP mod (xp_redo)

luacheck

Minetest mod for player experience management (xp) It adds an xp counter per player and ranks according to your xp level. The xp level, your rank and a progress bar to the next rank will show up in your hud. On every rank level up you get a award-like notification. There is also a xpgate block which, when placed under a wooden door will only allow players with a certain xp level to go through.

Installation

  • Unzip the archive, rename the folder to xp_redo and place it in .. minetest/mods/

  • GNU/Linux: If you use a system-wide installation place it in ~/.minetest/mods/.

  • If you only want this to be used in a single world, place the folder in .. worldmods/ in your world directory.

For further information or help, see:
https://wiki.minetest.net/Installing_Mods

Privileges

  • givexp: Manage XP of your users.

Commands

Add or remove (amount with negative sign) XP from a user:

/givexp (username) (amount)

Examples:
Give player somedude 200 XP points.

/givexp somedude 200

Remove 100 XP points from player somedude.

/givexp somedude -100

Dependencies

Optional dependencies

Areas integration

There are additional commands available if the areas mod is available:

  • /area_xp_set_min <id> <xp> assign a min-value that a aplayer needs to interact with the area
  • /area_xp_get_min <id> returns the min-value, if any for that area

For this to work the area has to be opened with /area_open <id>

Builtin XP events

Digging

Every node dig gives you 1 xp point

Punching

Every mob punch gives you the amount of damage on the mob in xp

Ranks

See:

Settings

  • xp_redo.discord.webhook_url Discord webhook URL (optional)
  • xp_redo.discord.texture_baseurl Base URL for the webhook avatar image (optional)

For the webhook, the mod has to be in the secure.http_mods setting (in minetest.conf):

secure.http_mods = xp_redo

Lua api

Ranks

xp_redo.register_rank(rankDef)

rankDef = {
	name = "Rank name",
	icon = "myicon.png" -- Should fit withing the background icon (16x32px)
	color = {r=255, g=255, b=255}, -- Player name tag color
	xp = 100 -- xp threshold
}

Ranks are held in xp_redo.ranks as a table.

xp_redo.get_rank(xpAmount)

Returns the rankDef for given xp amount

Hooks

xp_redo.register_hook({
  xp_change = function(playername, xp)
    -- new xp value
  end,

  rank_change = function(playername, xp, rank)
    -- new rank
  end,

  stat_change = function(playername, name, value)
    -- see stats.lua
  end
})

XP

xp_redo.get_xp(playername)

Returns the XP level for given playername (always a number).

xp_redo.add_xp(playername, xp)

Adds the amount of xp to given playername (can be negative for xp removal).

License

See LICENSE.txt

Pull requests / bugs

I'm happy for any bug reports or pull requests (code and textures).

TODO / Ideas

  • Scoreboard (block)
  • More doors
  • Door-teleport alternative
  • XP Regions
  • XP entities/items

xp_redo's People

Contributors

blaboing avatar buckaroobanzay avatar coil0 avatar lukc avatar naturefreshmilk avatar ogelgames avatar panquesito7 avatar s-s-x avatar swissalps avatar thomasrudin avatar thomasrudinzid1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

xp_redo's Issues

xp.display_hover_entity = true makes entity disappear

Should the settingnames not be the other way round?

currently

xp.display_hover_entity = true

leads to the entity not displayed

xp.display_hover_entity = false

leads to the entity displayed

I'd expect the opposite, when false the entity not shown and when true the entity shown

Add xp-protector

like the "normal" protector but with configurable xp (for ex. public areas)

player request

A request:
Can you please change the color of "XP details and progress bar on right hand bottom" from blue to something like magenta or orange or lime. it's really hurt eyes in days and night both. currently, it's blue not much contrasting against minetest backgrounds.

Feature Request: Better HUD display

Instead of showing an XP bar and a separate HUD for Rank and experience, this should all be on the XP bar.

Current XP Bar:

[ XP: % Fulfilled ]

Suggested XP Bar:

Rank:
[ XP: % Fulfilled, Current XP/Next Level XP ]

Rank listed above XP bar.

Undeclared global variable "QoS"

2021-04-25 08:28:32: WARNING[Main]: Undeclared global variable "QoS" accessed at /home/thomas/.minetest/mods/xp_redo/init.lua:30 [MOD] Protector Redo Tool: registered protector:tool for xp_redo:protector [Mod] xp_redo (081a016/15.03.2021) - (82) end with 15468 KB

just downloaded version at my start after take it in

Missing dependence

Add the mod areas to the optional dependencies.
It crashes, if the mod is there.

Greetings, Clyde.

closed as wrong repository

deleted

may lost my mind after last night 5 hours no electric ...

posted in hopefully right area now.

some undeclared globals

2020-07-19 15:40:32: WARNING[Server]: Assignment to undeclared global "comma_value" inside a function at /home/thomas/.minetest/mods/xp_redo/chatcmd.lua:74.
2020-07-19 15:40:32: WARNING[Server]: Assignment to undeclared global "tzspace" inside a function at /home/thomas/.minetest/mods/xp_redo/chatcmd.lua:92.
2020-07-19 15:40:32: WARNING[Server]: Assignment to undeclared global "k" inside a function at /home/thomas/.minetest/mods/xp_redo/chatcmd.lua:77.

Planting crops doesn't give XP

Planting crops from farming does not give XP, even when done manually. It's possible there was an explicit check for this and it shouldn't give XP.

Hud Rank Icon not scaled

When using the ore ranks and a texture pack with, say 128x128, the rank icon is not scaled down.

Repro when using ore ranks and some higher resolution textueres like sharpik's or drummyfish's. In those cases the rank icon is displayed as large as an eigth of my screen.

Make hud optional

Chat-interface:

/xp_hud small|full|none

Programmatic api (proposal for external hud implementation):

xp_redo.disable_default_hud()

deprecated code

2021-03-17 22:32:33: WARNING[Server]: Deprecated call to get_attribute, use MetaDataRef methods instead. (at ...minetest/minetest/bin/../mods/xp_redo/globalstep.lua:8)

display_hover_entity = false and ore ranks => register_rank_entity = nil

ModError: Failed to load and run script from F:\temp\5.2.0\minetest-5.2.0-win64-test\bin..\mods\xp_redo_ranks_ores\init.lua:
...\minetest-5.2.0-win64-test\bin..\mods\xp_redo/ranks.lua:6: attempt to call field 'register_rank_entity' (a nil value)
stack traceback:
...\minetest-5.2.0-win64-test\bin..\mods\xp_redo/ranks.lua:6: in function 'register_rank'
....2.0-win64-test\bin..\mods\xp_redo_ranks_ores/ranks.lua:87: in main chunk
[C]: in function 'dofile'
...5.2.0-win64-test\bin..\mods\xp_redo_ranks_ores\init.lua:4: in main chunk
Siehe debug.txt für Details.

Seems like entity.lua is ruled out by the setting, but when registering ranks from external ranks.lua tries to call xp_redo.register_rank_entity(def) (which is not there) without checking the setting.

limiter

https://github.com/mt-mods/xp_redo/blob/master/builtin.lua#L80

More as of lucky I realized yesterday that there is something changed or wrong in xp-redo

As I calculated the hill size Bonat should dig to get about 100.000 XP it was far less that expected.

As testing then with the legal

  • mod multitool ... plus
  • mod toll level, toll had level 100 as we most have tools with 1.000.000 digged nodes

I realized that our earlier this year chosen fasted digging option down by flying over the nodes
that from each row digging down and move we get most only 4 of 5 nodes counted, sometimes even only 3 XP out of it.

Whatever the reason for this limiter is (huge Papyrus towers I read) the limiter is set TOO LOW.
WE have proofed in months and thousands of XP that this digging is LEGAL and should not be cut off.

raise the limiter about 20-25%, tell me and I test if it is 'correct; then.

screwdriver not an optional dependency

When running with default but without screwdriver mod:

2023-08-23 16:25:30: WARNING[Main]: Undeclared global variable "screwdriver" accessed at ...ary/Application Support/minetest/mods/xp_redo/xpgate.lua:26
2023-08-23 16:25:30: ERROR[Main]: ModError: Failed to load and run script from /Users/user/Library/Application Support/minetest/mods/xp_redo/init.lua:
2023-08-23 16:25:30: ERROR[Main]: ...ary/Application Support/minetest/mods/xp_redo/xpgate.lua:26: attempt to index global 'screwdriver' (a nil value)
2023-08-23 16:25:30: ERROR[Main]: stack traceback:
2023-08-23 16:25:30: ERROR[Main]: 	...ary/Application Support/minetest/mods/xp_redo/xpgate.lua:26: in main chunk
2023-08-23 16:25:30: ERROR[Main]: 	[C]: in function 'dofile'
2023-08-23 16:25:30: ERROR[Main]: 	...brary/Application Support/minetest/mods/xp_redo/init.lua:52: in main chunk

Double license files causes problems with git on Windows

Currently there are two license files: LICENSE.txt and license.txt. The identical (except for case) names are not compatible with the Windows file system, which causes git to merge them (or at least that's what seems to have happened for me), and then say that they have been modified.

I'd suggest either combining the two files, or moving the smaller license.txt into the license section of the readme.

Add xp-restriction block

Limits players from entering the area and teleports them to spawn after a warning
Formspec:

  • xp-threshold (number)
  • radius (number)

Expose explicit api

Current api surface (stable):

xp_redo.get_rank(xp) : returns rank definition
xp_redo.get_xp(playername) : returns xp-value
xp_redo.add_xp(playername, xp) : adds or subtracts xp points

Less stable:

xp_redo.ranks : List with rank-defs
xp_redo.register_rank(rank-def) : adds a rank

Rank-Definition:

{
	name="Private Second Class",
	icon="xp_rank_01_private_second.png",
	color={r=255, g=245, b=245},
	xp=10
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.