mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Tweaks to jumppad physics.
This commit is contained in:
parent
f9cbf11abb
commit
f1ab8296e4
@ -1,5 +1,5 @@
|
|||||||
#Tue, 13 Aug 2013 18:21:17 +0200
|
#Tue, 13 Aug 2013 16:50:36 -0400
|
||||||
|
|
||||||
program.VERSION=2.22
|
program.VERSION=2.22
|
||||||
program.BUILDNUM=446
|
program.BUILDNUM=458
|
||||||
program.BUILDDATE=08/13/2013 06\:21 PM
|
program.BUILDDATE=08/13/2013 04\:50 PM
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Tue Aug 13 18:21:17 CEST 2013
|
#Tue Aug 13 16:50:36 EDT 2013
|
||||||
build.number=447
|
build.number=459
|
||||||
|
@ -37,7 +37,7 @@ public class Command_jumppads extends TFM_Command
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Enabling Jumppads", false);
|
TFM_Util.adminAction(sender.getName(), "Enabling Jumppads", false);
|
||||||
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.NORMAL);
|
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.MADGEEK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -52,8 +52,8 @@ public class Command_jumppads extends TFM_Command
|
|||||||
{
|
{
|
||||||
if (TFM_Util.isStopCommand(args[1]))
|
if (TFM_Util.isStopCommand(args[1]))
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Setting Jumppads mode to: Normal", false);
|
TFM_Util.adminAction(sender.getName(), "Setting Jumppads mode to: Madgeek", false);
|
||||||
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.NORMAL);
|
TFM_Jumppads.getInstance().setMode(TFM_Jumppads.JumpPadMode.MADGEEK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
Long lastRan = TFM_Heartbeat.getLastRan();
|
Long lastRan = TFM_Heartbeat.getLastRan();
|
||||||
if (lastRan == null || lastRan + TotalFreedomMod.HEARTBEAT_RATE * 1000L < System.currentTimeMillis())
|
if (lastRan == null || lastRan + TotalFreedomMod.HEARTBEAT_RATE * 1000L < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
TFM_Log.warning("Heartbeat service timeout - can't check block place/break rates.");
|
//TFM_Log.warning("Heartbeat service timeout - can't check block place/break rates.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -151,7 +151,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
Long lastRan = TFM_Heartbeat.getLastRan();
|
Long lastRan = TFM_Heartbeat.getLastRan();
|
||||||
if (lastRan == null || lastRan + TotalFreedomMod.HEARTBEAT_RATE * 1000L < System.currentTimeMillis())
|
if (lastRan == null || lastRan + TotalFreedomMod.HEARTBEAT_RATE * 1000L < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
TFM_Log.warning("Heartbeat service timeout - can't check block place/break rates.");
|
//TFM_Log.warning("Heartbeat service timeout - can't check block place/break rates.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -401,7 +401,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
Long lastRan = TFM_Heartbeat.getLastRan();
|
Long lastRan = TFM_Heartbeat.getLastRan();
|
||||||
if (lastRan == null || lastRan + TotalFreedomMod.HEARTBEAT_RATE * 1000L < System.currentTimeMillis())
|
if (lastRan == null || lastRan + TotalFreedomMod.HEARTBEAT_RATE * 1000L < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
TFM_Log.warning("Heartbeat service timeout - can't check block place/break rates.");
|
//TFM_Log.warning("Heartbeat service timeout - can't check block place/break rates.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -10,6 +12,7 @@ public class TFM_Jumppads
|
|||||||
{
|
{
|
||||||
public static final Material BLOCK_ID = Material.WOOL;
|
public static final Material BLOCK_ID = Material.WOOL;
|
||||||
public static final double DAMPING_COEFFICIENT = 0.8;
|
public static final double DAMPING_COEFFICIENT = 0.8;
|
||||||
|
public final Map<Player, Boolean> canPushMap = new HashMap<Player, Boolean>();
|
||||||
private JumpPadMode mode = JumpPadMode.OFF;
|
private JumpPadMode mode = JumpPadMode.OFF;
|
||||||
private double strength = 0.4;
|
private double strength = 0.4;
|
||||||
|
|
||||||
@ -24,6 +27,29 @@ public class TFM_Jumppads
|
|||||||
final Block block = event.getTo().getBlock();
|
final Block block = event.getTo().getBlock();
|
||||||
final Vector velocity = player.getVelocity().clone();
|
final Vector velocity = player.getVelocity().clone();
|
||||||
|
|
||||||
|
if (mode == JumpPadMode.MADGEEK)
|
||||||
|
{
|
||||||
|
Boolean canPush = canPushMap.get(player);
|
||||||
|
if (canPush == null)
|
||||||
|
{
|
||||||
|
canPush = true;
|
||||||
|
}
|
||||||
|
if (block.getRelative(0, -1, 0).getType() == BLOCK_ID)
|
||||||
|
{
|
||||||
|
if (canPush)
|
||||||
|
{
|
||||||
|
velocity.multiply(strength + 0.85).multiply(-1.0);
|
||||||
|
}
|
||||||
|
canPush = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
canPush = true;
|
||||||
|
}
|
||||||
|
canPushMap.put(player, canPush);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (block.getRelative(0, -1, 0).getType() == BLOCK_ID)
|
if (block.getRelative(0, -1, 0).getType() == BLOCK_ID)
|
||||||
{
|
{
|
||||||
velocity.add(new Vector(0.0, strength, 0.0));
|
velocity.add(new Vector(0.0, strength, 0.0));
|
||||||
@ -51,6 +77,7 @@ public class TFM_Jumppads
|
|||||||
velocity.add(new Vector(0.0, 0.0, DAMPING_COEFFICIENT * strength));
|
velocity.add(new Vector(0.0, 0.0, DAMPING_COEFFICIENT * strength));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!player.getVelocity().equals(velocity))
|
if (!player.getVelocity().equals(velocity))
|
||||||
{
|
{
|
||||||
@ -81,7 +108,7 @@ public class TFM_Jumppads
|
|||||||
|
|
||||||
public static enum JumpPadMode
|
public static enum JumpPadMode
|
||||||
{
|
{
|
||||||
OFF(false), NORMAL(true), NORMAL_AND_SIDEWAYS(true);
|
OFF(false), NORMAL(true), NORMAL_AND_SIDEWAYS(true), MADGEEK(true);
|
||||||
private boolean on;
|
private boolean on;
|
||||||
|
|
||||||
JumpPadMode(boolean on)
|
JumpPadMode(boolean on)
|
||||||
|
Loading…
Reference in New Issue
Block a user