Initial commit.

master
David G 2018-06-23 19:47:12 -07:00
commit 7870047696
21 changed files with 267 additions and 0 deletions

121
LICENSE.txt Normal file
View File

@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

37
README.md Normal file
View File

@ -0,0 +1,37 @@
Realcompass
===========
**compass** *(n)* A mechanical or electronic instrument used for navigation or orienteering,
which points to the physical or magnetic north pole.
This is a fork of compassgps (and compass), with 90% of the code removed.
David_G (kestral246@gmail.com)
Features
--------
It's only feature is to act like a real compass and always point to the north.
Crafting guide
--------------
```
, steel_ingot ,
steel_ingot, mese_crystal_fragment, steel_ingot
, steel_ingot ,
```
License
-------
- **textures:** original compass textures: CC BY-SA by Echo (45deg versions added by kestral246 also CC BY-SA)
- **code:** My changes to original code are CC0-1.0
- **original compassgps license:** Original code by Echo, PilzAdam, and TeTpaAka is WTFPL. Kilarin (Donald Hines) changes are CC0 (No rights reserved)
Thanks
------
- [compassgps](https://github.com/Kilarin/compassgps) / Kilarin (Donald Hines),
et. al.

1
depends.txt Normal file
View File

@ -0,0 +1 @@
default

1
description.txt Normal file
View File

@ -0,0 +1 @@
A simple compass that only points north.

107
init.lua Normal file
View File

@ -0,0 +1,107 @@
-- realcompass 1.0
-- This fork written by David_G (kestral246@gmail.com)
-- My changes are CC0 (No rights reserved)
-- textures: original compass textures: CC BY-SA by Echo (I added 45deg versions)
-- Changes:
-- only points north
-- 16 directions instead of 12
-- based on compassgps 2.7 and compass 0.5
--
--Original code by Echo, PilzAdam, and TeTpaAka is WTFPL.
--Original code by Kilarin (Donald Hines) is CC0 (No rights reserved).
--fixed bug that caused compass to jump around in inventory
local activewidth=8 --until I can find some way to get it from minetest
minetest.register_globalstep(function(dtime)
local players = minetest.get_connected_players()
for i,player in ipairs(players) do
local gotacompass=false
local wielded=false
local activeinv=nil
local stackidx=0
--first check to see if the user has a compass, because if they don't
--there is no reason to waste time calculating bookmarks or spawnpoints.
local wielded_item = player:get_wielded_item():get_name()
if string.sub(wielded_item, 0, 12) == "realcompass:" then
--if the player is wielding a compass, change the wielded image
wielded=true
stackidx=player:get_wield_index()
gotacompass=true
else
--check to see if compass is in active inventory
if player:get_inventory() then
--is there a way to only check the activewidth items instead of entire list?
--problem being that arrays are not sorted in lua
for i,stack in ipairs(player:get_inventory():get_list("main")) do
if i<=activewidth and string.sub(stack:get_name(), 0, 12) == "realcompass:" then
activeinv=stack --store the stack so we can update it later with new image
stackidx=i --store the index so we can add image at correct location
gotacompass=true
break
end --if i<=activewidth
end --for loop
end -- get_inventory
end --if wielded else
--dont mess with the rest of this if they don't have a compass
--update to remove legacy get_look_yaw function
if gotacompass then
local dir = player:get_look_horizontal()
local angle_relative = math.deg(dir)
local compass_image = math.floor((angle_relative/22.5) + 0.5)%16
--update compass image to point at target
if wielded then
player:set_wielded_item("realcompass:"..compass_image)
elseif activeinv then
player:get_inventory():set_stack("main",stackidx,"realcompass:"..compass_image)
end --if wielded elsif activin
end --if gotacompass
end --for i,player in ipairs(players)
end) -- register_globalstep
local images = {
"realcompass_0.png",
"realcompass_1.png",
"realcompass_2.png",
"realcompass_3.png",
"realcompass_4.png",
"realcompass_5.png",
"realcompass_6.png",
"realcompass_7.png",
"realcompass_8.png",
"realcompass_9.png",
"realcompass_10.png",
"realcompass_11.png",
"realcompass_12.png",
"realcompass_13.png",
"realcompass_14.png",
"realcompass_15.png",
}
local i
for i,img in ipairs(images) do
local inv = 1
if i == 1 then
inv = 0
end
minetest.register_tool("realcompass:"..(i-1), {
description = "Real Compass",
inventory_image = img,
wield_image = img,
groups = {not_in_creative_inventory=inv}
})
end
minetest.register_craft({
output = 'realcompass:1',
recipe = {
{'', 'default:steel_ingot', ''},
{'default:steel_ingot', 'default:mese_crystal_fragment', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''}
}
})

BIN
textures/realcompass_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

BIN
textures/realcompass_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

BIN
textures/realcompass_10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

BIN
textures/realcompass_11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

BIN
textures/realcompass_12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

BIN
textures/realcompass_13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

BIN
textures/realcompass_14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

BIN
textures/realcompass_15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

BIN
textures/realcompass_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

BIN
textures/realcompass_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

BIN
textures/realcompass_4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

BIN
textures/realcompass_5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

BIN
textures/realcompass_6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

BIN
textures/realcompass_7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

BIN
textures/realcompass_8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

BIN
textures/realcompass_9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B