Skip to content

Commit c8b4bed

Browse files
t4imparamat
authored andcommittedJul 26, 2016
Builtin: Add core.MAP_BLOCKSIZE constant
1 parent 58eb5f3 commit c8b4bed

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

Diff for: ‎builtin/game/constants.lua

+5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@
44
-- Constants values for use with the Lua API
55
--
66

7+
-- mapnode.h
78
-- Built-in Content IDs (for use with VoxelManip API)
89
core.CONTENT_UNKNOWN = 125
910
core.CONTENT_AIR = 126
1011
core.CONTENT_IGNORE = 127
1112

13+
-- emerge.h
1214
-- Block emerge status constants (for use with core.emerge_area)
1315
core.EMERGE_CANCELLED = 0
1416
core.EMERGE_ERRORED = 1
1517
core.EMERGE_FROM_MEMORY = 2
1618
core.EMERGE_FROM_DISK = 3
1719
core.EMERGE_GENERATED = 4
20+
21+
-- constants.h
22+
core.MAP_BLOCKSIZE = 16

Diff for: ‎builtin/game/forceloading.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ core.forceload_free_block = nil
77
local blocks_forceloaded
88
local total_forceloaded = 0
99

10-
local BLOCKSIZE = 16
10+
local BLOCKSIZE = core.MAP_BLOCKSIZE
1111
local function get_blockpos(pos)
1212
return {
1313
x = math.floor(pos.x/BLOCKSIZE),

1 commit comments

Comments
 (1)

ShadowNinja commented on Aug 3, 2016

@ShadowNinja
Contributor

Not hugely importnt, but this should probably be set from the constant in the C++ source. If not that, then just add a comment to the constant directing users who change the block size to also change this line.

Please sign in to comment.