Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow death due to fall damage and make the player face the opponents base #215

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.Optional;
import java.util.Random;

import org.joml.AxisAngle4f;
import org.joml.Quaternionf;
import org.joml.Vector3f;
import org.joml.Vector3fc;
import org.terasology.engine.utilities.Assets;
Expand Down Expand Up @@ -72,12 +74,14 @@ public void beforeDestroy(BeforeDestroyEvent event, EntityRef player, CharacterC
if (player.hasComponent(PlayerCharacterComponent.class)) {
event.consume();
String team = player.getComponent(LASTeamComponent.class).team;
updateStatistics(event.getInstigator(), "kills");
if (event.getInstigator() != EntityRef.NULL) {
updateStatistics(event.getInstigator(), "kills");
}
updateStatistics(player, "deaths");
dropItemsFromInventory(player);
player.send(new RestoreFullHealthEvent(player));
Vector3f randomVector = new Vector3f(-1 + random.nextInt(3), 0, -1 + random.nextInt(3));
player.send(new CharacterTeleportEvent(randomVector.add(LASUtils.getTeleportDestination(team))));
player.send(new CharacterTeleportEvent(randomVector.add(LASUtils.getTeleportDestination(team)), new Quaternionf(new AxisAngle4f((float) (Math.PI), 0, 1, 0))));
player.addOrSaveComponent(startingInventory);
player.send(new RequestInventoryEvent(startingInventory.items));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import java.util.Optional;
import java.util.Random;

import org.joml.AxisAngle4f;
import org.joml.Quaternionf;
import org.joml.Vector3f;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -123,7 +125,7 @@ private String setPlayerTeamToTeleporterTeam(EntityRef player, EntityRef telepor

private void handlePlayerTeleport(EntityRef player, String team) {
Vector3f randomVector = new Vector3f(-1 + random.nextInt(3), 0, -1 + random.nextInt(3));
player.send(new CharacterTeleportEvent(randomVector.add(LASUtils.getTeleportDestination(team))));
player.send(new CharacterTeleportEvent(randomVector.add(LASUtils.getTeleportDestination(team)), new Quaternionf(new AxisAngle4f((float) (Math.PI), 0, 1, 0))));
player.addOrSaveComponent(startingInventory);
player.send(new RequestInventoryEvent(startingInventory.items));
}
Expand Down