mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 10:34:06 +09:00
buoyancy partially implemented (jump gets higher in water), fluidal movement resistance was failed to implement
Former-commit-id: 9a5275809b11c8597cdcc59bc8845f80eeb6bb56 Former-commit-id: 4946a70b3a0bab66fd6817859bf03517d3a1152e
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -93,4 +93,10 @@
|
|||||||
== Custom pattern making ==
|
== Custom pattern making ==
|
||||||
|
|
||||||
- Players can create their own décors (hang on wall), dresses.
|
- Players can create their own décors (hang on wall), dresses.
|
||||||
- Two looms (216 colour mode, 4096 colour mode)
|
- Two looms (216 colour mode, 4096 colour mode)
|
||||||
|
|
||||||
|
|
||||||
|
== Food/Potion dose ==
|
||||||
|
|
||||||
|
Scale ^ 3 ^ (3/4)
|
||||||
|
= (ThisWgt / TargetWgt) ^ (3/4)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,60 +1,56 @@
|
|||||||
"id";"dmg";"name" ;"opacity";"strength";"fluid";"viscosity";"solid";"wall";"lumcolor";"opaque";"drop";"ddmg";"fall";"friction"
|
"id";"dmg";"name" ;"opacity";"strength";"spcg";"fluid";"movr";"solid";"wall";"lumcolor";"opaque";"drop";"ddmg";"fall";"friction"
|
||||||
"0"; "0";"TILE_AIR" ; "1641"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0";"16"
|
"0"; "0";"TILE_AIR" ; "1641"; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0";"16"
|
||||||
"1"; "0";"TILE_STONE" ; "8205"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "0"; "0";"16"
|
"1"; "0";"TILE_STONE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "0"; "0";"16"
|
||||||
"1"; "1";"TILE_STONE_QUARRIED" ; "8205"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "1"; "0";"16"
|
"1"; "1";"TILE_STONE_QUARRIED" ; "8205"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "1"; "0";"16"
|
||||||
"2"; "0";"TILE_DIRT" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "0"; "0";"16"
|
"2"; "0";"TILE_DIRT" ; "8205"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "0"; "0";"16"
|
||||||
"2"; "1";"TILE_GRASS" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "1"; "0";"16"
|
"2"; "1";"TILE_GRASS" ; "8205"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "1"; "0";"16"
|
||||||
|
"3"; "0";"TILE_PLANK_NORMAL" ; "8205"; "12"; "740"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "0"; "0";"16"
|
||||||
"3"; "0";"TILE_PLANK_NORMAL" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "0"; "0";"16"
|
"3"; "1";"TILE_PLANK_EBONY" ; "8205"; "12";"1200"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "1"; "0";"16"
|
||||||
"3"; "1";"TILE_PLANK_EBONY" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "1"; "0";"16"
|
"3"; "2";"TILE_PLANK_BIRCH" ; "8205"; "12"; "670"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "2"; "0";"16"
|
||||||
"3"; "2";"TILE_PLANK_BIRCH" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "2"; "0";"16"
|
"3"; "3";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "900"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "3"; "0";"16"
|
||||||
"3"; "3";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "3"; "0";"16"
|
"4"; "0";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "740"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "0"; "0";"16"
|
||||||
|
"4"; "1";"TILE_TRUNK_EBONY" ; "8205"; "12";"1200"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "1"; "0";"16"
|
||||||
"4"; "0";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "0"; "0";"16"
|
"4"; "2";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "670"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "2"; "0";"16"
|
||||||
"4"; "1";"TILE_TRUNK_EBONY" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "1"; "0";"16"
|
"4"; "3";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "900"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "3"; "0";"16"
|
||||||
"4"; "2";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "2"; "0";"16"
|
"5"; "0";"TILE_SAND" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "0"; "1";"16"
|
||||||
"4"; "3";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "3"; "0";"16"
|
"5"; "1";"TILE_SAND_WHITE" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "1"; "1";"16"
|
||||||
|
"5"; "2";"TILE_SAND_RED" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "2"; "1";"16"
|
||||||
"5"; "0";"TILE_SAND" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "0"; "1";"16"
|
"5"; "3";"TILE_SAND" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "3"; "1";"16"
|
||||||
"5"; "1";"TILE_SAND_WHITE" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "1"; "1";"16"
|
"5"; "4";"TILE_SAND_BLACK" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "4"; "1";"16"
|
||||||
"5"; "2";"TILE_SAND_RED" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "2"; "1";"16"
|
"6"; "0";"TILE_GRAVEL" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "6"; "0"; "1";"16"
|
||||||
"5"; "3";"TILE_SAND" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "3"; "1";"16"
|
"6"; "1";"TILE_GRAVEL_GREY" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "6"; "1"; "1";"16"
|
||||||
"5"; "4";"TILE_SAND_BLACK" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "4"; "1";"16"
|
"7"; "0";"TILE_ORE_MALACHITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "0"; "0";"16"
|
||||||
|
"7"; "1";"TILE_ORE_HEMATITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "1"; "0";"16"
|
||||||
"6"; "0";"TILE_GRAVEL" ; "8205"; "6"; "0"; "0"; "1"; "0"; "0"; "1"; "6"; "0"; "1";"16"
|
"7"; "2";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "2"; "0";"16"
|
||||||
"6"; "1";"TILE_GRAVEL_GREY" ; "8205"; "6"; "0"; "0"; "1"; "0"; "0"; "1"; "6"; "1"; "1";"16"
|
"7"; "3";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "3"; "0";"16"
|
||||||
|
"7"; "4";"TILE_ORE_RUTILE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "4"; "0";"16"
|
||||||
"7"; "0";"TILE_ORE_MALACHITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "0"; "0";"16"
|
"7"; "5";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "5"; "0";"16"
|
||||||
"7"; "1";"TILE_ORE_HEMATITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "1"; "0";"16"
|
"8"; "0";"TILE_GEM_RUBY" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "0"; "0";"16"
|
||||||
"7"; "2";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "2"; "0";"16"
|
"8"; "1";"TILE_GEM_EMERALD" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "1"; "0";"16"
|
||||||
"7"; "3";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "3"; "0";"16"
|
"8"; "2";"TILE_GEM_SAPPHIRE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "2"; "0";"16"
|
||||||
"7"; "4";"TILE_ORE_RUTILE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "4"; "0";"16"
|
"8"; "3";"TILE_GEM_TOPAZ" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "3"; "0";"16"
|
||||||
"7"; "5";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "5"; "0";"16"
|
"8"; "4";"TILE_GEM_DIAMOND" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "4"; "0";"16"
|
||||||
|
"8"; "5";"TILE_GEM_AMETHYST" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "5"; "0";"16"
|
||||||
"8"; "0";"TILE_GEM_RUBY" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "0"; "0";"16"
|
"9"; "0";"TILE_SNOW" ; "8205"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "0"; "0";"16"
|
||||||
"8"; "1";"TILE_GEM_EMERALD" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "1"; "0";"16"
|
"9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "0"; "9"; "1"; "0";"16"
|
||||||
"8"; "2";"TILE_GEM_SAPPHIRE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "2"; "0";"16"
|
"9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "2"; "0"; "8"
|
||||||
"8"; "3";"TILE_GEM_TOPAZ" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "3"; "0";"16"
|
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25";"2785"; "0"; "0"; "1"; "1"; "5009"; "0"; "9"; "3"; "0"; "8"
|
||||||
"8"; "4";"TILE_GEM_DIAMOND" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "4"; "0";"16"
|
"10"; "0";"TILE_PLATFORM_STONE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
||||||
"8"; "5";"TILE_GEM_AMETHYST" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "5"; "0";"16"
|
"10"; "1";"TILE_PLATFORM_WOODEN" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "0";"16"
|
||||||
|
"10"; "2";"TILE_PLATFORM_EBONY" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
||||||
"9"; "0";"TILE_SNOW" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "0"; "0";"16"
|
"10"; "3";"TILE_PLATFORM_BIRCH" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
||||||
"9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "0"; "0"; "1"; "0"; "0"; "0"; "9"; "1"; "0";"16"
|
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
||||||
"9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "2"; "0"; "8"
|
"11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "63412"; "0"; "11"; "0"; "0";"16"
|
||||||
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "0"; "1"; "1"; "5009"; "0"; "9"; "3"; "0"; "8"
|
"254"; "15";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "16"; "0"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
|
"255"; "15";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"10"; "0";"TILE_PLATFORM_STONE" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
|
||||||
"10"; "1";"TILE_PLATFORM_WOODEN" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "0";"16"
|
|
||||||
"10"; "2";"TILE_PLATFORM_EBONY" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
|
||||||
"10"; "3";"TILE_PLATFORM_BIRCH" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
|
||||||
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
|
||||||
|
|
||||||
"11"; "0";"TILE_TORCH" ; "0"; "0"; "0"; "0"; "0"; "0"; "63412"; "0"; "11"; "0"; "0";"16"
|
|
||||||
# 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
|
||||||
"254"; "15";"TILE_WATER" ; "6522"; "100"; "1"; "16"; "0"; "0"; "0"; "0"; "-1"; "-1"; "0";"16"
|
|
||||||
"255"; "15";"TILE_LAVA" ; "62358"; "100"; "1"; "16"; "0"; "0"; "48320"; "0"; "-1"; "-1"; "0";"16"
|
|
||||||
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky
|
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky
|
||||||
# Opacity/Lumcolor: 40-step RGB
|
# Opacity/Lumcolor: 40-step RGB
|
||||||
# Opaque: whether the tile completely hides wall behind
|
# Opaque: whether the tile completely hides wall behind
|
||||||
# Solid: whether the tile has collision
|
# Solid: whether the tile has full collision
|
||||||
# Viscosity: (walkspeedmax) * (1 + (n/16))
|
# movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed
|
||||||
|
# spcg: specific gravity, aka density. [g/l]
|
||||||
|
# Defalut torch should have a colour of 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
||||||
|
# Assume magical ice as Ice-X.
|
||||||
|
# References:
|
||||||
|
# * Density of various woods : http://www.engineeringtoolbox.com/wood-density-d_40.html
|
||||||
|
# * Density of various phases of ice : http://www1.lsbu.ac.uk/water/ice_phases.html
|
||||||
|
Can't render this file because it contains an unexpected character in line 1 and column 18.
|
@@ -2,6 +2,7 @@ package com.Torvald.Terrarum.Actors;
|
|||||||
|
|
||||||
import com.Torvald.Rand.HQRNG;
|
import com.Torvald.Rand.HQRNG;
|
||||||
import com.Torvald.Terrarum.*;
|
import com.Torvald.Terrarum.*;
|
||||||
|
import com.Torvald.Terrarum.GameMap.GameMap;
|
||||||
import com.Torvald.Terrarum.MapDrawer.MapDrawer;
|
import com.Torvald.Terrarum.MapDrawer.MapDrawer;
|
||||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex;
|
import com.Torvald.Terrarum.TileProperties.TilePropCodex;
|
||||||
import com.Torvald.spriteAnimation.SpriteAnimation;
|
import com.Torvald.spriteAnimation.SpriteAnimation;
|
||||||
@@ -47,6 +48,7 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
|
|
||||||
private boolean noSubjectToGrav = false;
|
private boolean noSubjectToGrav = false;
|
||||||
private boolean noCollideWorld = false;
|
private boolean noCollideWorld = false;
|
||||||
|
private boolean noSubjectToFluidResistance = false;
|
||||||
|
|
||||||
int baseSpriteWidth, baseSpriteHeight;
|
int baseSpriteWidth, baseSpriteHeight;
|
||||||
|
|
||||||
@@ -58,15 +60,13 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
/**
|
/**
|
||||||
* Physical properties
|
* Physical properties
|
||||||
*/
|
*/
|
||||||
@NonZero
|
@NonZero private volatile float scale = 1;
|
||||||
private volatile float scale = 1;
|
|
||||||
@NonZero private volatile float mass = 2f;
|
@NonZero private volatile float mass = 2f;
|
||||||
private final float MASS_LOWEST = 2f;
|
private final float MASS_LOWEST = 2f;
|
||||||
/** Valid range: [0, 1] */
|
/** Valid range: [0, 1] */
|
||||||
private float elasticity = 0;
|
private float elasticity = 0;
|
||||||
private final float ELASTICITY_MAX = 0.993f;
|
private final float ELASTICITY_MAX = 0.993f;
|
||||||
@NoNegative
|
@NoNegative private float density = 1000;
|
||||||
private float buoyancy = 0;
|
|
||||||
|
|
||||||
private static final int TSIZE = MapDrawer.TILE_SIZE;
|
private static final int TSIZE = MapDrawer.TILE_SIZE;
|
||||||
private static int AUTO_CLIMB_RATE = TSIZE / 8;
|
private static int AUTO_CLIMB_RATE = TSIZE / 8;
|
||||||
@@ -119,12 +119,15 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
*/
|
*/
|
||||||
public final int INVINCIBILITY_TIME = 500;
|
public final int INVINCIBILITY_TIME = 500;
|
||||||
|
|
||||||
|
private GameMap map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Give new random ReferenceID and initialise ActorValue
|
* Give new random ReferenceID and initialise ActorValue
|
||||||
*/
|
*/
|
||||||
public ActorWithBody() {
|
public ActorWithBody() {
|
||||||
referenceID = new HQRNG().nextLong();
|
referenceID = new HQRNG().nextLong();
|
||||||
actorValue = new ActorValue();
|
actorValue = new ActorValue();
|
||||||
|
map = Terrarum.game.map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -176,6 +179,7 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
if (this instanceof Player) {
|
if (this instanceof Player) {
|
||||||
noSubjectToGrav = isPlayerNoClip();
|
noSubjectToGrav = isPlayerNoClip();
|
||||||
noCollideWorld = isPlayerNoClip();
|
noCollideWorld = isPlayerNoClip();
|
||||||
|
noSubjectToFluidResistance = isPlayerNoClip();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mass < MASS_LOWEST) mass = MASS_LOWEST; // clamp to minimum possible mass
|
if (mass < MASS_LOWEST) mass = MASS_LOWEST; // clamp to minimum possible mass
|
||||||
@@ -183,16 +187,24 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
baseSpriteHeight = sprite.getHeight();
|
baseSpriteHeight = sprite.getHeight();
|
||||||
baseSpriteWidth = sprite.getWidth();
|
baseSpriteWidth = sprite.getWidth();
|
||||||
}
|
}
|
||||||
gravitation = Terrarum.game.map.getGravitation();
|
gravitation = map.getGravitation();
|
||||||
AUTO_CLIMB_RATE = (int) Math.min(TSIZE / 8 * FastMath.sqrt(scale), TSIZE);
|
AUTO_CLIMB_RATE = (int) Math.min(TSIZE / 8 * FastMath.sqrt(scale), TSIZE);
|
||||||
|
|
||||||
if (!isNoSubjectToGrav()) {
|
if (!isNoSubjectToGrav()) {
|
||||||
applyGravitation();
|
applyGravitation();
|
||||||
|
applyBuoyancy();
|
||||||
}
|
}
|
||||||
|
|
||||||
// hard limit velocity
|
// hard limit velocity
|
||||||
if (veloX > VELO_HARD_LIMIT) veloX = VELO_HARD_LIMIT;
|
if (veloX > VELO_HARD_LIMIT) veloX = VELO_HARD_LIMIT;
|
||||||
if (veloY > VELO_HARD_LIMIT) veloY = VELO_HARD_LIMIT;
|
if (veloY > VELO_HARD_LIMIT) veloY = VELO_HARD_LIMIT;
|
||||||
|
// limit velocity by fluid resistance
|
||||||
|
//int tilePropResistance = getTileMvmtRstc();
|
||||||
|
//if (!noSubjectToFluidResistance) {
|
||||||
|
// veloX *= mvmtRstcToMultiplier(tilePropResistance);
|
||||||
|
// veloY *= mvmtRstcToMultiplier(tilePropResistance);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
// Set 'next' positions to fiddle with
|
// Set 'next' positions to fiddle with
|
||||||
updateNextHitboxFromVelo();
|
updateNextHitboxFromVelo();
|
||||||
@@ -207,6 +219,8 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
updateHorizontalPos();
|
updateHorizontalPos();
|
||||||
updateVerticalPos();
|
updateVerticalPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updateHitboxX();
|
updateHitboxX();
|
||||||
updateHitboxY();
|
updateHitboxY();
|
||||||
|
|
||||||
@@ -237,7 +251,11 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
float A = scale * scale;
|
float A = scale * scale;
|
||||||
float D = DRAG_COEFF * 0.5f * 1.292f * veloY * veloY * A;
|
float D = DRAG_COEFF * 0.5f * 1.292f * veloY * veloY * A;
|
||||||
|
|
||||||
veloY += clampCeil(((W - D) / mass) * SI_TO_GAME_ACC * G_MUL_PLAYABLE_CONST
|
int fluidResistance = getTileMvmtRstc();
|
||||||
|
|
||||||
|
veloY += clampCeil(
|
||||||
|
((W - D) / mass) * SI_TO_GAME_ACC * G_MUL_PLAYABLE_CONST
|
||||||
|
* mvmtRstcToMultiplier(fluidResistance) // eliminate shoot-up from fluids
|
||||||
, VELO_HARD_LIMIT
|
, VELO_HARD_LIMIT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -453,7 +471,7 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// evaluate
|
// evaluate
|
||||||
if (TilePropCodex.getProp(Terrarum.game.map.getTileFromTerrain(tileX, tileY)).isSolid()) {
|
if (TilePropCodex.getProp(map.getTileFromTerrain(tileX, tileY)).isSolid()) {
|
||||||
contactAreaCounter += 1;
|
contactAreaCounter += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -461,6 +479,146 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
return contactAreaCounter;
|
return contactAreaCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [N] = [kg * m / s^2]
|
||||||
|
* F(bo) = density * submerged_volume * gravitational_acceleration [N]
|
||||||
|
*/
|
||||||
|
private void applyBuoyancy() {
|
||||||
|
int fluidDensity = getTileDensity();
|
||||||
|
int fluidResistance = getTileMvmtRstc();
|
||||||
|
float submergedVolume = getSubmergedVolume();
|
||||||
|
|
||||||
|
if (!isPlayerNoClip() && !grounded) {
|
||||||
|
// System.out.println("density: "+density);
|
||||||
|
veloY -= ((fluidDensity - this.density)
|
||||||
|
* map.getGravitation() * submergedVolume
|
||||||
|
* Math.pow(mass, -1)
|
||||||
|
* mvmtRstcToMultiplier(fluidResistance) // eliminate shoot-up
|
||||||
|
* SI_TO_GAME_ACC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getSubmergedVolume(){
|
||||||
|
float GAME_TO_SI_VOL = FastMath.pow((1f/METER), 3);
|
||||||
|
|
||||||
|
if( density > 0 ){
|
||||||
|
return FastMath.clamp(
|
||||||
|
(nextHitbox.getPointedY() - getFluidLevel()) // submerged height
|
||||||
|
* nextHitbox.getWidth() * nextHitbox.getWidth()
|
||||||
|
* GAME_TO_SI_VOL
|
||||||
|
, 0
|
||||||
|
, nextHitbox.getHeight()
|
||||||
|
* nextHitbox.getWidth() * nextHitbox.getWidth()
|
||||||
|
* GAME_TO_SI_VOL
|
||||||
|
);
|
||||||
|
//System.out.println("fluidHeight: "+fluidHeight+", submerged: "+submergedVolume);
|
||||||
|
//submergedHeight / TILE_SIZE * 1^2 (pixel to meter)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getFluidLevel(){
|
||||||
|
int tilePosXStart = Math.round(nextHitbox.getPosX() / TSIZE);
|
||||||
|
int tilePosXEnd = Math.round(nextHitbox.getHitboxEnd().getX() / TSIZE);
|
||||||
|
int tilePosY = Math.round(nextHitbox.getPosY() / TSIZE);
|
||||||
|
|
||||||
|
int fluidHeight = 2147483647;
|
||||||
|
|
||||||
|
for (int x = tilePosXStart; x <= tilePosXEnd; x++) {
|
||||||
|
int tile = map.getTileFromTerrain(x, tilePosY);
|
||||||
|
if ( TilePropCodex.getProp(tile).isFluid()
|
||||||
|
&& tilePosY * TSIZE < fluidHeight ){
|
||||||
|
fluidHeight = tilePosY * TSIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fluidHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get highest friction value from feet tiles.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int getTileFriction(){
|
||||||
|
int friction = 0;
|
||||||
|
|
||||||
|
int tilePosXStart = Math.round(nextHitbox.getPosX() / TSIZE);
|
||||||
|
int tilePosXEnd = Math.round(nextHitbox.getHitboxEnd().getX() / TSIZE);
|
||||||
|
int tilePosY = Math.round(nextHitbox.getPointedY() / TSIZE);
|
||||||
|
|
||||||
|
//get density
|
||||||
|
for (int x = tilePosXStart; x <= tilePosXEnd; x++) {
|
||||||
|
int tile = map.getTileFromTerrain(x, tilePosY);
|
||||||
|
if (TilePropCodex.getProp(tile).isFluid()) {
|
||||||
|
int thisFluidDensity = TilePropCodex.getProp(tile).getFriction();
|
||||||
|
|
||||||
|
if (thisFluidDensity > friction) friction = thisFluidDensity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return friction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get highest movement resistance value from tiles that the body occupies.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int getTileMvmtRstc(){
|
||||||
|
int resistance = 0;
|
||||||
|
|
||||||
|
int tilePosXStart = Math.round(nextHitbox.getPosX() / TSIZE);
|
||||||
|
int tilePosYStart = Math.round(nextHitbox.getPosY() / TSIZE);
|
||||||
|
int tilePosXEnd = Math.round(nextHitbox.getHitboxEnd().getX() / TSIZE);
|
||||||
|
int tilePosYEnd = Math.round(nextHitbox.getHitboxEnd().getY() / TSIZE);
|
||||||
|
|
||||||
|
//get density
|
||||||
|
for (int y = tilePosYStart; y <= tilePosYEnd; y++) {
|
||||||
|
for (int x = tilePosXStart; x <= tilePosXEnd; x++) {
|
||||||
|
int tile = map.getTileFromTerrain(x, y);
|
||||||
|
if (TilePropCodex.getProp(tile).isFluid()) {
|
||||||
|
int thisFluidDensity = TilePropCodex.getProp(tile).getMovementResistance();
|
||||||
|
|
||||||
|
if (thisFluidDensity > resistance) resistance = thisFluidDensity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get highest density (specific gravity) value from tiles that the body occupies.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int getTileDensity() {
|
||||||
|
int density = 0;
|
||||||
|
|
||||||
|
int tilePosXStart = Math.round(nextHitbox.getPosX() / TSIZE);
|
||||||
|
int tilePosYStart = Math.round(nextHitbox.getPosY() / TSIZE);
|
||||||
|
int tilePosXEnd = Math.round(nextHitbox.getHitboxEnd().getX() / TSIZE);
|
||||||
|
int tilePosYEnd = Math.round(nextHitbox.getHitboxEnd().getY() / TSIZE);
|
||||||
|
|
||||||
|
//get density
|
||||||
|
for (int y = tilePosYStart; y <= tilePosYEnd; y++) {
|
||||||
|
for (int x = tilePosXStart; x <= tilePosXEnd; x++) {
|
||||||
|
int tile = map.getTileFromTerrain(x, y);
|
||||||
|
if (TilePropCodex.getProp(tile).isFluid()) {
|
||||||
|
int thisFluidDensity = TilePropCodex.getProp(tile).getDensity();
|
||||||
|
|
||||||
|
if (thisFluidDensity > density) density = thisFluidDensity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return density;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float mvmtRstcToMultiplier(int viscosity) {
|
||||||
|
return 1f / (1 + (viscosity / 16f));
|
||||||
|
}
|
||||||
|
|
||||||
private void clampHitbox() {
|
private void clampHitbox() {
|
||||||
hitbox.setPositionFromPoint(
|
hitbox.setPositionFromPoint(
|
||||||
clampW(hitbox.getPointedX())
|
clampW(hitbox.getPointedX())
|
||||||
@@ -575,8 +733,8 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
if (x < TSIZE + nextHitbox.getWidth() / 2) {
|
if (x < TSIZE + nextHitbox.getWidth() / 2) {
|
||||||
return TSIZE + nextHitbox.getWidth() / 2;
|
return TSIZE + nextHitbox.getWidth() / 2;
|
||||||
}
|
}
|
||||||
else if (x >= Terrarum.game.map.width * TSIZE - TSIZE - nextHitbox.getWidth() / 2) {
|
else if (x >= map.width * TSIZE - TSIZE - nextHitbox.getWidth() / 2) {
|
||||||
return Terrarum.game.map.width * TSIZE - 1 - TSIZE - nextHitbox.getWidth() / 2;
|
return map.width * TSIZE - 1 - TSIZE - nextHitbox.getWidth() / 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return x;
|
return x;
|
||||||
@@ -587,8 +745,8 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
if (y < TSIZE + nextHitbox.getHeight()) {
|
if (y < TSIZE + nextHitbox.getHeight()) {
|
||||||
return TSIZE + nextHitbox.getHeight();
|
return TSIZE + nextHitbox.getHeight();
|
||||||
}
|
}
|
||||||
else if (y >= Terrarum.game.map.height * TSIZE - TSIZE - nextHitbox.getHeight()) {
|
else if (y >= map.height * TSIZE - TSIZE - nextHitbox.getHeight()) {
|
||||||
return Terrarum.game.map.height * TSIZE - 1 - TSIZE - nextHitbox.getHeight();
|
return map.height * TSIZE - 1 - TSIZE - nextHitbox.getHeight();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return y;
|
return y;
|
||||||
@@ -599,8 +757,8 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (x >= Terrarum.game.map.width) {
|
else if (x >= map.width) {
|
||||||
return Terrarum.game.map.width - 1;
|
return map.width - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return x;
|
return x;
|
||||||
@@ -611,8 +769,8 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (x >= Terrarum.game.map.height) {
|
else if (x >= map.height) {
|
||||||
return Terrarum.game.map.height - 1;
|
return map.height - 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return x;
|
return x;
|
||||||
@@ -747,10 +905,18 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
return noCollideWorld;
|
return noCollideWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isNoSubjectToFluidResistance() {
|
||||||
|
return noSubjectToFluidResistance;
|
||||||
|
}
|
||||||
|
|
||||||
public void setNoCollideWorld(boolean noCollideWorld) {
|
public void setNoCollideWorld(boolean noCollideWorld) {
|
||||||
this.noCollideWorld = noCollideWorld;
|
this.noCollideWorld = noCollideWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNoSubjectToFluidResistance(boolean noSubjectToFluidResistance) {
|
||||||
|
this.noSubjectToFluidResistance = noSubjectToFluidResistance;
|
||||||
|
}
|
||||||
|
|
||||||
public void setElasticity(float elasticity) {
|
public void setElasticity(float elasticity) {
|
||||||
if (elasticity < 0)
|
if (elasticity < 0)
|
||||||
throw new IllegalArgumentException("[ActorWithBody] " + elasticity + ": valid elasticity value is [0, 1].");
|
throw new IllegalArgumentException("[ActorWithBody] " + elasticity + ": valid elasticity value is [0, 1].");
|
||||||
@@ -762,11 +928,11 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
else this.elasticity = elasticity * ELASTICITY_MAX;
|
else this.elasticity = elasticity * ELASTICITY_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBuoyancy(float buoyancy) {
|
public void setDensity(int density) {
|
||||||
if (buoyancy < 0)
|
if (density < 0)
|
||||||
throw new IllegalArgumentException("[ActorWithBody] " + buoyancy + ": buoyancy cannot be negative.");
|
throw new IllegalArgumentException("[ActorWithBody] " + density + ": density cannot be negative.");
|
||||||
|
|
||||||
this.buoyancy = buoyancy;
|
this.density = density;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
41
src/com/Torvald/Terrarum/Actors/ItemProperties/Material.java
Normal file
41
src/com/Torvald/Terrarum/Actors/ItemProperties/Material.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package com.Torvald.Terrarum.Actors.ItemProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 16-03-06.
|
||||||
|
*/
|
||||||
|
public class Material {
|
||||||
|
|
||||||
|
/** How sharp the material is. Default to 1000.*/
|
||||||
|
int maxEdge;
|
||||||
|
/** Self-explanatory. [kPa in Vickers hardness]*/
|
||||||
|
int hardness;
|
||||||
|
/** Self-explanatory. [g/l]*/
|
||||||
|
int density;
|
||||||
|
|
||||||
|
public Material() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxEdge() {
|
||||||
|
return maxEdge;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMaxEdge(int maxEdge) {
|
||||||
|
this.maxEdge = maxEdge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHardness() {
|
||||||
|
return hardness;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setHardness(int hardness) {
|
||||||
|
this.hardness = hardness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDensity() {
|
||||||
|
return density;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDensity(int density) {
|
||||||
|
this.density = density;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.Torvald.Terrarum.Actors.ItemProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 16-03-06.
|
||||||
|
*/
|
||||||
|
public class MaterialFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load from CSV
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.Torvald.Terrarum.Actors;
|
package com.Torvald.Terrarum.Actors;
|
||||||
|
|
||||||
import com.Torvald.Rand.Fudge3;
|
|
||||||
import com.Torvald.Terrarum.Actors.Faction.Faction;
|
import com.Torvald.Terrarum.Actors.Faction.Faction;
|
||||||
import com.Torvald.Terrarum.GameControl.EnumKeyFunc;
|
import com.Torvald.Terrarum.GameControl.EnumKeyFunc;
|
||||||
import com.Torvald.Terrarum.GameControl.KeyMap;
|
import com.Torvald.Terrarum.GameControl.KeyMap;
|
||||||
@@ -61,7 +60,7 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
|
|||||||
|
|
||||||
private HashSet<Faction> factionSet = new HashSet<>();
|
private HashSet<Faction> factionSet = new HashSet<>();
|
||||||
|
|
||||||
private final float BASE_BUOYANCY = 0.98f;
|
private final int BASE_DENSITY = 1020;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +74,7 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac
|
|||||||
super();
|
super();
|
||||||
referenceID = PLAYER_REF_ID;
|
referenceID = PLAYER_REF_ID;
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
super.setBuoyancy(BASE_BUOYANCY);
|
super.setDensity(BASE_DENSITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -93,4 +93,10 @@
|
|||||||
== Custom pattern making ==
|
== Custom pattern making ==
|
||||||
|
|
||||||
- Players can create their own décors (hang on wall), dresses.
|
- Players can create their own décors (hang on wall), dresses.
|
||||||
- Two looms (216 colour mode, 4096 colour mode)
|
- Two looms (216 colour mode, 4096 colour mode)
|
||||||
|
|
||||||
|
|
||||||
|
== Food/Potion dose ==
|
||||||
|
|
||||||
|
Scale ^ 3 ^ (3/4)
|
||||||
|
= (ThisWgt / TargetWgt) ^ (3/4)
|
||||||
|
|||||||
@@ -81,11 +81,9 @@ public class MapCamera {
|
|||||||
* will blend colour using colour multiplication
|
* will blend colour using colour multiplication
|
||||||
* i.e. red hues get lost if you dive into the water
|
* i.e. red hues get lost if you dive into the water
|
||||||
*/
|
*/
|
||||||
private static Byte[] TILES_BLEND_MUL = {
|
private static Integer[] TILES_BLEND_MUL = {
|
||||||
(byte)224, (byte)225, (byte)226, (byte)227, (byte)228, (byte)229, (byte)230, (byte)231
|
TileNameCode.WATER
|
||||||
, (byte)232, (byte)233, (byte)234, (byte)235, (byte)236, (byte)237, (byte)238, (byte)239
|
, TileNameCode.LAVA
|
||||||
, (byte)240, (byte)241, (byte)242, (byte)243, (byte)244, (byte)245, (byte)246, (byte)247
|
|
||||||
, (byte)248, (byte)249, (byte)250, (byte)251, (byte)252, (byte)253, (byte)254, (byte)255
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -225,7 +223,9 @@ public class MapCamera {
|
|||||||
// on top of the previously drawn tile
|
// on top of the previously drawn tile
|
||||||
// TODO check wether it works as intended when skybox is dark
|
// TODO check wether it works as intended when skybox is dark
|
||||||
// add instruction "if (!isBlendMul((byte) thisTile))"
|
// add instruction "if (!isBlendMul((byte) thisTile))"
|
||||||
drawTile(mode, x, y, thisTileX, thisTileY);
|
if (!isBlendMul(thisTile)) {
|
||||||
|
drawTile(mode, x, y, thisTileX, thisTileY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ public class TileProp {
|
|||||||
|
|
||||||
private int strength;
|
private int strength;
|
||||||
|
|
||||||
|
private int density;
|
||||||
|
|
||||||
private boolean fluid;
|
private boolean fluid;
|
||||||
private int viscocity;
|
private int movementResistance;
|
||||||
|
|
||||||
private boolean solid; // transparent or not
|
private boolean solid; // transparent or not
|
||||||
|
|
||||||
@@ -79,12 +81,12 @@ public class TileProp {
|
|||||||
this.fluid = fluid;
|
this.fluid = fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getViscocity() {
|
public int getMovementResistance() {
|
||||||
return viscocity;
|
return movementResistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setViscocity(int viscocity) {
|
void setMovementResistance(int movementResistance) {
|
||||||
this.viscocity = viscocity;
|
this.movementResistance = movementResistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSolid() {
|
public boolean isSolid() {
|
||||||
@@ -158,4 +160,12 @@ public class TileProp {
|
|||||||
public void setOpaque(boolean opaque) {
|
public void setOpaque(boolean opaque) {
|
||||||
this.opaque = opaque;
|
this.opaque = opaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDensity() {
|
||||||
|
return density;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDensity(int density) {
|
||||||
|
this.density = density;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public class TilePropCodex {
|
|||||||
|
|
||||||
prop.setOpacity((char) intVal(record, "opacity"));
|
prop.setOpacity((char) intVal(record, "opacity"));
|
||||||
prop.setStrength(intVal(record, "strength"));
|
prop.setStrength(intVal(record, "strength"));
|
||||||
|
prop.setDensity(intVal(record, "spcg"));
|
||||||
prop.setLuminosity((char) intVal(record, "lumcolor"));
|
prop.setLuminosity((char) intVal(record, "lumcolor"));
|
||||||
prop.setDrop(intVal(record, "drop"));
|
prop.setDrop(intVal(record, "drop"));
|
||||||
prop.setDropDamage(intVal(record, "ddmg"));
|
prop.setDropDamage(intVal(record, "ddmg"));
|
||||||
@@ -86,14 +87,17 @@ public class TilePropCodex {
|
|||||||
prop.setFallable(boolVal(record, "fall"));
|
prop.setFallable(boolVal(record, "fall"));
|
||||||
prop.setOpaque(boolVal(record, "opaque"));
|
prop.setOpaque(boolVal(record, "opaque"));
|
||||||
|
|
||||||
if (prop.isFluid()) prop.setViscocity(intVal(record, "viscosity"));
|
if (prop.isFluid()) prop.setMovementResistance(intVal(record, "movr"));
|
||||||
|
|
||||||
System.out.print(prop.getId());
|
System.out.print(formatNum3(prop.getId()) + ":" + formatNum2(prop.getDamage()));
|
||||||
System.out.println("\t" + prop.getName());
|
System.out.println("\t" + prop.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int intVal(CSVRecord rec, String s) {
|
private static int intVal(CSVRecord rec, String s) {
|
||||||
return Integer.decode(rec.get(s));
|
int ret = -1;
|
||||||
|
try { ret = Integer.decode(rec.get(s)); }
|
||||||
|
catch (NullPointerException e) {}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean boolVal(CSVRecord rec, String s) {
|
private static boolean boolVal(CSVRecord rec, String s) {
|
||||||
@@ -103,4 +107,15 @@ public class TilePropCodex {
|
|||||||
public static int indexDamageToArrayAddr(int index, int damage) {
|
public static int indexDamageToArrayAddr(int index, int damage) {
|
||||||
return (index * (PairedMapLayer.RANGE) + damage);
|
return (index * (PairedMapLayer.RANGE) + damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String formatNum3(int i) {
|
||||||
|
if (i < 10) return "00" + i;
|
||||||
|
else if (i < 100) return "0" + i;
|
||||||
|
else return String.valueOf(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatNum2(int i) {
|
||||||
|
if (i < 10) return "0" + i;
|
||||||
|
else return String.valueOf(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,60 +1,56 @@
|
|||||||
"id";"dmg";"name" ;"opacity";"strength";"fluid";"viscosity";"solid";"wall";"lumcolor";"opaque";"drop";"ddmg";"fall";"friction"
|
"id";"dmg";"name" ;"opacity";"strength";"spcg";"fluid";"movr";"solid";"wall";"lumcolor";"opaque";"drop";"ddmg";"fall";"friction"
|
||||||
"0"; "0";"TILE_AIR" ; "1641"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0";"16"
|
"0"; "0";"TILE_AIR" ; "1641"; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0";"16"
|
||||||
"1"; "0";"TILE_STONE" ; "8205"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "0"; "0";"16"
|
"1"; "0";"TILE_STONE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "0"; "0";"16"
|
||||||
"1"; "1";"TILE_STONE_QUARRIED" ; "8205"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "1"; "0";"16"
|
"1"; "1";"TILE_STONE_QUARRIED" ; "8205"; "25";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "1"; "0";"16"
|
||||||
"2"; "0";"TILE_DIRT" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "0"; "0";"16"
|
"2"; "0";"TILE_DIRT" ; "8205"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "0"; "0";"16"
|
||||||
"2"; "1";"TILE_GRASS" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "1"; "0";"16"
|
"2"; "1";"TILE_GRASS" ; "8205"; "6";"1400"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "1"; "0";"16"
|
||||||
|
"3"; "0";"TILE_PLANK_NORMAL" ; "8205"; "12"; "740"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "0"; "0";"16"
|
||||||
"3"; "0";"TILE_PLANK_NORMAL" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "0"; "0";"16"
|
"3"; "1";"TILE_PLANK_EBONY" ; "8205"; "12";"1200"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "1"; "0";"16"
|
||||||
"3"; "1";"TILE_PLANK_EBONY" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "1"; "0";"16"
|
"3"; "2";"TILE_PLANK_BIRCH" ; "8205"; "12"; "670"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "2"; "0";"16"
|
||||||
"3"; "2";"TILE_PLANK_BIRCH" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "2"; "0";"16"
|
"3"; "3";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "900"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "3"; "0";"16"
|
||||||
"3"; "3";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "3"; "3"; "0";"16"
|
"4"; "0";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "740"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "0"; "0";"16"
|
||||||
|
"4"; "1";"TILE_TRUNK_EBONY" ; "8205"; "12";"1200"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "1"; "0";"16"
|
||||||
"4"; "0";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "0"; "0";"16"
|
"4"; "2";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "670"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "2"; "0";"16"
|
||||||
"4"; "1";"TILE_TRUNK_EBONY" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "1"; "0";"16"
|
"4"; "3";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "900"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "3"; "0";"16"
|
||||||
"4"; "2";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "2"; "0";"16"
|
"5"; "0";"TILE_SAND" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "0"; "1";"16"
|
||||||
"4"; "3";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "3"; "3"; "0";"16"
|
"5"; "1";"TILE_SAND_WHITE" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "1"; "1";"16"
|
||||||
|
"5"; "2";"TILE_SAND_RED" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "2"; "1";"16"
|
||||||
"5"; "0";"TILE_SAND" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "0"; "1";"16"
|
"5"; "3";"TILE_SAND" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "3"; "1";"16"
|
||||||
"5"; "1";"TILE_SAND_WHITE" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "1"; "1";"16"
|
"5"; "4";"TILE_SAND_BLACK" ; "8205"; "6";"2400"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "4"; "1";"16"
|
||||||
"5"; "2";"TILE_SAND_RED" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "2"; "1";"16"
|
"6"; "0";"TILE_GRAVEL" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "6"; "0"; "1";"16"
|
||||||
"5"; "3";"TILE_SAND" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "3"; "1";"16"
|
"6"; "1";"TILE_GRAVEL_GREY" ; "8205"; "6";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "6"; "1"; "1";"16"
|
||||||
"5"; "4";"TILE_SAND_BLACK" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "4"; "1";"16"
|
"7"; "0";"TILE_ORE_MALACHITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "0"; "0";"16"
|
||||||
|
"7"; "1";"TILE_ORE_HEMATITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "1"; "0";"16"
|
||||||
"6"; "0";"TILE_GRAVEL" ; "8205"; "6"; "0"; "0"; "1"; "0"; "0"; "1"; "6"; "0"; "1";"16"
|
"7"; "2";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "2"; "0";"16"
|
||||||
"6"; "1";"TILE_GRAVEL_GREY" ; "8205"; "6"; "0"; "0"; "1"; "0"; "0"; "1"; "6"; "1"; "1";"16"
|
"7"; "3";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "3"; "0";"16"
|
||||||
|
"7"; "4";"TILE_ORE_RUTILE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "4"; "0";"16"
|
||||||
"7"; "0";"TILE_ORE_MALACHITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "0"; "0";"16"
|
"7"; "5";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "5"; "0";"16"
|
||||||
"7"; "1";"TILE_ORE_HEMATITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "1"; "0";"16"
|
"8"; "0";"TILE_GEM_RUBY" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "0"; "0";"16"
|
||||||
"7"; "2";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "2"; "0";"16"
|
"8"; "1";"TILE_GEM_EMERALD" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "1"; "0";"16"
|
||||||
"7"; "3";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "3"; "0";"16"
|
"8"; "2";"TILE_GEM_SAPPHIRE" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "2"; "0";"16"
|
||||||
"7"; "4";"TILE_ORE_RUTILE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "4"; "0";"16"
|
"8"; "3";"TILE_GEM_TOPAZ" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "3"; "0";"16"
|
||||||
"7"; "5";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "7"; "5"; "0";"16"
|
"8"; "4";"TILE_GEM_DIAMOND" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "4"; "0";"16"
|
||||||
|
"8"; "5";"TILE_GEM_AMETHYST" ; "8205"; "25";"2400"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "5"; "0";"16"
|
||||||
"8"; "0";"TILE_GEM_RUBY" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "0"; "0";"16"
|
"9"; "0";"TILE_SNOW" ; "8205"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "0"; "0";"16"
|
||||||
"8"; "1";"TILE_GEM_EMERALD" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "1"; "0";"16"
|
"9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "0"; "9"; "1"; "0";"16"
|
||||||
"8"; "2";"TILE_GEM_SAPPHIRE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "2"; "0";"16"
|
"9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "2"; "0"; "8"
|
||||||
"8"; "3";"TILE_GEM_TOPAZ" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "3"; "0";"16"
|
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25";"2785"; "0"; "0"; "1"; "1"; "5009"; "0"; "9"; "3"; "0"; "8"
|
||||||
"8"; "4";"TILE_GEM_DIAMOND" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "4"; "0";"16"
|
"10"; "0";"TILE_PLATFORM_STONE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
||||||
"8"; "5";"TILE_GEM_AMETHYST" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "5"; "0";"16"
|
"10"; "1";"TILE_PLATFORM_WOODEN" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "0";"16"
|
||||||
|
"10"; "2";"TILE_PLATFORM_EBONY" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
||||||
"9"; "0";"TILE_SNOW" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "0"; "0";"16"
|
"10"; "3";"TILE_PLATFORM_BIRCH" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
||||||
"9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "0"; "0"; "1"; "0"; "0"; "0"; "9"; "1"; "0";"16"
|
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
||||||
"9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "2"; "0"; "8"
|
"11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "63412"; "0"; "11"; "0"; "0";"16"
|
||||||
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "0"; "1"; "1"; "5009"; "0"; "9"; "3"; "0"; "8"
|
"254"; "15";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "16"; "0"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
|
"255"; "15";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "0"; "N/A"; "N/A"; "0";"16"
|
||||||
"10"; "0";"TILE_PLATFORM_STONE" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
|
||||||
"10"; "1";"TILE_PLATFORM_WOODEN" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "0";"16"
|
|
||||||
"10"; "2";"TILE_PLATFORM_EBONY" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
|
||||||
"10"; "3";"TILE_PLATFORM_BIRCH" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
|
||||||
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "0"; "1"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
|
||||||
|
|
||||||
"11"; "0";"TILE_TORCH" ; "0"; "0"; "0"; "0"; "0"; "0"; "63412"; "0"; "11"; "0"; "0";"16"
|
|
||||||
# 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
|
||||||
"254"; "15";"TILE_WATER" ; "6522"; "100"; "1"; "16"; "0"; "0"; "0"; "0"; "-1"; "-1"; "0";"16"
|
|
||||||
"255"; "15";"TILE_LAVA" ; "62358"; "100"; "1"; "16"; "0"; "0"; "48320"; "0"; "-1"; "-1"; "0";"16"
|
|
||||||
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky
|
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky
|
||||||
# Opacity/Lumcolor: 40-step RGB
|
# Opacity/Lumcolor: 40-step RGB
|
||||||
# Opaque: whether the tile completely hides wall behind
|
# Opaque: whether the tile completely hides wall behind
|
||||||
# Solid: whether the tile has collision
|
# Solid: whether the tile has full collision
|
||||||
# Viscosity: (walkspeedmax) * (1 + (n/16))
|
# movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed
|
||||||
|
# spcg: specific gravity, aka density. [g/l]
|
||||||
|
# Defalut torch should have a colour of 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
||||||
|
# Assume magical ice as Ice-X.
|
||||||
|
# References:
|
||||||
|
# * Density of various woods : http://www.engineeringtoolbox.com/wood-density-d_40.html
|
||||||
|
# * Density of various phases of ice : http://www1.lsbu.ac.uk/water/ice_phases.html
|
||||||
|
Can't render this file because it contains an unexpected character in line 1 and column 18.
|
Reference in New Issue
Block a user