feat(world): voxel chunks + procedural underwater generation + biomes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
102
scripts/world/BlockDatabase.gd
Normal file
102
scripts/world/BlockDatabase.gd
Normal file
@@ -0,0 +1,102 @@
|
||||
extends Node
|
||||
|
||||
enum BlockType {
|
||||
AIR = 0,
|
||||
WATER = 1,
|
||||
SAND = 2,
|
||||
ROCK = 3,
|
||||
CORAL_RED = 4,
|
||||
CORAL_BLUE = 5,
|
||||
KELP = 6,
|
||||
WRECK_WOOD = 7,
|
||||
ICE = 8,
|
||||
BEDROCK = 9
|
||||
}
|
||||
|
||||
const _BLOCKS: Dictionary = {
|
||||
BlockType.AIR: {
|
||||
"name": "Air",
|
||||
"color": Color(0.0, 0.0, 0.0, 0.0),
|
||||
"hardness": 0.0,
|
||||
"drops": []
|
||||
},
|
||||
BlockType.WATER: {
|
||||
"name": "Eau",
|
||||
"color": Color(0.1, 0.4, 0.8, 0.6),
|
||||
"hardness": 0.0,
|
||||
"drops": []
|
||||
},
|
||||
BlockType.SAND: {
|
||||
"name": "Sable",
|
||||
"color": Color(0.76, 0.70, 0.50, 1.0),
|
||||
"hardness": 0.5,
|
||||
"drops": [BlockType.SAND]
|
||||
},
|
||||
BlockType.ROCK: {
|
||||
"name": "Roche",
|
||||
"color": Color(0.45, 0.45, 0.45, 1.0),
|
||||
"hardness": 2.0,
|
||||
"drops": [BlockType.ROCK]
|
||||
},
|
||||
BlockType.CORAL_RED: {
|
||||
"name": "Corail Rouge",
|
||||
"color": Color(0.90, 0.25, 0.20, 1.0),
|
||||
"hardness": 0.3,
|
||||
"drops": [BlockType.CORAL_RED]
|
||||
},
|
||||
BlockType.CORAL_BLUE: {
|
||||
"name": "Corail Bleu",
|
||||
"color": Color(0.20, 0.50, 0.95, 1.0),
|
||||
"hardness": 0.3,
|
||||
"drops": [BlockType.CORAL_BLUE]
|
||||
},
|
||||
BlockType.KELP: {
|
||||
"name": "Algue",
|
||||
"color": Color(0.15, 0.60, 0.20, 1.0),
|
||||
"hardness": 0.1,
|
||||
"drops": [BlockType.KELP]
|
||||
},
|
||||
BlockType.WRECK_WOOD: {
|
||||
"name": "Bois d'Épave",
|
||||
"color": Color(0.35, 0.22, 0.12, 1.0),
|
||||
"hardness": 1.0,
|
||||
"drops": [BlockType.WRECK_WOOD]
|
||||
},
|
||||
BlockType.ICE: {
|
||||
"name": "Glace",
|
||||
"color": Color(0.75, 0.90, 1.0, 0.85),
|
||||
"hardness": 0.8,
|
||||
"drops": []
|
||||
},
|
||||
BlockType.BEDROCK: {
|
||||
"name": "Bedrock",
|
||||
"color": Color(0.15, 0.15, 0.15, 1.0),
|
||||
"hardness": -1.0,
|
||||
"drops": []
|
||||
}
|
||||
}
|
||||
|
||||
func is_solid(id: int) -> bool:
|
||||
if id == BlockType.AIR or id == BlockType.WATER or id == BlockType.KELP:
|
||||
return false
|
||||
return true
|
||||
|
||||
func get_color(id: int) -> Color:
|
||||
if _BLOCKS.has(id):
|
||||
return _BLOCKS[id]["color"]
|
||||
return Color(1.0, 0.0, 1.0, 1.0)
|
||||
|
||||
func get_block_name(id: int) -> String:
|
||||
if _BLOCKS.has(id):
|
||||
return _BLOCKS[id]["name"]
|
||||
return "Unknown"
|
||||
|
||||
func get_hardness(id: int) -> float:
|
||||
if _BLOCKS.has(id):
|
||||
return _BLOCKS[id]["hardness"]
|
||||
return 1.0
|
||||
|
||||
func get_drops(id: int) -> Array:
|
||||
if _BLOCKS.has(id):
|
||||
return _BLOCKS[id]["drops"]
|
||||
return []
|
||||
Reference in New Issue
Block a user