mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 10:04:05 +09:00
successfully implemented fluidal movement resistance, batch command processing
Former-commit-id: 64282c01aac622cce25cf7c9a79f53059d8f6547 Former-commit-id: d96a602887400c91bfee7660c29f12118858e6f3
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -34,14 +34,14 @@
|
|||||||
"9"; "0";"TILE_SNOW" ; "8205"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "0"; "0";"16"
|
"9"; "0";"TILE_SNOW" ; "8205"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "0"; "0";"16"
|
||||||
"9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "0"; "9"; "1"; "0";"16"
|
"9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "0"; "9"; "1"; "0";"16"
|
||||||
"9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "2"; "0"; "8"
|
"9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "2"; "0"; "8"
|
||||||
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25";"2785"; "0"; "0"; "1"; "1"; "5009"; "0"; "9"; "3"; "0"; "8"
|
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25";"5170"; "0"; "0"; "1"; "1"; "5009"; "0"; "9"; "3"; "0"; "8"
|
||||||
"10"; "0";"TILE_PLATFORM_STONE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
"10"; "0";"TILE_PLATFORM_STONE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
||||||
"10"; "1";"TILE_PLATFORM_WOODEN" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "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"
|
"10"; "2";"TILE_PLATFORM_EBONY" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
||||||
"10"; "3";"TILE_PLATFORM_BIRCH" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
"10"; "3";"TILE_PLATFORM_BIRCH" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
||||||
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
||||||
"11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "63412"; "0"; "11"; "0"; "0";"16"
|
"11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "63412"; "0"; "11"; "0"; "0";"16"
|
||||||
"254"; "15";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "16"; "0"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"254"; "15";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "9"; "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"
|
"255"; "15";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "0"; "N/A"; "N/A"; "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
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
# movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed
|
# movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed
|
||||||
# spcg: specific gravity, aka density. [g/l]
|
# spcg: specific gravity, aka density. [g/l]
|
||||||
# Defalut torch should have a colour of 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
# Defalut torch should have a colour of 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
||||||
# Assume magical ice as Ice-X.
|
# Magical ice: theoretical __metallic__ ice that might form under super-high pressure (> 5 TPa). Its density is a wild guess, exponential prediction.
|
||||||
# References:
|
# References:
|
||||||
# * Density of various woods : http://www.engineeringtoolbox.com/wood-density-d_40.html
|
# * 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
|
# * 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.
|
4
res/batchtest.txt
Normal file
4
res/batchtest.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
echo "Hello, world!"
|
||||||
|
echo "This is a batch test."
|
||||||
|
setav batch true
|
||||||
|
getav batch
|
||||||
@@ -255,7 +255,7 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
|
|
||||||
veloY += clampCeil(
|
veloY += clampCeil(
|
||||||
((W - D) / mass) * SI_TO_GAME_ACC * G_MUL_PLAYABLE_CONST
|
((W - D) / mass) * SI_TO_GAME_ACC * G_MUL_PLAYABLE_CONST
|
||||||
* mvmtRstcToMultiplier(fluidResistance) // eliminate shoot-up from fluids
|
// * mvmtRstcToMultiplier(fluidResistance) // eliminate shoot-up from fluids
|
||||||
, VELO_HARD_LIMIT
|
, VELO_HARD_LIMIT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -493,7 +493,7 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
veloY -= ((fluidDensity - this.density)
|
veloY -= ((fluidDensity - this.density)
|
||||||
* map.getGravitation() * submergedVolume
|
* map.getGravitation() * submergedVolume
|
||||||
* Math.pow(mass, -1)
|
* Math.pow(mass, -1)
|
||||||
* mvmtRstcToMultiplier(fluidResistance) // eliminate shoot-up
|
// * mvmtRstcToMultiplier(fluidResistance) // eliminate shoot-up
|
||||||
* SI_TO_GAME_ACC);
|
* SI_TO_GAME_ACC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -615,8 +615,8 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
return density;
|
return density;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float mvmtRstcToMultiplier(int viscosity) {
|
private float mvmtRstcToMultiplier(int movementResistanceValue) {
|
||||||
return 1f / (1 + (viscosity / 16f));
|
return 1f / (1 + (movementResistanceValue / 16f));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clampHitbox() {
|
private void clampHitbox() {
|
||||||
@@ -634,9 +634,17 @@ public class ActorWithBody implements Actor, Visible, Glowing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateNextHitboxFromVelo() {
|
private void updateNextHitboxFromVelo() {
|
||||||
|
float fluidResistance = mvmtRstcToMultiplier(getTileMvmtRstc());
|
||||||
|
|
||||||
nextHitbox.set(
|
nextHitbox.set(
|
||||||
Math.round(hitbox.getPosX() + veloX)
|
Math.round(hitbox.getPosX()
|
||||||
, Math.round(hitbox.getPosY() + veloY)
|
+ (veloX
|
||||||
|
* (isNoSubjectToFluidResistance() ? 1 : fluidResistance)
|
||||||
|
))
|
||||||
|
, Math.round(hitbox.getPosY()
|
||||||
|
+ (veloY
|
||||||
|
* (isNoSubjectToFluidResistance() ? 1 : fluidResistance)
|
||||||
|
))
|
||||||
, Math.round(baseHitboxW * scale)
|
, Math.round(baseHitboxW * scale)
|
||||||
, Math.round(baseHitboxH * scale)
|
, Math.round(baseHitboxH * scale)
|
||||||
/** Full quantisation; wonder what havoc these statements would wreak...
|
/** Full quantisation; wonder what havoc these statements would wreak...
|
||||||
|
|||||||
@@ -15,11 +15,10 @@ public class Authenticator implements ConsoleCommand {
|
|||||||
public void execute(String[] args) {
|
public void execute(String[] args) {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
String pwd = args[1];
|
String pwd = args[1];
|
||||||
|
|
||||||
String hashedPwd = DigestUtils.sha256Hex(pwd);
|
String hashedPwd = DigestUtils.sha256Hex(pwd);
|
||||||
|
|
||||||
if ("54c5b3dd459d5ef778bb2fa1e23a5fb0e1b62ae66970bcb436e8f81a1a1a8e41".equalsIgnoreCase(hashedPwd)) {
|
if ("54c5b3dd459d5ef778bb2fa1e23a5fb0e1b62ae66970bcb436e8f81a1a1a8e41"
|
||||||
// alpine
|
.equalsIgnoreCase(hashedPwd)) { // alpine
|
||||||
String msg = (a) ? "Locked" : "Authenticated";
|
String msg = (a) ? "Locked" : "Authenticated";
|
||||||
new Echo().execute(msg);
|
new Echo().execute(msg);
|
||||||
System.out.println("[Authenticator] " + msg);
|
System.out.println("[Authenticator] " + msg);
|
||||||
|
|||||||
25
src/com/Torvald/Terrarum/ConsoleCommand/Batch.java
Normal file
25
src/com/Torvald/Terrarum/ConsoleCommand/Batch.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package com.Torvald.Terrarum.ConsoleCommand;
|
||||||
|
|
||||||
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 16-03-07.
|
||||||
|
*/
|
||||||
|
public class Batch implements ConsoleCommand {
|
||||||
|
@Override
|
||||||
|
public void execute(String[] args) throws Exception {
|
||||||
|
if (args.length == 2) {
|
||||||
|
Files.lines(FileSystems.getDefault().getPath(args[1])).forEach
|
||||||
|
(CommandInterpreter::execute);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printUsage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void printUsage() {
|
||||||
|
new Echo().execute("batch path/to/batch.txt");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ public class CommandDict {
|
|||||||
public CommandDict() {
|
public CommandDict() {
|
||||||
dict = new Hashtable<>();
|
dict = new Hashtable<>();
|
||||||
|
|
||||||
|
dict.put("echo", new Echo());
|
||||||
dict.put("setav", new SetAV());
|
dict.put("setav", new SetAV());
|
||||||
dict.put("qqq", new QuitApp());
|
dict.put("qqq", new QuitApp());
|
||||||
dict.put("codex", new CodexEdictis());
|
dict.put("codex", new CodexEdictis());
|
||||||
@@ -27,6 +28,7 @@ public class CommandDict {
|
|||||||
dict.put("setlocale", new SetLocale());
|
dict.put("setlocale", new SetLocale());
|
||||||
dict.put("zoom", new Zoom());
|
dict.put("zoom", new Zoom());
|
||||||
dict.put("teleport", new TeleportPlayer());
|
dict.put("teleport", new TeleportPlayer());
|
||||||
|
dict.put("tp", dict.get("teleport"));
|
||||||
dict.put("cat", new CatStdout());
|
dict.put("cat", new CatStdout());
|
||||||
dict.put("exportav", new ExportAV());
|
dict.put("exportav", new ExportAV());
|
||||||
dict.put("gsontest", new GsonTest());
|
dict.put("gsontest", new GsonTest());
|
||||||
@@ -34,6 +36,7 @@ public class CommandDict {
|
|||||||
dict.put("getfaction", new GetFactioning());
|
dict.put("getfaction", new GetFactioning());
|
||||||
dict.put("auth", Terrarum.game.auth);
|
dict.put("auth", Terrarum.game.auth);
|
||||||
dict.put("spawnball", new SpawnPhysTestBall());
|
dict.put("spawnball", new SpawnPhysTestBall());
|
||||||
|
dict.put("batch", new Batch());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConsoleCommand getCommand(String commandName) {
|
public static ConsoleCommand getCommand(String commandName) {
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
package com.Torvald.Terrarum.ConsoleCommand;
|
package com.Torvald.Terrarum.ConsoleCommand;
|
||||||
|
|
||||||
import com.Torvald.Terrarum.Game;
|
|
||||||
import com.Torvald.Terrarum.Terrarum;
|
import com.Torvald.Terrarum.Terrarum;
|
||||||
import com.Torvald.Terrarum.UserInterface.ConsoleWindow;
|
import com.Torvald.Terrarum.UserInterface.ConsoleWindow;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 16-01-16.
|
* Created by minjaesong on 16-01-16.
|
||||||
*/
|
*/
|
||||||
class Echo implements ConsoleCommand {
|
class Echo implements ConsoleCommand {
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] args) {
|
public void execute(String[] args) {
|
||||||
((ConsoleWindow) Terrarum.game.consoleHandler.getUI())
|
String[] argsWoHeader = new String[args.length - 1];
|
||||||
.sendMessage(args.toString());
|
for (int i = 0; i < argsWoHeader.length; i++)
|
||||||
|
argsWoHeader[i] = args[i + 1];
|
||||||
|
|
||||||
|
Arrays.asList(argsWoHeader).forEach(
|
||||||
|
((ConsoleWindow) Terrarum.game.consoleHandler.getUI())::sendMessage
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute(String single_line) {
|
public void execute(String single_line) {
|
||||||
|
|||||||
@@ -34,14 +34,14 @@
|
|||||||
"9"; "0";"TILE_SNOW" ; "8205"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "0"; "0";"16"
|
"9"; "0";"TILE_SNOW" ; "8205"; "6"; "500"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "0"; "0";"16"
|
||||||
"9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "0"; "9"; "1"; "0";"16"
|
"9"; "1";"TILE_ICE_FRAGILE" ; "3282"; "1"; "930"; "0"; "0"; "1"; "0"; "0"; "0"; "9"; "1"; "0";"16"
|
||||||
"9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "2"; "0"; "8"
|
"9"; "2";"TILE_ICE_NATURAL" ; "6564"; "25"; "930"; "0"; "0"; "1"; "1"; "0"; "1"; "9"; "2"; "0"; "8"
|
||||||
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25";"2785"; "0"; "0"; "1"; "1"; "5009"; "0"; "9"; "3"; "0"; "8"
|
"9"; "3";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25";"3720"; "0"; "0"; "1"; "1"; "5009"; "0"; "9"; "3"; "0"; "8"
|
||||||
"10"; "0";"TILE_PLATFORM_STONE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
"10"; "0";"TILE_PLATFORM_STONE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "0"; "0";"16"
|
||||||
"10"; "1";"TILE_PLATFORM_WOODEN" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "1"; "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"
|
"10"; "2";"TILE_PLATFORM_EBONY" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16"
|
||||||
"10"; "3";"TILE_PLATFORM_BIRCH" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
"10"; "3";"TILE_PLATFORM_BIRCH" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16"
|
||||||
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
"10"; "4";"TILE_PLATFORM_BLOODROSE" ; "0"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16"
|
||||||
"11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "63412"; "0"; "11"; "0"; "0";"16"
|
"11"; "0";"TILE_TORCH" ; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "63412"; "0"; "11"; "0"; "0";"16"
|
||||||
"254"; "15";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "16"; "0"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16"
|
"254"; "15";"TILE_WATER" ; "6522"; "100";"1000"; "1"; "12"; "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"
|
"255"; "15";"TILE_LAVA" ; "62358"; "100";"2600"; "1"; "48"; "0"; "0"; "48320"; "0"; "N/A"; "N/A"; "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
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
# movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed
|
# movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed
|
||||||
# spcg: specific gravity, aka density. [g/l]
|
# spcg: specific gravity, aka density. [g/l]
|
||||||
# Defalut torch should have a colour of 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
# Defalut torch should have a colour of 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
||||||
# Assume magical ice as Ice-X.
|
# Magical ice: theoretical __metallic__ ice that might form under super-high pressure (> 5 TPa). Its density is a wild guess.
|
||||||
# References:
|
# References:
|
||||||
# * Density of various woods : http://www.engineeringtoolbox.com/wood-density-d_40.html
|
# * 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
|
# * 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