diff --git a/assets/Data/entity/foliage.json b/assets/Data/entity/foliage.json index 1916bd80..1203294b 100644 --- a/assets/Data/entity/foliage.json +++ b/assets/Data/entity/foliage.json @@ -190,8 +190,18 @@ } ], "healthSystem" : { - "maxHealth" : 100, - "onDamageIFrames" : 5 + "maxHealth" : 50, + "onDamageIFrames" : 5, + "lootPool" : { + "tickets" : [ + { + "itemId" : "Log", + "rarity" : 0.8, + "minQuantity" : 0, + "maxQuantity" : 2 + } + ] + } }, "graphicsTemplate": { "model": { diff --git a/assets/Data/entity/items.json b/assets/Data/entity/items.json index 7df0503a..460b0d49 100644 --- a/assets/Data/entity/items.json +++ b/assets/Data/entity/items.json @@ -1,435 +1,11 @@ { "items" : [ - - - - { - "id" : "Katana", - "modelPath" : "Models/items/weapons/katana1alt.fbx", - "weaponData" : { - "weaponClass" : "sword1h", - "damage" : 10, - "hitboxes" : [ - { - "type": "hit_connected", - "bone": "Blade1", - "radius": 0.04 - }, - { - "type": "hit_connected", - "bone": "Blade2", - "radius": 0.04 - }, - { - "type": "hit_connected", - "bone": "Blade3", - "radius": 0.04 - } - ] - }, - "equipData": { - "equipClass" : "weapon" - }, - "tokens" : [ - "GRAVITY", - "MELEE", - "TARGETABLE", - "OUTLINE" - ], - "idleAnim" : "Sword|Idle", - "collidable": { - "type" : "CUBE", - "dimension1" : 0.03, - "dimension2" : 0.03, - "dimension3" : 0.2, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0.0, - "offsetY" : 0.05, - "offsetZ" : 0.0 - }, - "iconPath" : "Textures/icons/itemIconWeapon.png" - }, - { - "id" : "Katana2H", - "weaponData" : { - "weaponClass" : "sword2h", - "damage" : 10, - "weaponActionMovePenalty" : 0.4, - "hitboxes" : [ - { - "type": "hit_connected", - "bone": "Blade1", - "radius": 0.06, - "offset": [0, 0, -0.03] - }, - { - "type": "hit_connected", - "bone": "Blade2", - "radius": 0.06, - "offset": [0, 0, -0.1] - }, - { - "type": "hit_connected", - "bone": "Blade2", - "radius": 0.06, - "offset": [0, 0, 0.02] - }, - { - "type": "hit_connected", - "bone": "Blade3", - "radius": 0.06, - "offset": [0, 0, -0.07] - }, - { - "type": "hit_connected", - "bone": "Blade3", - "radius": 0.06, - "offset": [0, 0, 0.05] - }, - { - "type": "hit_connected", - "bone": "Blade3", - "radius": 0.06, - "offset": [0, 0, 0.15] - } - ] - }, - "itemBlockData": { - - }, - "equipData": { - "equipClass" : "weapon2H" - }, - "itemAudio": { - "uiGrabAudio" : "Audio/ui/items/specific/Pick Up Metal A.wav", - "uiReleaseAudio" : "Audio/ui/items/specific/Drop Metal A.wav" - }, - "tokens" : [ - "GRAVITY", - "MELEE", - "TARGETABLE", - "OUTLINE" - ], - "graphicsTemplate": { - "model": { - "idleData": { - "animation": { - "nameFirstPerson" : "Idle", - "nameThirdPerson" : "Idle", - "priorityCategory" : "IDLE" - } - }, - "path" : "Models/items/weapons/katana1alt.glb" - } - }, - "boneGroups" : [ - { - "id" : "torso", - "boneNamesThirdPerson" : [] - } - ], - "collidable": { - "type" : "CUBE", - "dimension1" : 0.04, - "dimension2" : 0.04, - "dimension3" : 0.8, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0.0, - "offsetY" : 0.0, - "offsetZ" : 0.0 - }, - "iconPath" : "Textures/icons/greatsword.png" - }, - { - "id" : "bow1", - "modelPath": "Models/bow1.fbx", - "weaponData" : { - "weaponClass" : "bow2h", - "damage" : 10, - "projectileModel" : "Models/arrow1.fbx" - }, - "equipData": { - "equipClass" : "weapon" - }, - "tokens" : [ - "GRAVITY", - "RANGED", - "TARGETABLE", - "OUTLINE" - ], - "collidable": { - "type" : "CUBE", - "dimension1" : 0.1, - "dimension2" : 0.1, - "dimension3" : 0.35, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0, - "offsetY" : 0.05, - "offsetZ" : 0 - }, - "iconPath" : "Textures/icons/itemIconWeapon.png" - }, - - { - "id" : "shorts1", - "modelPath": "Models/items/itemEntityShorts.fbx", - "equipData": { - "equipClass" : "clothing", - "equipWhitelist" : [ - { - "creatureId" : "human", - "model" : "Models/creatures/person2/clothing/shorts1.fbx", - "meshList" : [ - "ClothingItem" - ], - "meshMaskList" : [ - "Shorts" - ] - } - ] - }, - "tokens" : [ - "GRAVITY", - "TARGETABLE" - ], - "collidable": { - "type" : "CUBE", - "dimension1" : 0.1, - "dimension2" : 0.1, - "dimension3" : 0.35, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0, - "offsetY" : 0.05, - "offsetZ" : 0 - }, - "iconPath" : "Textures/icons/itemIconItemGeneric.png" - }, - - { - "id" : "hairshort1", - "modelPath": "Models/itemEntityShorts.fbx", - "equipData": { - "equipClass" : "trait", - "equipWhitelist" : [ - { - "creatureId" : "human", - "model" : "Models/hairshort1.fbx", - "meshList" : [ - "Hair" - ], - "meshMaskList" : [] - } - ] - }, - "tokens" : [ - "GRAVITY", - "ARMOR", - "TARGETABLE" - ], - "equipClass" : "trait", - "collidable": { - "type" : "CUBE", - "dimension1" : 0.1, - "dimension2" : 0.1, - "dimension3" : 0.35, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0, - "offsetY" : 0.05, - "offsetZ" : 0 - }, - "iconPath" : "Textures/icons/itemIconItemGeneric.png" - }, - - { - "id" : "boots1", - "modelPath": "Models/boots1.glb", - "tokens" : [ - "GRAVITY", - "ARMOR", - "TARGETABLE" - ], - "equipData": { - "equipClass" : "clothing", - "equipWhitelist" : [ - { - "creatureId" : "human", - "model" : "Models/boots1.glb", - "meshList" : [ - "BootLeft", - "BootRight" - ], - "meshMaskList" : [ - ] - } - ] - }, - "collidable": { - "type" : "CUBE", - "dimension1" : 0.1, - "dimension2" : 0.1, - "dimension3" : 0.35, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0, - "offsetY" : 0.05, - "offsetZ" : 0 - }, - "iconPath" : "Textures/icons/itemIconItemGeneric.png" - }, - - { - "id" : "shirt1", - "modelPath": "Models/itemEntityShorts.fbx", - "tokens" : [ - "GRAVITY", - "ARMOR", - "TARGETABLE" - ], - "equipData": { - "equipClass" : "clothing", - "equipWhitelist" : [ - { - "creatureId" : "human", - "model" : "Models/shirt1.fbx", - "meshList" : [ - "ClothingItem" - ], - "meshMaskList" : [ - "ShoulderLeft", - "ShoulderRight" - ] - } - ] - }, - "collidable": { - "type" : "CUBE", - "dimension1" : 0.1, - "dimension2" : 0.1, - "dimension3" : 0.35, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0, - "offsetY" : 0.05, - "offsetZ" : 0 - }, - "iconPath" : "Textures/icons/itemIconItemGeneric.png" - }, - - { - "id" : "terrainTool", - "tokens" : [ - "GRAVITY", - "TARGETABLE" - ], - "equipData": { - "equipClass" : "tool" - }, - "graphicsTemplate": { - "model": { - "path" : "Models/items/weapons/shovel1.glb" - } - }, - "clientSidePrimary": "ADD_VOXEL", - "clientSideSecondary": "OPEN_VOXEL", - "collidable": { - "type" : "CUBE", - "dimension1" : 0.1, - "dimension2" : 0.1, - "dimension3" : 0.35, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0, - "offsetY" : 0.05, - "offsetZ" : 0 - }, - "iconPath" : "Textures/icons/itemIconItemGeneric.png" - }, - - { - "id" : "spawningPalette", - "tokens" : [ - "GRAVITY", - "TARGETABLE" - ], - "equipData": { - "equipClass" : "tool" - }, - "graphicsTemplate": { - "model": { - "path" : "Models/basic/geometry/unitvector.glb" - } - }, - "clientSidePrimary": "LEVEL_EDIT_SPAWN", - "clientSideSecondary": "OPEN_SPAWN_SELECT", - "collidable": { - "type" : "CUBE", - "dimension1" : 0.1, - "dimension2" : 0.1, - "dimension3" : 0.35, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0, - "offsetY" : 0.05, - "offsetZ" : 0 - }, - "iconPath" : "Textures/icons/itemIconItemGeneric.png" - }, - { - "id" : "entityinspector", - "tokens" : [ - "GRAVITY", - "TARGETABLE" - ], - "equipData": { - "equipClass" : "tool" - }, - "graphicsTemplate": { - "model": { - "path" : "Models/items/weapons/shovel1.glb" - } - }, - "clientSideSecondary": "INSPECTOR", - "collidable": { - "type" : "CUBE", - "dimension1" : 0.1, - "dimension2" : 0.1, - "dimension3" : 0.35, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "rotW": 1, - "offsetX" : 0, - "offsetY" : 0.05, - "offsetZ" : 0 - }, - "iconPath" : "Textures/icons/itemIconItemGeneric.png" - } - - - - + + ], + "files" : [ + "Data/entity/items/weapons.json", + "Data/entity/items/tools.json", + "Data/entity/items/clothing.json", + "Data/entity/items/materials.json" ] } \ No newline at end of file diff --git a/assets/Data/entity/items/clothing.json b/assets/Data/entity/items/clothing.json new file mode 100644 index 00000000..98ffb146 --- /dev/null +++ b/assets/Data/entity/items/clothing.json @@ -0,0 +1,161 @@ +{ + "items" : [ + { + "id" : "shorts1", + "modelPath": "Models/items/itemEntityShorts.fbx", + "equipData": { + "equipClass" : "clothing", + "equipWhitelist" : [ + { + "creatureId" : "human", + "model" : "Models/creatures/person2/clothing/shorts1.fbx", + "meshList" : [ + "ClothingItem" + ], + "meshMaskList" : [ + "Shorts" + ] + } + ] + }, + "tokens" : [ + "GRAVITY", + "TARGETABLE" + ], + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconItemGeneric.png" + }, + + { + "id" : "hairshort1", + "modelPath": "Models/itemEntityShorts.fbx", + "equipData": { + "equipClass" : "trait", + "equipWhitelist" : [ + { + "creatureId" : "human", + "model" : "Models/hairshort1.fbx", + "meshList" : [ + "Hair" + ], + "meshMaskList" : [] + } + ] + }, + "tokens" : [ + "GRAVITY", + "ARMOR", + "TARGETABLE" + ], + "equipClass" : "trait", + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconItemGeneric.png" + }, + + { + "id" : "boots1", + "modelPath": "Models/boots1.glb", + "tokens" : [ + "GRAVITY", + "ARMOR", + "TARGETABLE" + ], + "equipData": { + "equipClass" : "clothing", + "equipWhitelist" : [ + { + "creatureId" : "human", + "model" : "Models/boots1.glb", + "meshList" : [ + "BootLeft", + "BootRight" + ], + "meshMaskList" : [ + ] + } + ] + }, + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconItemGeneric.png" + }, + + { + "id" : "shirt1", + "modelPath": "Models/itemEntityShorts.fbx", + "tokens" : [ + "GRAVITY", + "ARMOR", + "TARGETABLE" + ], + "equipData": { + "equipClass" : "clothing", + "equipWhitelist" : [ + { + "creatureId" : "human", + "model" : "Models/shirt1.fbx", + "meshList" : [ + "ClothingItem" + ], + "meshMaskList" : [ + "ShoulderLeft", + "ShoulderRight" + ] + } + ] + }, + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconItemGeneric.png" + } + + ], + "files" : [ + ] +} \ No newline at end of file diff --git a/assets/Data/entity/items/materials.json b/assets/Data/entity/items/materials.json new file mode 100644 index 00000000..59b0a4c6 --- /dev/null +++ b/assets/Data/entity/items/materials.json @@ -0,0 +1,32 @@ +{ + "items" : [ + { + "id" : "Log", + "tokens" : [ + "GRAVITY", + "TARGETABLE" + ], + "graphicsTemplate": { + "model": { + "path" : "Models/items/materials/log.glb" + } + }, + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconItemGeneric.png" + } + ], + "files" : [ + ] +} \ No newline at end of file diff --git a/assets/Data/entity/items/tools.json b/assets/Data/entity/items/tools.json new file mode 100644 index 00000000..07ab4346 --- /dev/null +++ b/assets/Data/entity/items/tools.json @@ -0,0 +1,99 @@ +{ + "items" : [ + { + "id" : "terrainTool", + "tokens" : [ + "GRAVITY", + "TARGETABLE" + ], + "equipData": { + "equipClass" : "tool" + }, + "graphicsTemplate": { + "model": { + "path" : "Models/items/weapons/shovel1.glb" + } + }, + "clientSidePrimary": "ADD_VOXEL", + "clientSideSecondary": "OPEN_VOXEL", + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconItemGeneric.png" + }, + + { + "id" : "spawningPalette", + "tokens" : [ + "GRAVITY", + "TARGETABLE" + ], + "equipData": { + "equipClass" : "tool" + }, + "graphicsTemplate": { + "model": { + "path" : "Models/basic/geometry/unitvector.glb" + } + }, + "clientSidePrimary": "LEVEL_EDIT_SPAWN", + "clientSideSecondary": "OPEN_SPAWN_SELECT", + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconItemGeneric.png" + }, + { + "id" : "entityinspector", + "tokens" : [ + "GRAVITY", + "TARGETABLE" + ], + "equipData": { + "equipClass" : "tool" + }, + "graphicsTemplate": { + "model": { + "path" : "Models/items/weapons/shovel1.glb" + } + }, + "clientSideSecondary": "INSPECTOR", + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconItemGeneric.png" + } + ], + "files" : [ + ] +} \ No newline at end of file diff --git a/assets/Data/entity/items/weapons.json b/assets/Data/entity/items/weapons.json new file mode 100644 index 00000000..0a470e25 --- /dev/null +++ b/assets/Data/entity/items/weapons.json @@ -0,0 +1,188 @@ +{ + "items" : [ + + + + { + "id" : "Katana", + "modelPath" : "Models/items/weapons/katana1alt.fbx", + "weaponData" : { + "weaponClass" : "sword1h", + "damage" : 10, + "hitboxes" : [ + { + "type": "hit_connected", + "bone": "Blade1", + "radius": 0.04 + }, + { + "type": "hit_connected", + "bone": "Blade2", + "radius": 0.04 + }, + { + "type": "hit_connected", + "bone": "Blade3", + "radius": 0.04 + } + ] + }, + "equipData": { + "equipClass" : "weapon" + }, + "tokens" : [ + "GRAVITY", + "MELEE", + "TARGETABLE", + "OUTLINE" + ], + "idleAnim" : "Sword|Idle", + "collidable": { + "type" : "CUBE", + "dimension1" : 0.03, + "dimension2" : 0.03, + "dimension3" : 0.2, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0.0, + "offsetY" : 0.05, + "offsetZ" : 0.0 + }, + "iconPath" : "Textures/icons/itemIconWeapon.png" + }, + { + "id" : "Katana2H", + "weaponData" : { + "weaponClass" : "sword2h", + "damage" : 10, + "weaponActionMovePenalty" : 0.4, + "hitboxes" : [ + { + "type": "hit_connected", + "bone": "Blade1", + "radius": 0.06, + "offset": [0, 0, -0.03] + }, + { + "type": "hit_connected", + "bone": "Blade2", + "radius": 0.06, + "offset": [0, 0, -0.1] + }, + { + "type": "hit_connected", + "bone": "Blade2", + "radius": 0.06, + "offset": [0, 0, 0.02] + }, + { + "type": "hit_connected", + "bone": "Blade3", + "radius": 0.06, + "offset": [0, 0, -0.07] + }, + { + "type": "hit_connected", + "bone": "Blade3", + "radius": 0.06, + "offset": [0, 0, 0.05] + }, + { + "type": "hit_connected", + "bone": "Blade3", + "radius": 0.06, + "offset": [0, 0, 0.15] + } + ] + }, + "itemBlockData": { + + }, + "equipData": { + "equipClass" : "weapon2H" + }, + "itemAudio": { + "uiGrabAudio" : "Audio/ui/items/specific/Pick Up Metal A.wav", + "uiReleaseAudio" : "Audio/ui/items/specific/Drop Metal A.wav" + }, + "tokens" : [ + "GRAVITY", + "MELEE", + "TARGETABLE", + "OUTLINE" + ], + "graphicsTemplate": { + "model": { + "idleData": { + "animation": { + "nameFirstPerson" : "Idle", + "nameThirdPerson" : "Idle", + "priorityCategory" : "IDLE" + } + }, + "path" : "Models/items/weapons/katana1alt.glb" + } + }, + "boneGroups" : [ + { + "id" : "torso", + "boneNamesThirdPerson" : [] + } + ], + "collidable": { + "type" : "CUBE", + "dimension1" : 0.04, + "dimension2" : 0.04, + "dimension3" : 0.8, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0.0, + "offsetY" : 0.0, + "offsetZ" : 0.0 + }, + "iconPath" : "Textures/icons/greatsword.png" + }, + { + "id" : "bow1", + "modelPath": "Models/bow1.fbx", + "weaponData" : { + "weaponClass" : "bow2h", + "damage" : 10, + "projectileModel" : "Models/arrow1.fbx" + }, + "equipData": { + "equipClass" : "weapon" + }, + "tokens" : [ + "GRAVITY", + "RANGED", + "TARGETABLE", + "OUTLINE" + ], + "collidable": { + "type" : "CUBE", + "dimension1" : 0.1, + "dimension2" : 0.1, + "dimension3" : 0.35, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "rotW": 1, + "offsetX" : 0, + "offsetY" : 0.05, + "offsetZ" : 0 + }, + "iconPath" : "Textures/icons/itemIconWeapon.png" + } + + + + + ], + "files" : [ + ] +} \ No newline at end of file diff --git a/assets/Models/items/materials/log.glb b/assets/Models/items/materials/log.glb new file mode 100644 index 00000000..4b44442f Binary files /dev/null and b/assets/Models/items/materials/log.glb differ diff --git a/assets/Models/items/materials/logmodel.png b/assets/Models/items/materials/logmodel.png new file mode 100644 index 00000000..062584bc Binary files /dev/null and b/assets/Models/items/materials/logmodel.png differ diff --git a/assets/Models/items/materials/texturemap.json b/assets/Models/items/materials/texturemap.json new file mode 100644 index 00000000..919497d5 --- /dev/null +++ b/assets/Models/items/materials/texturemap.json @@ -0,0 +1,11 @@ +{ + "textureMap": { + "Models/items/materials/log.glb": [ + { + "meshName" : "Cylinder", + "diffuse" : "/Models/items/materials/logmodel.png", + "isDefault" : true + } + ] + } +} \ No newline at end of file diff --git a/buildNumber.properties b/buildNumber.properties index 42dfb1d4..8e132c94 100644 --- a/buildNumber.properties +++ b/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Wed Nov 13 15:53:18 EST 2024 -buildNumber=382 +#Wed Nov 13 21:13:23 EST 2024 +buildNumber=384 diff --git a/docs/src/progress/bigthings.md b/docs/src/progress/bigthings.md index a124af11..6d732764 100644 --- a/docs/src/progress/bigthings.md +++ b/docs/src/progress/bigthings.md @@ -2,6 +2,7 @@ # and may or may not have the sanity to build DONE: + - Transvoxel Algorithm TODO(?): @@ -11,8 +12,6 @@ TODO(?): - Multigrid optimization - Network optimization - - Transvoxel Algorithm - - Building cube voxels w/ LOD - Audio Ray Tracing diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 3d268472..eacc919a 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1020,6 +1020,10 @@ Fix entity repositioning bugs + Enable recursive logic Fix hitbox manager handling of destruction Fix gridded data cell manager player + entity position handling and refactor to simplify logic Add debug options for entities to reposition on server +Item data refactor to make it recursive +Loot pool data definition +Implement items dropping from entities on death +Officially mark transvoxel algo as solved diff --git a/docs/src/tools/gimp/gimp.md b/docs/src/tools/gimp/gimp.md new file mode 100644 index 00000000..fd0b797b --- /dev/null +++ b/docs/src/tools/gimp/gimp.md @@ -0,0 +1,6 @@ +@page gimp Gimp + +Articles on using gimp with the project + +[TOC] + - @subpage gimpressionist \ No newline at end of file diff --git a/docs/src/tools/gimp/gimpressionist.md b/docs/src/tools/gimp/gimpressionist.md new file mode 100644 index 00000000..b80faa1f --- /dev/null +++ b/docs/src/tools/gimp/gimpressionist.md @@ -0,0 +1,7 @@ +@page gimpressionist Gimpressionist + +To convert a high res photo into something a little more impressionistic, apply the filters +blur/gaussian blur +artistic/GIMPressionist + +This should give you a starting line to paint over and make something looking decently painted. \ No newline at end of file diff --git a/docs/src/tools/toolsindex.md b/docs/src/tools/toolsindex.md index c8468583..3c92d938 100644 --- a/docs/src/tools/toolsindex.md +++ b/docs/src/tools/toolsindex.md @@ -5,3 +5,4 @@ - @subpage codegenindex - @subpage indexdocumentation - @subpage jenkins + - @subpage gimp diff --git a/src/main/java/electrosphere/client/item/ItemActions.java b/src/main/java/electrosphere/client/item/ItemActions.java index 4321782f..750c4971 100644 --- a/src/main/java/electrosphere/client/item/ItemActions.java +++ b/src/main/java/electrosphere/client/item/ItemActions.java @@ -7,7 +7,7 @@ import electrosphere.entity.state.attack.ClientAttackTree; import electrosphere.entity.state.attack.ShooterTree; import electrosphere.entity.state.equip.ClientToolbarState; import electrosphere.entity.types.creature.CreatureUtils; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.Item; import electrosphere.net.parser.net.message.InventoryMessage; /** diff --git a/src/main/java/electrosphere/client/ui/components/EquipmentInventoryPanel.java b/src/main/java/electrosphere/client/ui/components/EquipmentInventoryPanel.java index 908e2283..e3b3fa95 100644 --- a/src/main/java/electrosphere/client/ui/components/EquipmentInventoryPanel.java +++ b/src/main/java/electrosphere/client/ui/components/EquipmentInventoryPanel.java @@ -15,7 +15,7 @@ import electrosphere.entity.state.inventory.RelationalInventoryState; import electrosphere.entity.state.inventory.UnrelationalInventoryState; import electrosphere.entity.types.item.ItemUtils; import electrosphere.game.data.creature.type.equip.EquipPoint; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.Item; import electrosphere.logger.LoggerInterface; import electrosphere.renderer.ui.elements.Div; import electrosphere.renderer.ui.elements.ImagePanel; diff --git a/src/main/java/electrosphere/client/ui/components/NaturalInventoryPanel.java b/src/main/java/electrosphere/client/ui/components/NaturalInventoryPanel.java index 668b3f98..b42a0a8f 100644 --- a/src/main/java/electrosphere/client/ui/components/NaturalInventoryPanel.java +++ b/src/main/java/electrosphere/client/ui/components/NaturalInventoryPanel.java @@ -12,7 +12,7 @@ import electrosphere.entity.state.inventory.InventoryUtils; import electrosphere.entity.state.inventory.RelationalInventoryState; import electrosphere.entity.state.inventory.UnrelationalInventoryState; import electrosphere.entity.types.item.ItemUtils; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.Item; import electrosphere.logger.LoggerInterface; import electrosphere.renderer.ui.elements.Div; import electrosphere.renderer.ui.elements.ImagePanel; diff --git a/src/main/java/electrosphere/client/ui/components/SpawnSelectionPanel.java b/src/main/java/electrosphere/client/ui/components/SpawnSelectionPanel.java index f5ee0c39..69b98ce5 100644 --- a/src/main/java/electrosphere/client/ui/components/SpawnSelectionPanel.java +++ b/src/main/java/electrosphere/client/ui/components/SpawnSelectionPanel.java @@ -95,7 +95,7 @@ public class SpawnSelectionPanel { List types = new LinkedList(); types.addAll(Globals.gameConfigCurrent.getCreatureTypeLoader().getTypes()); types.addAll(Globals.gameConfigCurrent.getFoliageMap().getFoliageList()); - types.addAll(Globals.gameConfigCurrent.getItemMap().getItems()); + types.addAll(Globals.gameConfigCurrent.getItemMap().getTypes()); types.addAll(Globals.gameConfigCurrent.getObjectTypeMap().getTypes()); types = types.stream().filter((type)->type.getId().toLowerCase().contains(searchString.toLowerCase())).toList(); diff --git a/src/main/java/electrosphere/client/ui/components/ToolbarInventoryPanel.java b/src/main/java/electrosphere/client/ui/components/ToolbarInventoryPanel.java index 8e42fbf4..86c098c0 100644 --- a/src/main/java/electrosphere/client/ui/components/ToolbarInventoryPanel.java +++ b/src/main/java/electrosphere/client/ui/components/ToolbarInventoryPanel.java @@ -13,7 +13,7 @@ import electrosphere.entity.state.inventory.InventoryUtils; import electrosphere.entity.state.inventory.RelationalInventoryState; import electrosphere.entity.state.inventory.UnrelationalInventoryState; import electrosphere.entity.types.item.ItemUtils; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.Item; import electrosphere.logger.LoggerInterface; import electrosphere.renderer.ui.elements.Div; import electrosphere.renderer.ui.elements.ImagePanel; diff --git a/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsInventory.java b/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsInventory.java index 0fcf5c7b..50a3e878 100644 --- a/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsInventory.java +++ b/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsInventory.java @@ -8,7 +8,7 @@ import electrosphere.engine.Globals; import electrosphere.engine.assetmanager.AssetDataStrings; import electrosphere.entity.state.inventory.InventoryUtils; import electrosphere.entity.types.item.ItemUtils; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.Item; import electrosphere.logger.LoggerInterface; import electrosphere.renderer.ui.elements.Div; import electrosphere.renderer.ui.elements.Window; diff --git a/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsLevelEditor.java b/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsLevelEditor.java index 61f1c4ce..cc418d1b 100644 --- a/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsLevelEditor.java +++ b/src/main/java/electrosphere/client/ui/menu/ingame/MenuGeneratorsLevelEditor.java @@ -20,7 +20,7 @@ import electrosphere.entity.types.item.ItemUtils; import electrosphere.game.data.common.CommonEntityType; import electrosphere.game.data.creature.type.CreatureData; import electrosphere.game.data.foliage.type.FoliageType; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.Item; import electrosphere.game.data.units.UnitDefinition; import electrosphere.logger.LoggerInterface; import electrosphere.renderer.light.DirectionalLight; @@ -259,7 +259,7 @@ public class MenuGeneratorsLevelEditor { })); //button for spawning all foliage types - for(Item item : Globals.gameConfigCurrent.getItemMap().getItems()){ + for(Item item : Globals.gameConfigCurrent.getItemMap().getTypes()){ //spawn foliage button scrollable.addChild(Button.createButton("Spawn " + item.getId(), () -> { LoggerInterface.loggerEngine.INFO("spawn " + item.getId() + "!"); diff --git a/src/main/java/electrosphere/client/ui/menu/script/ScriptLevelEditorUtils.java b/src/main/java/electrosphere/client/ui/menu/script/ScriptLevelEditorUtils.java index 79cd91c8..5fcf0ed6 100644 --- a/src/main/java/electrosphere/client/ui/menu/script/ScriptLevelEditorUtils.java +++ b/src/main/java/electrosphere/client/ui/menu/script/ScriptLevelEditorUtils.java @@ -16,7 +16,7 @@ import electrosphere.entity.types.foliage.FoliageUtils; import electrosphere.entity.types.item.ItemUtils; import electrosphere.game.data.creature.type.CreatureData; import electrosphere.game.data.foliage.type.FoliageType; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.Item; import electrosphere.logger.LoggerInterface; import electrosphere.server.datacell.Realm; diff --git a/src/main/java/electrosphere/collision/CollisionEngine.java b/src/main/java/electrosphere/collision/CollisionEngine.java index eb3dc434..b7adbe05 100644 --- a/src/main/java/electrosphere/collision/CollisionEngine.java +++ b/src/main/java/electrosphere/collision/CollisionEngine.java @@ -718,25 +718,29 @@ public class CollisionEngine { */ protected void destroyDBody(DBody body){ spaceLock.acquireUninterruptibly(); - if(bodies.contains(body)){ - bodies.remove(body); + try { + if(bodies.contains(body)){ + bodies.remove(body); + } + //destroy all geometries + Iterator geomIterator = body.getGeomIterator(); + while(geomIterator.hasNext()){ + DGeom geom = geomIterator.next(); + space.remove(geom); + geom.DESTRUCTOR(); + geom.destroy(); + } + //destroy all joints + for(int i = 0; i < body.getNumJoints(); i++){ + DJoint joint = body.getJoint(i); + joint.DESTRUCTOR(); + joint.destroy(); + } + //destroy actual body + body.destroy(); + } catch (NullPointerException ex){ + LoggerInterface.loggerEngine.ERROR(ex); } - //destroy all geometries - Iterator geomIterator = body.getGeomIterator(); - while(geomIterator.hasNext()){ - DGeom geom = geomIterator.next(); - space.remove(geom); - geom.DESTRUCTOR(); - geom.destroy(); - } - //destroy all joints - for(int i = 0; i < body.getNumJoints(); i++){ - DJoint joint = body.getJoint(i); - joint.DESTRUCTOR(); - joint.destroy(); - } - //destroy actual body - body.destroy(); spaceLock.release(); } diff --git a/src/main/java/electrosphere/entity/state/attack/ClientAttackTree.java b/src/main/java/electrosphere/entity/state/attack/ClientAttackTree.java index 2beae0a0..72d4d269 100644 --- a/src/main/java/electrosphere/entity/state/attack/ClientAttackTree.java +++ b/src/main/java/electrosphere/entity/state/attack/ClientAttackTree.java @@ -21,7 +21,7 @@ import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.entity.types.item.ItemUtils; import electrosphere.game.data.common.treedata.TreeDataState; import electrosphere.game.data.creature.type.attack.AttackMove; -import electrosphere.game.data.item.type.WeaponData; +import electrosphere.game.data.item.WeaponData; import electrosphere.net.parser.net.message.EntityMessage; import electrosphere.net.synchronization.annotation.SyncedField; import electrosphere.net.synchronization.annotation.SynchronizableEnum; diff --git a/src/main/java/electrosphere/entity/state/attack/ServerAttackTree.java b/src/main/java/electrosphere/entity/state/attack/ServerAttackTree.java index 81fb1c04..5662452e 100644 --- a/src/main/java/electrosphere/entity/state/attack/ServerAttackTree.java +++ b/src/main/java/electrosphere/entity/state/attack/ServerAttackTree.java @@ -29,7 +29,7 @@ import electrosphere.entity.types.projectile.ProjectileUtils; import electrosphere.game.data.common.treedata.TreeDataState; import electrosphere.game.data.creature.type.attack.AttackMove; import electrosphere.game.data.creature.type.equip.EquipPoint; -import electrosphere.game.data.item.type.WeaponData; +import electrosphere.game.data.item.WeaponData; import electrosphere.logger.LoggerInterface; import electrosphere.net.parser.net.message.EntityMessage; import electrosphere.net.synchronization.annotation.SyncedField; diff --git a/src/main/java/electrosphere/entity/state/equip/ClientEquipState.java b/src/main/java/electrosphere/entity/state/equip/ClientEquipState.java index 8d5603db..0d4cac1d 100644 --- a/src/main/java/electrosphere/entity/state/equip/ClientEquipState.java +++ b/src/main/java/electrosphere/entity/state/equip/ClientEquipState.java @@ -22,8 +22,8 @@ import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.entity.types.item.ItemUtils; import electrosphere.game.data.common.treedata.TreeDataAnimation; import electrosphere.game.data.creature.type.equip.EquipPoint; -import electrosphere.game.data.item.type.EquipWhitelist; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.EquipWhitelist; +import electrosphere.game.data.item.Item; import electrosphere.logger.LoggerInterface; import electrosphere.net.parser.net.message.InventoryMessage; import electrosphere.net.parser.net.message.NetworkMessage; diff --git a/src/main/java/electrosphere/entity/state/equip/ClientToolbarState.java b/src/main/java/electrosphere/entity/state/equip/ClientToolbarState.java index bad28868..62c6f592 100644 --- a/src/main/java/electrosphere/entity/state/equip/ClientToolbarState.java +++ b/src/main/java/electrosphere/entity/state/equip/ClientToolbarState.java @@ -12,8 +12,8 @@ import electrosphere.entity.types.item.ItemUtils; import electrosphere.game.data.common.treedata.TreeDataAnimation; import electrosphere.game.data.creature.type.equip.EquipPoint; import electrosphere.game.data.creature.type.equip.ToolbarData; -import electrosphere.game.data.item.type.EquipWhitelist; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.EquipWhitelist; +import electrosphere.game.data.item.Item; import java.util.List; diff --git a/src/main/java/electrosphere/entity/state/equip/ServerEquipState.java b/src/main/java/electrosphere/entity/state/equip/ServerEquipState.java index c66beaee..518eb8c7 100644 --- a/src/main/java/electrosphere/entity/state/equip/ServerEquipState.java +++ b/src/main/java/electrosphere/entity/state/equip/ServerEquipState.java @@ -30,7 +30,7 @@ import electrosphere.game.data.common.treedata.TreeDataAnimation; import electrosphere.game.data.creature.type.block.BlockSystem; import electrosphere.game.data.creature.type.block.BlockVariant; import electrosphere.game.data.creature.type.equip.EquipPoint; -import electrosphere.game.data.item.type.EquipWhitelist; +import electrosphere.game.data.item.EquipWhitelist; import electrosphere.logger.LoggerInterface; import electrosphere.net.parser.net.message.InventoryMessage; import electrosphere.net.parser.net.message.NetworkMessage; diff --git a/src/main/java/electrosphere/entity/state/equip/ServerToolbarState.java b/src/main/java/electrosphere/entity/state/equip/ServerToolbarState.java index d598c741..5edfc2e8 100644 --- a/src/main/java/electrosphere/entity/state/equip/ServerToolbarState.java +++ b/src/main/java/electrosphere/entity/state/equip/ServerToolbarState.java @@ -14,7 +14,7 @@ import electrosphere.game.data.creature.type.block.BlockSystem; import electrosphere.game.data.creature.type.block.BlockVariant; import electrosphere.game.data.creature.type.equip.EquipPoint; import electrosphere.game.data.creature.type.equip.ToolbarData; -import electrosphere.game.data.item.type.EquipWhitelist; +import electrosphere.game.data.item.EquipWhitelist; import electrosphere.logger.LoggerInterface; import java.util.List; diff --git a/src/main/java/electrosphere/entity/state/life/ClientLifeTree.java b/src/main/java/electrosphere/entity/state/life/ClientLifeTree.java index 98549322..ce1feee2 100644 --- a/src/main/java/electrosphere/entity/state/life/ClientLifeTree.java +++ b/src/main/java/electrosphere/entity/state/life/ClientLifeTree.java @@ -4,7 +4,7 @@ package electrosphere.entity.state.life; import electrosphere.entity.btree.BehaviorTree; import electrosphere.entity.btree.StateTransitionUtil; import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem; -import electrosphere.game.data.creature.type.HealthSystem; +import electrosphere.game.data.common.life.HealthSystem; import electrosphere.entity.EntityDataStrings; import electrosphere.entity.Entity; import electrosphere.engine.Globals; diff --git a/src/main/java/electrosphere/entity/state/life/ServerLifeTree.java b/src/main/java/electrosphere/entity/state/life/ServerLifeTree.java index e40c63dc..7b2efa5d 100644 --- a/src/main/java/electrosphere/entity/state/life/ServerLifeTree.java +++ b/src/main/java/electrosphere/entity/state/life/ServerLifeTree.java @@ -5,15 +5,18 @@ import electrosphere.entity.btree.BehaviorTree; import electrosphere.entity.btree.StateTransitionUtil; import electrosphere.entity.btree.StateTransitionUtil.StateTransitionUtilItem; import electrosphere.entity.EntityDataStrings; +import electrosphere.entity.EntityUtils; import electrosphere.entity.ServerEntityUtils; import electrosphere.entity.Entity; import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils; import electrosphere.net.parser.net.message.CombatMessage; import electrosphere.net.parser.net.message.SynchronizationMessage; +import electrosphere.server.datacell.Realm; import electrosphere.server.datacell.utils.DataCellSearchUtils; import java.util.LinkedList; import java.util.List; +import java.util.Random; import org.joml.Vector3d; @@ -22,7 +25,8 @@ import electrosphere.entity.state.hitbox.HitboxCollectionState.HitboxState; import electrosphere.entity.state.life.ClientLifeTree.LifeStateEnum; import electrosphere.entity.types.item.ItemUtils; import electrosphere.game.data.collidable.HitboxData; -import electrosphere.game.data.creature.type.HealthSystem; +import electrosphere.game.data.common.life.HealthSystem; +import electrosphere.game.data.common.life.loot.LootTicket; import electrosphere.logger.LoggerInterface; import electrosphere.net.synchronization.annotation.SyncedField; import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree; @@ -78,6 +82,9 @@ public class ServerLifeTree implements BehaviorTree { this.stateTransitionUtil.simulate(LifeStateEnum.DYING); } break; case DEAD: { + if(this.healthSystem.getLootPool() != null){ + this.rollLootPool(); + } //delete the entity ServerEntityUtils.destroyEntity(parent); } break; @@ -110,6 +117,26 @@ public class ServerLifeTree implements BehaviorTree { } } + /** + * Roll the loot pool + */ + protected void rollLootPool(){ + if(this.healthSystem.getLootPool() == null || this.healthSystem.getLootPool().getTickets() == null){ + return; + } + Random random = new Random(); + Vector3d position = new Vector3d(EntityUtils.getPosition(parent)); + Realm realm = Globals.realmManager.getEntityRealm(parent); + for(LootTicket ticket : this.healthSystem.getLootPool().getTickets()){ + if(random.nextDouble() < ticket.getRarity()){ + int numToGen = random.nextInt(ticket.getMinQuantity(), ticket.getMaxQuantity()); + for(int i = 0; i < numToGen; i++){ + ItemUtils.serverSpawnBasicItem(realm, position, ticket.getItemId()); + } + } + } + } + /** * Checks if the entity is alive * @return true if alive, false otherwise diff --git a/src/main/java/electrosphere/entity/types/common/CommonEntityUtils.java b/src/main/java/electrosphere/entity/types/common/CommonEntityUtils.java index 0aa92278..57c44345 100644 --- a/src/main/java/electrosphere/entity/types/common/CommonEntityUtils.java +++ b/src/main/java/electrosphere/entity/types/common/CommonEntityUtils.java @@ -74,7 +74,7 @@ import electrosphere.game.data.creature.type.rotator.RotatorItem; import electrosphere.game.data.creature.type.rotator.RotatorSystem; import electrosphere.game.data.foliage.type.FoliageType; import electrosphere.game.data.graphics.GraphicsTemplate; -import electrosphere.game.data.item.type.Item; +import electrosphere.game.data.item.Item; import electrosphere.net.parser.net.message.EntityMessage; import electrosphere.net.parser.net.message.NetworkMessage; import electrosphere.net.server.player.Player; diff --git a/src/main/java/electrosphere/entity/types/item/ItemUtils.java b/src/main/java/electrosphere/entity/types/item/ItemUtils.java index 32b61d9b..d89bfed8 100644 --- a/src/main/java/electrosphere/entity/types/item/ItemUtils.java +++ b/src/main/java/electrosphere/entity/types/item/ItemUtils.java @@ -22,11 +22,11 @@ import electrosphere.entity.state.gravity.ServerGravityTree; import electrosphere.entity.state.hitbox.HitboxCollectionState; import electrosphere.entity.types.EntityTypes.EntityType; import electrosphere.entity.types.common.CommonEntityUtils; +import electrosphere.game.data.item.EquipData; +import electrosphere.game.data.item.EquipWhitelist; +import electrosphere.game.data.item.Item; import electrosphere.game.data.item.ItemAudio; -import electrosphere.game.data.item.type.EquipData; -import electrosphere.game.data.item.type.EquipWhitelist; -import electrosphere.game.data.item.type.Item; -import electrosphere.game.data.item.type.WeaponData; +import electrosphere.game.data.item.WeaponData; import electrosphere.logger.LoggerInterface; import electrosphere.net.parser.net.message.EntityMessage; import electrosphere.net.parser.net.message.NetworkMessage; diff --git a/src/main/java/electrosphere/game/data/Config.java b/src/main/java/electrosphere/game/data/Config.java index fd0e9089..222d69c4 100644 --- a/src/main/java/electrosphere/game/data/Config.java +++ b/src/main/java/electrosphere/game/data/Config.java @@ -14,7 +14,7 @@ import electrosphere.game.data.creature.type.CreatureTypeLoader; import electrosphere.game.data.creature.type.attack.AttackMoveResolver; import electrosphere.game.data.creature.type.model.CreatureTypeMap; import electrosphere.game.data.foliage.type.model.FoliageTypeMap; -import electrosphere.game.data.item.type.model.ItemTypeMap; +import electrosphere.game.data.item.ItemDataMap; import electrosphere.game.data.projectile.ProjectileTypeHolder; import electrosphere.game.data.tutorial.HintDefinition; import electrosphere.game.data.units.UnitDefinitionFile; @@ -30,7 +30,11 @@ import electrosphere.util.FileUtils; public class Config { CreatureTypeLoader creatureTypeLoader; - ItemTypeMap itemMap; + + /** + * The container for all item definitions + */ + ItemDataMap itemMap; FoliageTypeMap foliageMap; CommonEntityMap objectTypeLoader; SymbolMap symbolMap; @@ -70,7 +74,7 @@ public class Config { public static Config loadDefaultConfig(){ Config config = new Config(); config.creatureTypeLoader = loadCreatureTypes("Data/entity/creatures.json"); - config.itemMap = FileUtils.loadObjectFromAssetPath("Data/entity/items.json", ItemTypeMap.class); + config.itemMap = ItemDataMap.loadItemFiles("Data/entity/items.json"); config.foliageMap = FileUtils.loadObjectFromAssetPath("Data/entity/foliage.json", FoliageTypeMap.class); config.objectTypeLoader = loadCommonEntityTypes("Data/entity/objects.json"); config.symbolMap = FileUtils.loadObjectFromAssetPath("Data/game/symbolism.json", SymbolMap.class); @@ -184,7 +188,7 @@ public class Config { * Gets the data on all item types in memory * @return the data on all items */ - public ItemTypeMap getItemMap() { + public ItemDataMap getItemMap() { return itemMap; } diff --git a/src/main/java/electrosphere/game/data/common/CommonEntityType.java b/src/main/java/electrosphere/game/data/common/CommonEntityType.java index 087309a4..2b275e7c 100644 --- a/src/main/java/electrosphere/game/data/common/CommonEntityType.java +++ b/src/main/java/electrosphere/game/data/common/CommonEntityType.java @@ -5,8 +5,8 @@ import java.util.List; import electrosphere.game.data.collidable.CollidableTemplate; import electrosphere.game.data.collidable.HitboxData; import electrosphere.game.data.common.camera.CameraData; +import electrosphere.game.data.common.life.HealthSystem; import electrosphere.game.data.common.light.PointLightDescription; -import electrosphere.game.data.creature.type.HealthSystem; import electrosphere.game.data.creature.type.LookAtSystem; import electrosphere.game.data.creature.type.ViewModelData; import electrosphere.game.data.creature.type.ai.AITreeData; diff --git a/src/main/java/electrosphere/game/data/creature/type/HealthSystem.java b/src/main/java/electrosphere/game/data/common/life/HealthSystem.java similarity index 59% rename from src/main/java/electrosphere/game/data/creature/type/HealthSystem.java rename to src/main/java/electrosphere/game/data/common/life/HealthSystem.java index 2a9e6da6..e23a9dc9 100644 --- a/src/main/java/electrosphere/game/data/creature/type/HealthSystem.java +++ b/src/main/java/electrosphere/game/data/common/life/HealthSystem.java @@ -1,5 +1,6 @@ -package electrosphere.game.data.creature.type; +package electrosphere.game.data.common.life; +import electrosphere.game.data.common.life.loot.LootPool; import electrosphere.game.data.common.treedata.TreeDataState; /** @@ -7,10 +8,14 @@ import electrosphere.game.data.common.treedata.TreeDataState; */ public class HealthSystem { - //the maximum health + /** + * The maximum health + */ int maxHealth; - //the number of iframes on taking damage + /** + * The number of iframes on taking damage + */ int onDamageIFrames; /** @@ -18,6 +23,11 @@ public class HealthSystem { */ TreeDataState dyingState; + /** + * The loot pool that can be dropped by this entity on death + */ + LootPool lootPool; + /** * Gets the maximum health * @return The maximum health @@ -41,16 +51,13 @@ public class HealthSystem { public TreeDataState getDyingState(){ return dyingState; } - + /** - * Clones health system data + * Gets the loot pool that can be dropped by this entity on death + * @return The loot pool that can be dropped by this entity on death */ - public HealthSystem clone(){ - HealthSystem rVal = new HealthSystem(); - rVal.maxHealth = maxHealth; - rVal.onDamageIFrames = onDamageIFrames; - rVal.dyingState = dyingState; - return rVal; + public LootPool getLootPool(){ + return this.lootPool; } } diff --git a/src/main/java/electrosphere/game/data/common/life/loot/LootPool.java b/src/main/java/electrosphere/game/data/common/life/loot/LootPool.java new file mode 100644 index 00000000..d5e85c53 --- /dev/null +++ b/src/main/java/electrosphere/game/data/common/life/loot/LootPool.java @@ -0,0 +1,33 @@ +package electrosphere.game.data.common.life.loot; + +import java.util.List; + +/** + * A pool of loot that is dropped when an entity dies + */ +public class LootPool { + + /** + * The tickets that can be generated from this loot pool + */ + List tickets; + + /** + * Gets the tickets that can be selected from this pool + * @return The list of tickets + */ + public List getTickets() { + return tickets; + } + + /** + * Sets the list of tickets that can be selected from this pool + * @param tickets The list of tickets + */ + public void setTickets(List tickets) { + this.tickets = tickets; + } + + + +} diff --git a/src/main/java/electrosphere/game/data/common/life/loot/LootTicket.java b/src/main/java/electrosphere/game/data/common/life/loot/LootTicket.java new file mode 100644 index 00000000..aa0ac8c2 --- /dev/null +++ b/src/main/java/electrosphere/game/data/common/life/loot/LootTicket.java @@ -0,0 +1,94 @@ +package electrosphere.game.data.common.life.loot; + +/** + * A ticket that can be selected when dropping from the loot pool + */ +public class LootTicket { + + /** + * The id of the type of item that can be dropped + */ + String itemId; + + /** + * The rarity of this item dropping + */ + double rarity; + + /** + * The minimum quantity that can be dropped from this ticket + */ + int minQuantity; + + /** + * The maximum quantity that can be dropped from this ticket + */ + int maxQuantity; + + /** + * Gets the id of the type of item that can be dropped + * @return The id of the type of item that can be dropped + */ + public String getItemId() { + return itemId; + } + + /** + * Sets the id of the type of item that can be dropped + * @param itemId The id of the type of item that can be dropped + */ + public void setItemId(String itemId) { + this.itemId = itemId; + } + + /** + * Gets the rarity of this item dropping + * @return The rarity of this item dropping + */ + public double getRarity() { + return rarity; + } + + /** + * Sets the rarity of this item dropping + * @param rarity The rarity of this item dropping + */ + public void setRarity(double rarity) { + this.rarity = rarity; + } + + /** + * Gets the minimum quantity that can be dropped from this ticket + * @return The minimum quantity that can be dropped from this ticket + */ + public int getMinQuantity() { + return minQuantity; + } + + /** + * Sets the minimum quantity that can be dropped from this ticket + * @param minQuantity The minimum quantity that can be dropped from this ticket + */ + public void setMinQuantity(int minQuantity) { + this.minQuantity = minQuantity; + } + + /** + * Gets the maximum quantity that can be dropped from this ticket + * @return The maximum quantity that can be dropped from this ticket + */ + public int getMaxQuantity() { + return maxQuantity; + } + + /** + * Sets the maximum quantity that can be dropped from this ticket + * @param maxQuantity The maximum quantity that can be dropped from this ticket + */ + public void setMaxQuantity(int maxQuantity) { + this.maxQuantity = maxQuantity; + } + + + +} diff --git a/src/main/java/electrosphere/game/data/item/type/EquipData.java b/src/main/java/electrosphere/game/data/item/EquipData.java similarity index 95% rename from src/main/java/electrosphere/game/data/item/type/EquipData.java rename to src/main/java/electrosphere/game/data/item/EquipData.java index 37e7c722..847c6e89 100644 --- a/src/main/java/electrosphere/game/data/item/type/EquipData.java +++ b/src/main/java/electrosphere/game/data/item/EquipData.java @@ -1,4 +1,4 @@ -package electrosphere.game.data.item.type; +package electrosphere.game.data.item; import java.util.List; diff --git a/src/main/java/electrosphere/game/data/item/type/EquipWhitelist.java b/src/main/java/electrosphere/game/data/item/EquipWhitelist.java similarity index 91% rename from src/main/java/electrosphere/game/data/item/type/EquipWhitelist.java rename to src/main/java/electrosphere/game/data/item/EquipWhitelist.java index 880b2393..7fe922f7 100644 --- a/src/main/java/electrosphere/game/data/item/type/EquipWhitelist.java +++ b/src/main/java/electrosphere/game/data/item/EquipWhitelist.java @@ -1,4 +1,4 @@ -package electrosphere.game.data.item.type; +package electrosphere.game.data.item; import java.util.List; diff --git a/src/main/java/electrosphere/game/data/item/type/Item.java b/src/main/java/electrosphere/game/data/item/Item.java similarity index 96% rename from src/main/java/electrosphere/game/data/item/type/Item.java rename to src/main/java/electrosphere/game/data/item/Item.java index 6fde2a21..8aea8aac 100644 --- a/src/main/java/electrosphere/game/data/item/type/Item.java +++ b/src/main/java/electrosphere/game/data/item/Item.java @@ -1,7 +1,6 @@ -package electrosphere.game.data.item.type; +package electrosphere.game.data.item; import electrosphere.game.data.common.CommonEntityType; -import electrosphere.game.data.item.ItemAudio; /** * Data on a given item diff --git a/src/main/java/electrosphere/game/data/item/type/ItemBlockData.java b/src/main/java/electrosphere/game/data/item/ItemBlockData.java similarity index 62% rename from src/main/java/electrosphere/game/data/item/type/ItemBlockData.java rename to src/main/java/electrosphere/game/data/item/ItemBlockData.java index 5468c4aa..ffa453a7 100644 --- a/src/main/java/electrosphere/game/data/item/type/ItemBlockData.java +++ b/src/main/java/electrosphere/game/data/item/ItemBlockData.java @@ -1,4 +1,4 @@ -package electrosphere.game.data.item.type; +package electrosphere.game.data.item; /** * Block data for the item diff --git a/src/main/java/electrosphere/game/data/item/ItemDataFile.java b/src/main/java/electrosphere/game/data/item/ItemDataFile.java new file mode 100644 index 00000000..3bb13cc3 --- /dev/null +++ b/src/main/java/electrosphere/game/data/item/ItemDataFile.java @@ -0,0 +1,52 @@ +package electrosphere.game.data.item; + +import java.util.List; + +/** + * Contains a list of item data definitions and a list of sub files + */ +public class ItemDataFile { + + /** + * The item data in this file + */ + List items; + + /** + * All child files of this one + */ + List files; + + /** + * Gets the item data in this file + * @return The item data in this file + */ + public List getItems() { + return items; + } + + /** + * Sets the item data in this file + * @param item The item data in this file + */ + public void setItems(List items) { + this.items = items; + } + + /** + * Gets all child files of this one + * @return All child files of this one + */ + public List getFiles() { + return files; + } + + /** + * Sets all child files of this one + * @param files All child files of this one + */ + public void setFiles(List files) { + this.files = files; + } + +} diff --git a/src/main/java/electrosphere/game/data/item/ItemDataMap.java b/src/main/java/electrosphere/game/data/item/ItemDataMap.java new file mode 100644 index 00000000..f37d738f --- /dev/null +++ b/src/main/java/electrosphere/game/data/item/ItemDataMap.java @@ -0,0 +1,113 @@ +package electrosphere.game.data.item; + +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import electrosphere.entity.Entity; +import electrosphere.entity.types.item.ItemUtils; +import electrosphere.util.FileUtils; + +/** + * A structure for efficiently looking up items + */ +public class ItemDataMap { + + /** + * The map of item id -> item data + */ + Map idItemMap = new HashMap(); + + /** + * Adds item data to the loader + * @param name The id of the item + * @param type The item data + */ + public void putType(String id, Item type){ + idItemMap.put(id,type); + } + + /** + * Gets item data from the id of the item + * @param id The id of the item + * @return The item data if it exists, null otherwise + */ + public Item getType(String id){ + return idItemMap.get(id); + } + + /** + * Gets item data from the id of the item + * @param id The id of the item + * @return The item data if it exists, null otherwise + */ + public Item getItem(String id){ + return idItemMap.get(id); + } + + /** + * Gets item data from a given entity + * @param entity The entity to get the item data for + * @return The item data if it exists, null otherwise + */ + public Item getItem(Entity entity){ + String itemId = ItemUtils.getType(entity); + return idItemMap.get(itemId); + } + + /** + * Gets the collection of all item data + * @return the collection of all item data + */ + public Collection getTypes(){ + return idItemMap.values(); + } + + /** + * Gets the set of all item data id's stored in the loader + * @return the set of all item data ids + */ + public Set getTypeIds(){ + return idItemMap.keySet(); + } + + /** + * Reads a child item defintion file + * @param filename The filename + * @return The list of items in the file + */ + static List recursiveReadItemLoader(String filename){ + List typeList = new LinkedList(); + ItemDataFile loaderFile = FileUtils.loadObjectFromAssetPath(filename, ItemDataFile.class); + //push the types from this file + for(Item type : loaderFile.getItems()){ + typeList.add(type); + } + //push types from any other files + for(String filepath : loaderFile.getFiles()){ + List parsedTypeList = recursiveReadItemLoader(filepath); + for(Item type : parsedTypeList){ + typeList.add(type); + } + } + return typeList; + } + + /** + * Loads all item definition files recursively + * @param initialPath The initial path to recurse from + * @return The item defintion interface + */ + public static ItemDataMap loadItemFiles(String initialPath) { + ItemDataMap rVal = new ItemDataMap(); + List typeList = recursiveReadItemLoader(initialPath); + for(Item type : typeList){ + rVal.putType(type.getId(), type); + } + return rVal; + } + +} diff --git a/src/main/java/electrosphere/game/data/item/type/WeaponData.java b/src/main/java/electrosphere/game/data/item/WeaponData.java similarity index 97% rename from src/main/java/electrosphere/game/data/item/type/WeaponData.java rename to src/main/java/electrosphere/game/data/item/WeaponData.java index ea1da19f..37b431f9 100644 --- a/src/main/java/electrosphere/game/data/item/type/WeaponData.java +++ b/src/main/java/electrosphere/game/data/item/WeaponData.java @@ -1,4 +1,4 @@ -package electrosphere.game.data.item.type; +package electrosphere.game.data.item; import java.util.List; diff --git a/src/main/java/electrosphere/game/data/item/type/model/ItemTypeMap.java b/src/main/java/electrosphere/game/data/item/type/model/ItemTypeMap.java deleted file mode 100644 index 3cb93c27..00000000 --- a/src/main/java/electrosphere/game/data/item/type/model/ItemTypeMap.java +++ /dev/null @@ -1,42 +0,0 @@ -package electrosphere.game.data.item.type.model; - -import electrosphere.entity.Entity; -import electrosphere.entity.types.item.ItemUtils; -import electrosphere.game.data.item.type.Item; -import electrosphere.logger.LoggerInterface; - -import java.util.List; - -public class ItemTypeMap { - List items; - - public List getItems() { - return items; - } - - public Item getItem(String name){ - Item rVal = null; - for(Item item : items){ - if(item.getId().equals(name)){ - rVal = item; - break; - } else if(item.getId().equalsIgnoreCase(name)){ - LoggerInterface.loggerEngine.WARNING("Failed to fetch item type data; however, item with different-capitalized name exists! May be a capitalization error!"); - } - } - return rVal; - } - - /** - * Gets the item data of the item - * @param item The item entity - * @return The type - */ - public Item getItem(Entity item){ - if(item != null && ItemUtils.isItem(item) && ItemUtils.getType(item) != null){ - return getItem(ItemUtils.getType(item)); - } - return null; - } - -} diff --git a/src/test/java/electrosphere/entity/SpawnAllEntitiesTests.java b/src/test/java/electrosphere/entity/SpawnAllEntitiesTests.java index 42582ec5..79571eaf 100644 --- a/src/test/java/electrosphere/entity/SpawnAllEntitiesTests.java +++ b/src/test/java/electrosphere/entity/SpawnAllEntitiesTests.java @@ -17,8 +17,8 @@ import electrosphere.game.data.creature.type.CreatureData; import electrosphere.game.data.creature.type.CreatureTypeLoader; import electrosphere.game.data.foliage.type.FoliageType; import electrosphere.game.data.foliage.type.model.FoliageTypeMap; -import electrosphere.game.data.item.type.Item; -import electrosphere.game.data.item.type.model.ItemTypeMap; +import electrosphere.game.data.item.Item; +import electrosphere.game.data.item.ItemDataMap; import electrosphere.test.annotations.IntegrationTest; import electrosphere.test.template.EntityTestTemplate; import electrosphere.test.testutils.TestEngineUtils; @@ -39,8 +39,8 @@ public class SpawnAllEntitiesTests extends EntityTestTemplate { CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0.1,0.1,0.1), creature.getId(), CreatureTemplate.createDefault(creature.getId())); } - ItemTypeMap itemMap = Globals.gameConfigCurrent.getItemMap(); - for(Item item : itemMap.getItems()){ + ItemDataMap itemMap = Globals.gameConfigCurrent.getItemMap(); + for(Item item : itemMap.getTypes()){ ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0.1,0.1,0.1), item.getId()); }