my_area now will show area you are in via particles, Areas are more strict with does_intersect
Some checks failed
/ Auto-Build-App (push) Has been cancelled
Some checks failed
/ Auto-Build-App (push) Has been cancelled
This commit is contained in:
parent
f0d5f13ac4
commit
6c6d60f7a5
5 changed files with 66 additions and 10 deletions
|
@ -4,14 +4,14 @@ org.gradle.parallel=true
|
||||||
org.gradle.caching=false
|
org.gradle.caching=false
|
||||||
|
|
||||||
# Project Info
|
# Project Info
|
||||||
version=1.0.5
|
version=1.0.6
|
||||||
group=net.pietru
|
group=net.pietru
|
||||||
id=cookie_utils
|
id=cookie_utils
|
||||||
|
|
||||||
# Dependency Versions
|
# Dependency Versions
|
||||||
cosmic_reach_version=0.3.16
|
cosmic_reach_version=0.3.26
|
||||||
# If unspecified, will use the version above
|
# If unspecified, will use the version above
|
||||||
cosmic_reach_server_version=0.3.16
|
cosmic_reach_server_version=0.3.26
|
||||||
cosmic_quilt_version=2.3.1
|
cosmic_quilt_version=2.3.1
|
||||||
#2.2.0
|
#2.2.0
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,9 @@ public class Area {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean does_intersect(Vector3 c){
|
public boolean does_intersect(Vector3 c){
|
||||||
|
c.x=(int)c.x;
|
||||||
|
c.y=(int)c.y;
|
||||||
|
c.z=(int)c.z;
|
||||||
return space.contains(c);
|
return space.contains(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class Region {
|
||||||
|
|
||||||
if (is_not_reloading)
|
if (is_not_reloading)
|
||||||
for (Area a : areas){
|
for (Area a : areas){
|
||||||
if (a.enabled && (z.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(g_position)){
|
if (a.enabled && (a.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(g_position)){
|
||||||
can=a.get_action_bool(action,player_id);
|
can=a.get_action_bool(action,player_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class Region {
|
||||||
if (is_not_reloading)
|
if (is_not_reloading)
|
||||||
for (int i = 0; i< areas.size; i++){
|
for (int i = 0; i< areas.size; i++){
|
||||||
Area a = areas.get(i);
|
Area a = areas.get(i);
|
||||||
if (a.enabled && (z.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(g_position)){
|
if (a.enabled && (a.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(g_position)){
|
||||||
can=a.get_action_bool(action);
|
can=a.get_action_bool(action);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class Region {
|
||||||
if (is_not_reloading)
|
if (is_not_reloading)
|
||||||
for (int i = 0; i< areas.size; i++){
|
for (int i = 0; i< areas.size; i++){
|
||||||
Area a = areas.get(i);
|
Area a = areas.get(i);
|
||||||
if (a.enabled && (z.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(position)){
|
if (a.enabled && (a.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(position)){
|
||||||
can=a.get_action_bool(action,player_id);
|
can=a.get_action_bool(action,player_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class Region {
|
||||||
if (is_not_reloading)
|
if (is_not_reloading)
|
||||||
for (int i = 0; i< areas.size; i++){
|
for (int i = 0; i< areas.size; i++){
|
||||||
Area a = areas.get(i);
|
Area a = areas.get(i);
|
||||||
if (a.enabled && (z.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(position)){
|
if (a.enabled && (a.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(position)){
|
||||||
can=a.get_action_bool(action);
|
can=a.get_action_bool(action);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ public class Region {
|
||||||
if (is_not_reloading)
|
if (is_not_reloading)
|
||||||
for (int i = 0; i< areas.size; i++){
|
for (int i = 0; i< areas.size; i++){
|
||||||
Area a = areas.get(i);
|
Area a = areas.get(i);
|
||||||
if (a.enabled && (z.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(position)){
|
if (a.enabled && (a.zoneId.isEmpty() || z.zoneId.equals(a.zoneId)) && a.does_intersect(position)){
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
package net.pietru.cookie_utils.api;
|
package net.pietru.cookie_utils.api;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
|
import com.badlogic.gdx.math.collision.BoundingBox;
|
||||||
import com.badlogic.gdx.utils.Json;
|
import com.badlogic.gdx.utils.Json;
|
||||||
import com.badlogic.gdx.utils.JsonWriter;
|
import com.badlogic.gdx.utils.JsonWriter;
|
||||||
import finalforeach.cosmicreach.GameSingletons;
|
import finalforeach.cosmicreach.GameSingletons;
|
||||||
import finalforeach.cosmicreach.ZoneLoader;
|
import finalforeach.cosmicreach.ZoneLoader;
|
||||||
import finalforeach.cosmicreach.ZoneLoaders;
|
import finalforeach.cosmicreach.ZoneLoaders;
|
||||||
import finalforeach.cosmicreach.accounts.Account;
|
import finalforeach.cosmicreach.accounts.Account;
|
||||||
|
import finalforeach.cosmicreach.entities.EntityLaserProjectile;
|
||||||
import finalforeach.cosmicreach.entities.player.Player;
|
import finalforeach.cosmicreach.entities.player.Player;
|
||||||
import finalforeach.cosmicreach.io.SaveLocation;
|
import finalforeach.cosmicreach.io.SaveLocation;
|
||||||
import finalforeach.cosmicreach.networking.NetworkIdentity;
|
import finalforeach.cosmicreach.networking.NetworkIdentity;
|
||||||
import finalforeach.cosmicreach.networking.packets.MessagePacket;
|
import finalforeach.cosmicreach.networking.packets.MessagePacket;
|
||||||
|
import finalforeach.cosmicreach.networking.packets.ParticleSystemPacket;
|
||||||
import finalforeach.cosmicreach.networking.server.ServerSingletons;
|
import finalforeach.cosmicreach.networking.server.ServerSingletons;
|
||||||
|
import finalforeach.cosmicreach.particles.GameParticleSystem;
|
||||||
import finalforeach.cosmicreach.savelib.utils.TriConsumer;
|
import finalforeach.cosmicreach.savelib.utils.TriConsumer;
|
||||||
import finalforeach.cosmicreach.world.IZoneLoader;
|
import finalforeach.cosmicreach.world.IZoneLoader;
|
||||||
import finalforeach.cosmicreach.world.Zone;
|
import finalforeach.cosmicreach.world.Zone;
|
||||||
|
@ -20,6 +25,7 @@ import io.netty.channel.ChannelHandlerContext;
|
||||||
import net.pietru.cookie_utils.permissions.GroupPerms;
|
import net.pietru.cookie_utils.permissions.GroupPerms;
|
||||||
import net.pietru.cookie_utils.permissions.Permissions;
|
import net.pietru.cookie_utils.permissions.Permissions;
|
||||||
import net.pietru.cookie_utils.setups.Setup;
|
import net.pietru.cookie_utils.setups.Setup;
|
||||||
|
import net.pietru.cookie_utils.utils.ParticleUtil;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -101,12 +107,42 @@ public class TextCommands {
|
||||||
MessagePacket packet = new MessagePacket("[Server] Your name is "+account.getUsername());
|
MessagePacket packet = new MessagePacket("[Server] Your name is "+account.getUsername());
|
||||||
packet.setupAndSend(channelHandlerContext);
|
packet.setupAndSend(channelHandlerContext);
|
||||||
});
|
});
|
||||||
commands.put("my_area",(args, networkIdentity, channelHandlerContext) -> {
|
commands.put("my_area",(args, networkIdentity, ctx) -> {
|
||||||
Player plr = ServerSingletons.getPlayer(networkIdentity);
|
Player plr = ServerSingletons.getPlayer(networkIdentity);
|
||||||
Area area = get_area_at_pos(plr.getPosition(), plr.getZone());
|
Area area = get_area_at_pos(plr.getPosition(), plr.getZone());
|
||||||
|
|
||||||
MessagePacket packet = new MessagePacket("[Server] You are in "+(area!=null?area.name : "no area atm..."));
|
MessagePacket packet = new MessagePacket("[Server] You are in "+(area!=null?area.name : "no area atm..."));
|
||||||
packet.setupAndSend(channelHandlerContext);
|
packet.setupAndSend(ctx);
|
||||||
|
|
||||||
|
if (area==null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BoundingBox bb = area.getBox();
|
||||||
|
|
||||||
|
GameParticleSystem system = GameParticleSystem.laserParticleSystem.copy();
|
||||||
|
system.startColor.set(Color.YELLOW);
|
||||||
|
system.duration = 20.0F;
|
||||||
|
|
||||||
|
Vector3 m = new Vector3(.5f,.5f,.5f);
|
||||||
|
|
||||||
|
for (int x = (int) bb.min.x; x<=bb.max.x; x++){
|
||||||
|
ParticleUtil.send_particle(x, (int) bb.min.y, (int) bb.min.z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle(x, (int) bb.max.y, (int) bb.min.z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle(x, (int) bb.min.y, (int) bb.max.z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle(x, (int) bb.max.y, (int) bb.max.z,system,ctx,m);
|
||||||
|
}
|
||||||
|
for (int y = (int) bb.min.y; y<=bb.max.y; y++){
|
||||||
|
ParticleUtil.send_particle((int) bb.min.x,y, (int) bb.min.z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle((int) bb.max.x,y, (int) bb.min.z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle((int) bb.min.x,y, (int) bb.max.z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle((int) bb.max.x,y, (int) bb.max.z,system,ctx,m);
|
||||||
|
}
|
||||||
|
for (int z = (int) bb.min.z; z<=bb.max.z; z++){
|
||||||
|
ParticleUtil.send_particle((int) bb.min.x, (int) bb.min.y,z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle((int) bb.max.x, (int) bb.min.y,z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle((int) bb.min.x, (int) bb.max.y,z,system,ctx,m);
|
||||||
|
ParticleUtil.send_particle((int) bb.max.x, (int) bb.max.y,z,system,ctx,m);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
commands.put("my_claims",(args, networkIdentity, channelHandlerContext) -> {
|
commands.put("my_claims",(args, networkIdentity, channelHandlerContext) -> {
|
||||||
Account account = ServerSingletons.getAccount(networkIdentity);
|
Account account = ServerSingletons.getAccount(networkIdentity);
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package net.pietru.cookie_utils.utils;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.math.Vector3;
|
||||||
|
import finalforeach.cosmicreach.networking.packets.ParticleSystemPacket;
|
||||||
|
import finalforeach.cosmicreach.particles.GameParticleSystem;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
|
||||||
|
public class ParticleUtil {
|
||||||
|
public static void send_particle(float x, float y, float z, GameParticleSystem system, ChannelHandlerContext ctx){
|
||||||
|
system.setOrigin(x,y,z);
|
||||||
|
ParticleSystemPacket particle = new ParticleSystemPacket(system);
|
||||||
|
particle.setupAndSend(ctx);
|
||||||
|
}
|
||||||
|
public static void send_particle(float x, float y, float z, GameParticleSystem system, ChannelHandlerContext ctx, Vector3 m){
|
||||||
|
send_particle(x+m.x,y+m.y,z+m.z,system,ctx);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue