Coder Social home page Coder Social logo

ccompass's Introduction

ccompass

This minetest mod adds a calibratable compass to the minetest. Original mod here

For Players:

<TODO: nice screenshot>

  1. Craft the compass as before using the crafting recipe. The new compass points to the origin / Zero point and is already usable.
  2. Punch the compass to a compatible node (all by default) and enter the target name
  3. Now this compass leads you allways to this location. You can give it away to allow other users to find this place.
  4. Punch a teleport compatible node (by default mese block) to teleport back to the calibrated place

For server owners:

The mod support the next settings:

static_spawnpoint - use this position instead 0,0,0 as initial target
ccompass_recalibrate (enabled by default): If disabled each compass can be calibrated one time only
ccompass_restrict_target (Disabled by default): If enabled, only specific nodes are allowed for calibration (usable with any type waypoint nodes for example)
ccompass_restrict_target_nodes: List of technical node names allowed for compass calibration, separated by ','
ccompass_aliasses: If enabled the compas:* items will be aliased to the ccompass:* items for compatibility
ccompass_teleport_nodes: List of technical node names that triggers the teleport to destination, separated by ','

For developers:

  1. It is possible to change compass settings from other mods by changing values in global table ccompass. So it is possible for example to add a waypoint node to the target-nodes by
	ccompass.recalibrate = true
	ccompass.restrict_target = true
	ccompass.restrict_target_nodes["schnitzeljagd:waypoint"] = true
	ccompass.teleport_nodes["default:diamondblock"] = true
  1. The pointed node metadata will be checked for "waypoint_name" attribute. It this attribute is set, the calibration screen take this string as proposal. This can be used for a game specific calibration node. To get it working working just set in node definition something like
          after_place_node = function(pos, placer)
             local meta = minetest.get_meta(pos)
             meta:set_string("waypoint_name", "the unique and wunderfull place")
             meta:set_string("waypoint_pos", minetest.pos_to_string(target_pos)) -- if an other position should be the target instead of the node position
             meta:set_string("waypoint_skip_namechange", "skip") -- do not ask for the waypoint name
          end,
  1. It is possible to create pre-calibrated compasses trough other mods. Just write the position to the Itemstack meta:
    stack:get_meta():set_string("target_pos", minetest.pos_to_string(pos))
Recalibration related to a user should be done by function call
    local stack = ItemStack("ccompass:0")
    ccompass.set_target(stack, {
             target_pos_string = minetest.pos_to_string(pos),
             target_name = waypoint_name,
             playername = player:get_player_name()
    })
  1. Each time the compass is updated, a hook is called, if defined in other mod. The hook is usefull to implement wear or any other compass manipulation logic.
    function ccompass.usage_hook(compass_stack, player)
        --do anything with compass_stack
        return modified_compass_stack
    end

ccompass's People

Contributors

bell07 avatar downad avatar

Watchers

James Cloos avatar

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.