18 Commits

Author SHA1 Message Date
ac374f5b52 Merge pull request #247 from nekojanai/remove-dead-uri
Remove dead URI muchassemblyrequired.com
2024-10-23 20:37:03 -04:00
nekojanai
d01eac646f Update README.md
The website muchassemblyrequired.com no longer points to anything related to this repo.

I suggest also removing the URI from the description.
2024-10-23 20:53:42 +02:00
35b48ddd95 Merge pull request #243 from mavlushechka/master
Update installation guide on Arch Linux
2022-05-01 14:11:43 -04:00
Mavlon
5a0c5b6911 Update installation guide on Arch Linux
Change the package manager from pacman to yay which installs mongodb.

Beginning with January 2019 mongodb package is not available in the official Arch repositories and can't be installed using pacman. Instead of pacman you can use yay to compile mongodb or install prebuilt mongodb-bin. To compile mongodb you should have 260 GB available on your hard disk, so mongodb-bin is easier to install.

As a result, guide is now correct for Arch Linux users.
2022-05-01 16:41:52 +05:00
a85e672eb9 Update docker-compose.yml 2021-03-20 09:59:13 -04:00
053d3e35ec Merge pull request #238 from simon987/dependabot/maven/Server/junit-junit-4.13.1
Bump junit from 4.12 to 4.13.1 in /Server
2020-10-28 21:29:13 -04:00
dependabot[bot]
35140cc834 Bump junit from 4.12 to 4.13.1 in /Server
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-13 04:57:43 +00:00
6a9c656e66 Merge pull request #237 from helloausrine/master
DOC: Improvements
2020-10-03 18:58:01 -04:00
helloausrine
d07a59607f Update README.md 2020-10-03 18:10:38 +10:00
cd9e555e86 Merge pull request #226 from kevinramharak/fix-client-size-console-buffer-update
fix faulty object property name
2020-07-27 13:06:32 -04:00
Kevin Ramharak
7c0187f514 fix faulty object property name 2020-07-27 17:25:05 +02:00
ac27250f98 Merge pull request #225 from simon987/dependabot/maven/Server/org.springframework.security-spring-security-core-5.1.11.RELEASE
Bump spring-security-core from 5.1.5.RELEASE to 5.1.11.RELEASE in /Server
2020-06-15 16:10:53 -04:00
dependabot[bot]
84f59a5fa2 Bump spring-security-core in /Server
Bumps [spring-security-core](https://github.com/spring-projects/spring-security) from 5.1.5.RELEASE to 5.1.11.RELEASE.
- [Release notes](https://github.com/spring-projects/spring-security/releases)
- [Commits](https://github.com/spring-projects/spring-security/compare/5.1.5.RELEASE...5.1.11.RELEASE)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-15 19:36:46 +00:00
a0193621a8 Remove jenkins folder 2020-05-29 18:34:14 -04:00
922162660f Update footer.vm 2020-02-19 22:38:36 -05:00
014dab49da Merge pull request #221 from OrdoFlammae/radioactivecloud
Added Radioactive Cloud object.
2019-11-28 13:11:57 -05:00
Ordo Flammae
4c81937edc Added Radioactive Cloud object. 2019-11-27 19:35:49 -06:00
2597b558e6 Update slack link in play page 2019-11-08 10:10:17 -05:00
37 changed files with 476 additions and 587 deletions

18
.gitignore vendored
View File

@@ -1,18 +1,22 @@
.idea/
out/
data/
history
plugins/Plugin NPC.jar
plugins/Plugin Misc HW.jar
plugins/Plant.jar
plugins/Cubot.jar
.idea/*
mar.log
mar.log.lck
*.iml
*.class
*/target/*
plugins/*.jar
save.json
Server/Server.iml
target/*
META-INF/
Server/Server.iml
Server/src/main/java/META-INF/MANIFEST.MF
.settings
.project
.classpath
# VSCode Workspace
.vscode/
.vscode/

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Server" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:bson:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.8.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-template-velocity:2.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
</component>
</module>

View File

@@ -11,6 +11,7 @@ import net.simon987.server.assembly.Status;
import net.simon987.server.assembly.exception.CancelledException;
import net.simon987.server.event.GameEvent;
import net.simon987.server.game.item.Item;
import net.simon987.server.game.item.ItemVoid;
import net.simon987.server.game.objects.*;
import net.simon987.server.user.User;
import org.bson.Document;
@@ -200,7 +201,7 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Me
JSONObject json = super.jsonSerialise();
json.put("direction", getDirection().ordinal());
CubotInventory inv = (CubotInventory) getHardware(CubotInventory.class);
int heldItem = inv.getCurrentItem().getId();
int heldItem = inv.getInventory().getOrDefault(inv.getPosition(), new ItemVoid()).getId();
json.put("heldItem", heldItem);
json.put("hp", hp);
json.put("shield", shield);

View File

@@ -4,7 +4,6 @@ import net.simon987.server.GameServer;
import net.simon987.server.assembly.HardwareModule;
import net.simon987.server.assembly.Status;
import net.simon987.server.game.item.Item;
import net.simon987.server.game.item.ItemVoid;
import net.simon987.server.game.objects.ControllableUnit;
import org.bson.Document;
@@ -56,30 +55,11 @@ public class CubotInventory extends HardwareModule {
private void scanItem() {
int x = getCpu().getRegisterSet().getRegister("X").getValue();
Item item = inventory.get(position);
if (item == null) {
return;
}
item.digitize(unit.getCpu().getMemory(), x);
}
public Item getCurrentItem() {
return inventory.getOrDefault(position, new ItemVoid());
}
public Item removeItem() {
Item item = inventory.get(position);
if (item == null) {
return new ItemVoid();
}
inventory.remove(position);
return item;
}
public Item clearItem() {
Item item = inventory.get(position);
if (item == null) {
return new ItemVoid();
}
item.clear(unit);
inventory.remove(position);

View File

@@ -3,7 +3,6 @@ package net.simon987.cubotplugin;
import net.simon987.server.GameServer;
import net.simon987.server.assembly.HardwareModule;
import net.simon987.server.assembly.Status;
import net.simon987.server.game.item.Item;
import net.simon987.server.game.objects.*;
import org.bson.Document;
@@ -25,7 +24,7 @@ public class CubotLaser extends HardwareModule {
private static final int LASER_DAMAGE = 25;
public CubotLaser(Cubot unit) {
public CubotLaser(ControllableUnit unit) {
super(null, unit);
}
@@ -33,28 +32,26 @@ public class CubotLaser extends HardwareModule {
super(document, cubot);
}
private Cubot getCubot() {
return (Cubot) unit;
}
@Override
public char getId() {
return HWID;
}
@Override
//TODO: Refactor this method..
public void handleInterrupt(Status status) {
int a = getCpu().getRegisterSet().getRegister("A").getValue();
int b = getCpu().getRegisterSet().getRegister("B").getValue();
if (a == LASER_WITHDRAW) {
Point frontTile = unit.getFrontTile();
ArrayList<GameObject> objects = unit.getWorld().getGameObjectsBlockingAt(frontTile.x, frontTile.y);
if (unit.getCurrentAction() == Action.IDLE && objects.size() > 0) {
//FIXME: Problem here if more than 1 object
if (objects.get(0) instanceof InventoryHolder) {
if (((InventoryHolder) objects.get(0)).canTakeItem(b)) {
@@ -68,24 +65,9 @@ public class CubotLaser extends HardwareModule {
}
}
} else if (a == LASER_DEPOSIT) {
Point frontTile = unit.getFrontTile();
ArrayList<GameObject> objects = unit.getWorld().getGameObjectsBlockingAt(frontTile.x, frontTile.y);
CubotInventory inv = ((CubotInventory) getCubot().getHardware(CubotInventory.class));
Item item = inv.getCurrentItem();
if (unit.getCurrentAction() == Action.IDLE && objects.size() > 0) {
if (objects.get(0) instanceof InventoryHolder) {
if (((InventoryHolder) objects.get(0)).canPlaceItem(item.getId())) {
if (unit.spendEnergy(30)) {
//Place the item
((InventoryHolder) objects.get(0)).placeItem(inv.removeItem());
unit.setCurrentAction(Action.DEPOSITING);
}
}
}
}
// TODO
} else if (a == LASER_ATTACK) {
if (unit.getCurrentAction() == Action.IDLE) {
@@ -99,10 +81,12 @@ public class CubotLaser extends HardwareModule {
if (objects.size() > 0 && objects.get(0) instanceof Attackable && !(objects.get(0) instanceof Cubot)) {
((Attackable) objects.get(0)).damage(LASER_DAMAGE);
}
}
unit.setCurrentAction(Action.ATTACKING);
}
}
}
}

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Server" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:bson:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.8.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-template-velocity:2.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
</component>
</module>

58
Plugin NPC/Plugin NPC.iml Normal file
View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="module" module-name="Server" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:bson:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.8.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-template-velocity:2.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
</component>
</module>

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="module" module-name="Server" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-sync:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:bson:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.9.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-core:2.8.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-client:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.4.12.v20180830" level="project" />
<orderEntry type="library" name="Maven: com.sparkjava:spark-template-velocity:2.7.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.7.25" level="project" />
</component>
</module>

View File

@@ -69,11 +69,6 @@ public class BiomassBlob extends GameObject implements InventoryHolder {
return false;
}
@Override
public boolean canPlaceItem(int itemId) {
return false;
}
@Override
public boolean canTakeItem(int itemId) {
return itemId == ItemBiomass.ID && biomassCount >= 1;

View File

@@ -1,4 +1,32 @@
package net.simon987.pluginradioactivecloud;
public class RadioactiveCloud {
import net.simon987.server.GameServer;
import net.simon987.server.game.objects.ControllableUnit;
import net.simon987.server.game.objects.Enterable;
import net.simon987.server.game.objects.GameObject;
import net.simon987.server.game.objects.Radioactive;
public class RadioactiveCloud extends GameObject implements Radioactive, Enterable {
private final static int CORRUPTION_BLOCK_SIZE =
GameServer.INSTANCE.getConfig().getInt("radioactive_cloud_corruption_block_size");
/**
* Called when an object attempts to walk directly into a Enterable object
*
* @param object The game object that attempted to enter
* @return true if successful, false to block the object
*/
@Override
public boolean enter(GameObject object) {
if (object instanceof ControllableUnit) {
((ControllableUnit) object).getCpu().getMemory().corrupt(CORRUPTION_BLOCK_SIZE);
}
return true;
}
@Override
public char getMapInfo() {
return 0;
}
}

View File

@@ -1,10 +1,9 @@
### [Official website](https://muchassemblyrequired.com)
# Much-Assembly-Required
[![CodeFactor](https://www.codefactor.io/repository/github/simon987/much-assembly-required/badge)](https://www.codefactor.io/repository/github/simon987/much-assembly-required)
[![Build Status](https://ci.simon987.net/buildStatus/icon?job=Much-Assembly-Required)](https://ci.simon987.net/job/Much-Assembly-Required/)
Program the 8086-like microprocessor of a robot in a grid-based multiplayer world. The game is web based so no installation is required.
In its current state, players can walk around the game universe and collect Biomass blobs & Iron/copper ore using the online code editor.
**Much Assembly Required** allows you to program the 8086-like microprocessor of a robot in a grid-based multiplayer world. The game is web based so no installation is required. In its current state, players can walk around the game universe and collect Biomass blobs and Iron/copper ore using the online code editor.
![screenshot from 2017-11-12 13-01-43](https://user-images.githubusercontent.com/7120851/32701793-e5d07e98-c7a9-11e7-9931-f8db7b287994.png)
@@ -24,13 +23,14 @@ sudo apt install git maven openjdk-8-jdk mongodb
On Arch:
``` bash
sudo pacman -S git maven mongodb jdk8-opendjk
sudo pacman -S git maven jdk8-opendjk
yay -S mongodb-bin
# Don't forget to start mongodb
sudo systemctl start mongodb.service
```
*If needed, visit [troubleshooting mongodb](https://wiki.archlinux.org/index.php/MongoDB#Troubleshooting).*
*If needed, visit [yay installation](https://github.com/Jguer/yay#installation) and [troubleshooting mongodb](https://wiki.archlinux.org/index.php/MongoDB#Troubleshooting).*
**Deploying server**
@@ -51,12 +51,12 @@ java -jar server-1.4a.jar
Installation instructions:
1. Download the JDK from [here](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
Install the JDK and update your PATH and JAVA_HOME enviroment variables.
Install the JDK and update your PATH and JAVA_HOME environment variables.
2. Download Maven from [here](https://maven.apache.org/).
Install Maven (following the README) and update your PATH enviroment variable.
Install Maven (following the README) and update your PATH environment variable.
3. Download Mongo DB Community from [here](https://www.mongodb.com/download-center#community).
Install Mongo DB following the instructions [here](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/).
Update your PATH enviroment variable.
Update your PATH environment variable.
Building instructions:
```batch

View File

@@ -6,6 +6,7 @@
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
@@ -91,7 +92,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -113,7 +114,7 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.1.5.RELEASE</version>
<version>5.1.11.RELEASE</version>
</dependency>
<dependency>
<groupId>com.sparkjava</groupId>

View File

@@ -94,23 +94,6 @@ public class Memory implements Target, MongoSerializable {
return true;
}
/**
* Read count words from the memory
*
* @return null if out of bounds
*/
public char[] read(int offset, int count) {
if (offset + count > this.words.length || count < 0 || offset < 0) {
return null;
}
char[] chars = new char[count];
System.arraycopy(words, offset, chars, 0, count);
return chars;
}
/**
* Set the value at an address
*

View File

@@ -20,9 +20,4 @@ public interface InventoryHolder {
* @return true if the InventoryHolder can provide this item
*/
boolean canTakeItem(int itemId);
/**
* @return true if the InventoryHolder can receive this item
*/
boolean canPlaceItem(int itemId);
}

View File

@@ -32,7 +32,7 @@ public class ItemsContainer extends GameObject implements InventoryHolder {
@Override
public boolean placeItem(Item item) {
if (canPlaceItem(item.getId())) {
if (items.size() < containerCapacity) {
items.add(item);
return true;
} else {
@@ -40,11 +40,6 @@ public class ItemsContainer extends GameObject implements InventoryHolder {
}
}
@Override
public boolean canPlaceItem(int itemId) {
return (items.size() < containerCapacity);
}
@Override
public void takeItem(int itemId) {
Optional<Item> first = items.stream()

View File

@@ -67,10 +67,6 @@ public class World implements MongoSerializable {
return getGameObjectsBlockingAt(x, y).size() > 0 || tileMap.getTileAt(x, y).isBlocked();
}
public boolean canBuild(int x, int y) {
return x == 0 || y == 0 || x == worldSize-1 || y == worldSize-1;
}
/**
* Computes the world's unique id from its coordinates.
*

View File

@@ -12,7 +12,7 @@ server_name=MAR dev
# ALLOW | BLOCK
guest_policy=ALLOW
# DEBUG
autologin=simon
#autologin=simon
#Database
mongo_dbname=mar_beta
@@ -93,11 +93,9 @@ electric_box_damage=5
electric_box_energy_given=70
#RadioactiveObstacle
radioactive_obstacle_corruption_block_size=10
radioactive_cloud_corruption_block_size=40
#SecretKey
secret_key=<your_secret_key>
# Construction
construction_site_ttl=1024
obstacle_regen=1
obstacle_hp=150
construction_site_ttl=512

View File

@@ -11376,24 +11376,120 @@
"y": 0.5
}
},
"objects/obstacle": {
"objects/GOURD_PLANT": {
"frame": {
"x": 768,
"y": 1050,
"w": 128,
"h": 114
"w": 32,
"h": 32
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 128,
"h": 114
"w": 32,
"h": 32
},
"sourceSize": {
"w": 128,
"h": 114
"w": 32,
"h": 32
},
"pivot": {
"x": 0.5,
"y": 0.5
}
},
"objects/kiln": {
"frame": {
"x": 800,
"y": 1050,
"w": 116,
"h": 117
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 116,
"h": 117
},
"sourceSize": {
"w": 116,
"h": 117
},
"pivot": {
"x": 0.5,
"y": 0.5
}
},
"objects/kiln_s": {
"frame": {
"x": 916,
"y": 1050,
"w": 116,
"h": 117
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 116,
"h": 117
},
"sourceSize": {
"w": 116,
"h": 117
},
"pivot": {
"x": 0.5,
"y": 0.5
}
},
"objects/plant1": {
"frame": {
"x": 1032,
"y": 1050,
"w": 64,
"h": 64
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"sourceSize": {
"w": 64,
"h": 64
},
"pivot": {
"x": 0.5,
"y": 0.5
}
},
"objects/plant1_s": {
"frame": {
"x": 1096,
"y": 1050,
"w": 64,
"h": 64
},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"sourceSize": {
"w": 64,
"h": 64
},
"pivot": {
"x": 0.5,
@@ -11402,7 +11498,7 @@
},
"objects/portal": {
"frame": {
"x": 896,
"x": 1160,
"y": 1050,
"w": 128,
"h": 110
@@ -11426,7 +11522,7 @@
},
"objects/RadioTower": {
"frame": {
"x": 1024,
"x": 1288,
"y": 1050,
"w": 168,
"h": 237
@@ -11450,7 +11546,7 @@
},
"objects/rocket": {
"frame": {
"x": 1192,
"x": 1456,
"y": 1050,
"w": 135,
"h": 189
@@ -11474,7 +11570,7 @@
},
"objects/shieldBack": {
"frame": {
"x": 1327,
"x": 1591,
"y": 1050,
"w": 128,
"h": 70
@@ -11498,7 +11594,7 @@
},
"objects/shieldFront": {
"frame": {
"x": 1455,
"x": 1719,
"y": 1050,
"w": 128,
"h": 70
@@ -11522,7 +11618,7 @@
},
"objects/VaultDoor": {
"frame": {
"x": 1583,
"x": 1847,
"y": 1050,
"w": 213,
"h": 170
@@ -11546,7 +11642,7 @@
},
"objects/VaultDoor1": {
"frame": {
"x": 1796,
"x": 2060,
"y": 1050,
"w": 139,
"h": 150
@@ -11570,7 +11666,7 @@
},
"objects/VaultDoorCrop": {
"frame": {
"x": 1935,
"x": 2199,
"y": 1050,
"w": 137,
"h": 150
@@ -11594,7 +11690,7 @@
},
"objects/VaultDoorScreen/1": {
"frame": {
"x": 2072,
"x": 2336,
"y": 1050,
"w": 20,
"h": 18
@@ -11618,7 +11714,7 @@
},
"objects/VaultDoorScreen/2": {
"frame": {
"x": 2092,
"x": 2356,
"y": 1050,
"w": 20,
"h": 18
@@ -11642,7 +11738,7 @@
},
"objects/VaultDoorScreen/3": {
"frame": {
"x": 2112,
"x": 2376,
"y": 1050,
"w": 20,
"h": 18
@@ -11666,7 +11762,7 @@
},
"objects/VaultDoorScreen/4": {
"frame": {
"x": 2132,
"x": 2396,
"y": 1050,
"w": 20,
"h": 18
@@ -11690,7 +11786,7 @@
},
"objects/VaultDoorScreen/5": {
"frame": {
"x": 2152,
"x": 2416,
"y": 1050,
"w": 20,
"h": 18
@@ -11714,7 +11810,7 @@
},
"objects/VaultDoorScreen/6": {
"frame": {
"x": 2172,
"x": 2436,
"y": 1050,
"w": 20,
"h": 18
@@ -11738,7 +11834,7 @@
},
"tiles/bigTile": {
"frame": {
"x": 2192,
"x": 2456,
"y": 1050,
"w": 128,
"h": 140
@@ -11762,7 +11858,7 @@
},
"tiles/bigTile2": {
"frame": {
"x": 2320,
"x": 2584,
"y": 1050,
"w": 128,
"h": 153
@@ -11786,7 +11882,7 @@
},
"tiles/magneticTile": {
"frame": {
"x": 2448,
"x": 2712,
"y": 1050,
"w": 128,
"h": 114
@@ -11810,7 +11906,7 @@
},
"tiles/tile": {
"frame": {
"x": 2576,
"x": 2840,
"y": 1050,
"w": 128,
"h": 114
@@ -11834,7 +11930,7 @@
},
"ui/arrow_east": {
"frame": {
"x": 2704,
"x": 2968,
"y": 1050,
"w": 102,
"h": 51
@@ -11858,7 +11954,7 @@
},
"ui/arrow_east_s": {
"frame": {
"x": 2806,
"x": 3070,
"y": 1050,
"w": 102,
"h": 51
@@ -11882,7 +11978,7 @@
},
"ui/arrow_north": {
"frame": {
"x": 2908,
"x": 3172,
"y": 1050,
"w": 102,
"h": 51
@@ -11906,7 +12002,7 @@
},
"ui/arrow_north_s": {
"frame": {
"x": 3010,
"x": 3274,
"y": 1050,
"w": 102,
"h": 51
@@ -11930,7 +12026,7 @@
},
"ui/arrow_south": {
"frame": {
"x": 3112,
"x": 3376,
"y": 1050,
"w": 102,
"h": 51
@@ -11954,7 +12050,7 @@
},
"ui/arrow_south_s": {
"frame": {
"x": 3214,
"x": 3478,
"y": 1050,
"w": 102,
"h": 51
@@ -11978,7 +12074,7 @@
},
"ui/arrow_west": {
"frame": {
"x": 3316,
"x": 3580,
"y": 1050,
"w": 102,
"h": 51
@@ -12002,7 +12098,7 @@
},
"ui/arrow_west_s": {
"frame": {
"x": 3418,
"x": 3682,
"y": 1050,
"w": 102,
"h": 51
@@ -12026,7 +12122,7 @@
},
"ui/compass": {
"frame": {
"x": 3520,
"x": 3784,
"y": 1050,
"w": 162,
"h": 147
@@ -12059,6 +12155,6 @@
"h": 1287
},
"scale": "1",
"smartupdate": "$TexturePacker:SmartUpdate:cabd9bbebff623bfa01a63c764edf16e:8b226981e250398faa4378b63606c23e:1eabdf11f75e3a4fe3147baf7b5be24b$"
"smartupdate": "$TexturePacker:SmartUpdate:73c963294f55ee095af7f9f7c60b9d3d:93610d7ee804aa39ff18e2974a508abb:1eabdf11f75e3a4fe3147baf7b5be24b$"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 573 KiB

After

Width:  |  Height:  |  Size: 581 KiB

View File

@@ -1,10 +1,14 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
({__proto__: []} instanceof Array && function (d, b) {
d.__proto__ = b;
}) ||
function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
};
return extendStatics(d, b);
};
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
@@ -332,12 +336,6 @@ var config = {
},
world: {
defaultSize: 16
},
obstacle: {
tint: 0x0aced6,
},
constructionSite: {
tint: 0x0aced6,
}
};
var Util = (function () {
@@ -472,13 +470,13 @@ var Debug = (function () {
mar.client.sendDebugCommand({ t: "debug", command: "setEnergy", objectId: objectId, amount: amount });
};
Debug.saveGame = function () {
mar.client.sendDebugCommand({ t: "debug", command: "saveGame" });
mar.client.sendDebugCommand({t: "debug", command: "saveGame"});
};
Debug.popItem = function (objectId) {
mar.client.sendDebugCommand({ t: "debug", command: "popItem", objectId: objectId });
mar.client.sendDebugCommand({t: "debug", command: "popItem", objectId: objectId});
};
Debug.putItem = function (objectId, item) {
mar.client.sendDebugCommand({ t: "debug", command: "putItem", objectId: objectId, item: item });
mar.client.sendDebugCommand({t: "debug", command: "putItem", objectId: objectId, item: item});
};
Debug.setInventoryPosition = function (objectId, position) {
mar.client.sendDebugCommand({
@@ -584,11 +582,9 @@ var AuthListener = (function () {
console.log("[MAR] Auth successful");
}
mar.client.requestUserInfo();
}
else if (message.m == "forbidden") {
} else if (message.m == "forbidden") {
alert("Authentication failed. Guest accounts are blocked on this server");
}
else {
} else {
alert("Authentication failed. Please make sure you are logged in and reload the page.");
}
};
@@ -744,7 +740,9 @@ var GameClient = (function () {
if (DEBUG) {
console.log("[MAR] Received server info " + xhr.responseText);
}
setTimeout(function () { return self.connectToGameServer(JSON.parse(xhr.responseText)); }, 100);
setTimeout(function () {
return self.connectToGameServer(JSON.parse(xhr.responseText));
}, 100);
}
};
xhr.send(null);
@@ -832,11 +830,10 @@ var ObjectType;
ObjectType["FACTORY"] = "net.simon987.npcplugin.Factory";
ObjectType["RADIO_TOWER"] = "net.simon987.npcplugin.RadioTower";
ObjectType["VAULT_DOOR"] = "net.simon987.npcplugin.VaultDoor";
ObjectType["OBSTACLE"] = "net.simon987.constructionplugin.Obstacle";
ObjectType["OBSTACLE"] = "net.simon987.npcplugin.Obstacle";
ObjectType["ELECTRIC_BOX"] = "net.simon987.npcplugin.ElectricBox";
ObjectType["PORTAL"] = "net.simon987.npcplugin.Portal";
ObjectType["HACKED_NPC"] = "net.simon987.npcplugin.HackedNPC";
ObjectType["CONSTRUCTION_SITE"] = "net.simon987.constructionplugin.ConstructionSite";
})(ObjectType || (ObjectType = {}));
var ItemType;
(function (ItemType) {
@@ -875,15 +872,13 @@ var GameObject = (function (_super) {
case ObjectType.VAULT_DOOR:
return new VaultDoor(json);
case ObjectType.OBSTACLE:
return new Obstacle(json);
return null;
case ObjectType.ELECTRIC_BOX:
return new ElectricBox(json);
case ObjectType.PORTAL:
return new Portal(json);
case ObjectType.HACKED_NPC:
return new HackedNPC(json);
case ObjectType.CONSTRUCTION_SITE:
return new ConstructionSite(json);
default:
return null;
}
@@ -1222,8 +1217,7 @@ var HarvesterNPC = (function (_super) {
HarvesterNPC.prototype.getEnergy = function (json) {
if (json.hasOwnProperty("net.simon987.npcplugin.NpcBattery")) {
return json["net.simon987.npcplugin.NpcBattery"].energy;
}
else {
} else {
return 1000;
}
};
@@ -1293,7 +1287,7 @@ var BiomassBlob = (function (_super) {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({ isoZ: 15 }, 400, Phaser.Easing.Bounce.Out, true);
mar.game.add.tween(this.scale).to({ x: 1, y: 1 }, 200, Phaser.Easing.Linear.None, true);
this.tint = config.biomass.tint;
this.tint = config.biomass.tintHover;
this.text.visible = false;
};
BiomassBlob.prototype.updateObject = function (json) {
@@ -1452,79 +1446,6 @@ var ElectricBox = (function (_super) {
};
return ElectricBox;
}(GameObject));
var Obstacle = (function (_super) {
__extends(Obstacle, _super);
function Obstacle(json) {
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/obstacle") || this;
_this.anchor.set(0.5, 0.3);
_this.tint = config.obstacle.tint;
_this.setText("Obstacle");
_this.text.visible = false;
_this.id = json.i;
_this.tileX = json.x;
_this.tileY = json.y;
return _this;
}
Obstacle.prototype.updateObject = function (json) {
};
Obstacle.prototype.onTileHover = function () {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({ isoZ: 25 }, 200, Phaser.Easing.Quadratic.InOut, true);
mar.game.add.tween(this.scale).to({ x: 1.1, y: 1.1 }, 200, Phaser.Easing.Linear.None, true);
this.tint = config.cubot.hoverTint;
this.text.visible = true;
};
Obstacle.prototype.onTileExit = function () {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({ isoZ: 15 }, 400, Phaser.Easing.Bounce.Out, true);
mar.game.add.tween(this.scale).to({ x: 1, y: 1 }, 200, Phaser.Easing.Linear.None, true);
this.tint = config.obstacle.tint;
this.text.visible = false;
};
return Obstacle;
}(GameObject));
var ConstructionSite = (function (_super) {
__extends(ConstructionSite, _super);
function ConstructionSite(json) {
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", ConstructionSite.getTargetSprite(json.blueprint.target)) || this;
_this.anchor.set(0.5, 0.31);
_this.tint = config.constructionSite.tint;
_this.setText("Construction site");
_this.text.visible = false;
_this.setUpAlphaTween();
_this.id = json.i;
_this.tileX = json.x;
_this.tileY = json.y;
return _this;
}
ConstructionSite.getTargetSprite = function (targetType) {
switch (targetType) {
case ObjectType.OBSTACLE:
return "objects/obstacle";
}
};
ConstructionSite.prototype.updateObject = function (json) {
};
ConstructionSite.prototype.setUpAlphaTween = function () {
var alphaTween = mar.game.add.tween(this).to({ alpha: 0.5 }, 2000, Phaser.Easing.Linear.None, true, 0, -1);
alphaTween.yoyo(true, 3000);
};
ConstructionSite.prototype.onTileHover = function () {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({ isoZ: 19 }, 200, Phaser.Easing.Quadratic.InOut, true);
mar.game.add.tween(this.scale).to({ x: 1.03, y: 1.03 }, 200, Phaser.Easing.Linear.None, true);
this.setUpAlphaTween();
this.text.visible = true;
};
ConstructionSite.prototype.onTileExit = function () {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({ isoZ: 15 }, 400, Phaser.Easing.Bounce.Out, true);
mar.game.add.tween(this.scale).to({ x: 1.03, y: 1.03 }, 200, Phaser.Easing.Linear.None, true);
this.setUpAlphaTween();
this.text.visible = false;
};
return ConstructionSite;
}(GameObject));
var Portal = (function (_super) {
__extends(Portal, _super);
function Portal(json) {
@@ -1722,7 +1643,7 @@ var MagneticTile = (function (_super) {
return _this;
}
MagneticTile.prototype.onHover = function () {
mar.game.add.tween(this).to({ isoZ: this.baseZ + 30 }, 200, Phaser.Easing.Quadratic.InOut, true);
mar.game.add.tween(this).to({isoZ: this.baseZ + 30}, 200, Phaser.Easing.Quadratic.InOut, true);
mar.tileIndicator.tileX = this.tileX;
mar.tileIndicator.tileY = this.tileY;
mar.tileIndicator.tileType = this.tileType;

View File

@@ -1,5 +1,5 @@
<div class="container">
<span class="text-muted">©2019 Simon Fortier</span>
<span class="text-muted">©2020 simon987</span>
</div>
<script src="js/popper.min.js"></script>

View File

@@ -32,10 +32,10 @@
</li>
<li class="nav-item">
<a class="nav-link regular-screen" target="_blank"
href="https://join.slack.com/t/muchassemblyrequired/shared_invite/enQtMjY3Mjc1OTUwNjEwLTkyOTIwOTA5OGY4MDVlMGI4NzM5YzlhMWJiMGY1OWE2NjUxODQ1NWQ1YTcxMTA1NGZkYzNjYzMyM2E1ODdmNzg"><i
href="https://join.slack.com/t/muchassemblyrequired/shared_invite/enQtMjY3Mjc1OTUwNjEwLWRjMjRkZTg2N2EyNWRjN2YyMDc0YzIyMTUyYzFiNTBmMTU3OGQ1ZjA0MWY0M2IyYjUxZTA4NjRkMWVkNDk2NzY"><i
class="mi">chat</i> Slack</a>
<a class="nav-link small-screen" target="_blank"
href="https://join.slack.com/t/muchassemblyrequired/shared_invite/enQtMjY3Mjc1OTUwNjEwLTkyOTIwOTA5OGY4MDVlMGI4NzM5YzlhMWJiMGY1OWE2NjUxODQ1NWQ1YTcxMTA1NGZkYzNjYzMyM2E1ODdmNzg"><i
href="https://join.slack.com/t/muchassemblyrequired/shared_invite/enQtMjY3Mjc1OTUwNjEwLWRjMjRkZTg2N2EyNWRjN2YyMDc0YzIyMTUyYzFiNTBmMTU3OGQ1ZjA0MWY0M2IyYjUxZTA4NjRkMWVkNDk2NzY"><i
class="mi">chat</i></a>
</li>
<li class="nav-item">

View File

@@ -84,7 +84,7 @@ class TickListener implements MessageListener {
}
//Update console screen
if (message.c != undefined) {
if (message.console_message_buffer != undefined) {
mar.client.consoleScreen.handleConsoleBufferUpdate(
message.console_message_buffer,
message.console_mode as ConsoleMode);

View File

@@ -5,11 +5,10 @@ enum ObjectType {
FACTORY = "net.simon987.npcplugin.Factory",
RADIO_TOWER = "net.simon987.npcplugin.RadioTower",
VAULT_DOOR = "net.simon987.npcplugin.VaultDoor",
OBSTACLE = "net.simon987.constructionplugin.Obstacle",
OBSTACLE = "net.simon987.npcplugin.Obstacle",
ELECTRIC_BOX = "net.simon987.npcplugin.ElectricBox",
PORTAL = "net.simon987.npcplugin.Portal",
HACKED_NPC = "net.simon987.npcplugin.HackedNPC",
CONSTRUCTION_SITE = "net.simon987.constructionplugin.ConstructionSite"
HACKED_NPC = "net.simon987.npcplugin.HackedNPC"
}
enum ItemType {
@@ -72,15 +71,13 @@ abstract class GameObject extends Phaser.Plugin.Isometric.IsoSprite {
case ObjectType.VAULT_DOOR:
return new VaultDoor(json);
case ObjectType.OBSTACLE:
return new Obstacle(json);
return null;
case ObjectType.ELECTRIC_BOX:
return new ElectricBox(json);
case ObjectType.PORTAL:
return new Portal(json);
case ObjectType.HACKED_NPC:
return new HackedNPC(json);
case ObjectType.CONSTRUCTION_SITE:
return new ConstructionSite(json);
default:
return null;
@@ -625,7 +622,7 @@ class BiomassBlob extends GameObject {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
this.tint = config.biomass.tint;
this.tint = config.biomass.tintHover;
this.text.visible = false;
}
@@ -851,97 +848,6 @@ class ElectricBox extends GameObject {
}
}
class Obstacle extends GameObject {
constructor(json) {
super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/obstacle");
this.anchor.set(0.5, 0.3);
this.tint = config.obstacle.tint;
this.setText("Obstacle");
this.text.visible = false;
this.id = json.i;
this.tileX = json.x;
this.tileY = json.y;
}
updateObject(json): void {
//noop
}
public onTileHover() {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
mar.game.add.tween(this.scale).to({x: 1.1, y: 1.1}, 200, Phaser.Easing.Linear.None, true);
this.tint = config.cubot.hoverTint;
this.text.visible = true;
}
public onTileExit() {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
this.tint = config.obstacle.tint;
this.text.visible = false;
}
}
class ConstructionSite extends GameObject {
private static getTargetSprite(targetType: string): string {
switch (targetType) {
case ObjectType.OBSTACLE:
return "objects/obstacle";
}
}
constructor(json) {
super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", ConstructionSite.getTargetSprite(json.blueprint.target));
this.anchor.set(0.5, 0.31);
this.tint = config.constructionSite.tint;
this.setText("Construction site");
this.text.visible = false;
this.setUpAlphaTween();
this.id = json.i;
this.tileX = json.x;
this.tileY = json.y;
}
updateObject(json): void {
//noop
}
private setUpAlphaTween() {
let alphaTween = mar.game.add.tween(this).to({alpha: 0.5},
2000, Phaser.Easing.Linear.None, true, 0, -1);
alphaTween.yoyo(true, 3000);
}
public onTileHover() {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({isoZ: 19}, 200, Phaser.Easing.Quadratic.InOut, true);
mar.game.add.tween(this.scale).to({x: 1.03, y: 1.03}, 200, Phaser.Easing.Linear.None, true);
this.setUpAlphaTween();
this.text.visible = true;
}
public onTileExit() {
mar.game.tweens.removeFrom(this);
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
mar.game.add.tween(this.scale).to({x: 1.03, y: 1.03}, 200, Phaser.Easing.Linear.None, true);
this.setUpAlphaTween();
this.text.visible = false;
}
}
class Portal extends GameObject {
public onTileHover() {

View File

@@ -78,12 +78,6 @@ let config = {
},
world: {
defaultSize: 16 //Will fallback to this when server does not provide world width
},
obstacle: {
tint: 0x0aced6, //todo
},
constructionSite: {
tint: 0x0aced6, //todo
}
};

View File

@@ -19,9 +19,9 @@ services:
- ./data/db:/data/db
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null --port 27017
command: mongod --logpath=/dev/null --port 27017
healthcheck:
test: echo 'db.stats().ok' | mongo localhost:27017/mar --quiet
interval: 2s
timeout: 2s
retries: 2
retries: 2

33
jenkins/Jenkinsfile vendored
View File

@@ -1,33 +0,0 @@
def remote = [:]
remote.name = 'remote'
remote.host = env.DEPLOY_HOST
remote.user = env.DEPLOY_USER
remote.identityFile = '/var/lib/jenkins/.ssh/id_rsa'
remote.knownHosts = '/var/lib/jenkins/.ssh/known_hosts'
remote.allowAnyHosts = true
remote.retryCount = 3
remote.retryWaitSec = 3
logLevel = 'FINER'
remote.port = 2299
pipeline {
agent any
stages {
stage('Build') {
steps {
sh './jenkins/build.sh'
//stash includes: 'target/', name: 'target'
}
}
stage('Deploy') {
steps {
//unstash 'target'
sshCommand remote: remote, command: 'rm -rf mar/target mar/deploy.sh'
sshPut remote: remote, from: 'target', into: 'mar'
sshPut remote: remote, from: 'jenkins/deploy.sh', into: 'mar/deploy.sh'
sshCommand remote: remote, command: 'chmod +x mar/deploy.sh && ./mar/deploy.sh'
}
}
}
}

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env bash
mvn package

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env bash
export MARROOT="mar"
screen -S mar -X quit
echo "Starting MAR"
cp ${MARROOT}/marConfig.properties ${MARROOT}/target/config.properties
cp -r ${MARROOT}/marCerts/ ${MARROOT}/target/certificates
screen -S mar -d -m bash -c "cd ${MARROOT}/target && java -jar server-*.jar"
sleep 1
screen -list

View File

@@ -24,25 +24,17 @@ public abstract class BluePrint implements InventoryHolder, JSONSerializable, Mo
*/
protected Class<? extends GameObject> targetObject;
static final int DATA_LENGTH = 1024;
/**
* Set to true when all the requirements are met
*/
private boolean completed;
BluePrint() {
public BluePrint() {
requiredItems = new HashMap<>();
}
public BluePrint(Document document) {
Map<String, Integer> bsonCompatibleRequiredItems = (Map<String, Integer>) document.get("required_items");
requiredItems = new HashMap<>(bsonCompatibleRequiredItems.size());
for (String key : bsonCompatibleRequiredItems.keySet()) {
requiredItems.put(Integer.valueOf(key), bsonCompatibleRequiredItems.get(key));
}
requiredItems = (Map<Integer, Integer>) document.get("required_items");
completed = document.getBoolean("completed");
try {
targetObject = Class.forName(document.getString("target")).asSubclass(GameObject.class);
@@ -65,7 +57,7 @@ public abstract class BluePrint implements InventoryHolder, JSONSerializable, Mo
@Override
public boolean placeItem(Item item) {
if (canPlaceItem(item.getId())) {
if (requiredItems.containsKey(item.getId()) && requiredItems.get(item.getId()) > 0) {
requiredItems.put(item.getId(), requiredItems.get(item.getId()) - 1);
checkCompleted();
return true;
@@ -73,11 +65,6 @@ public abstract class BluePrint implements InventoryHolder, JSONSerializable, Mo
return false;
}
@Override
public boolean canPlaceItem(int itemId) {
return requiredItems.containsKey(itemId) && requiredItems.get(itemId) > 0;
}
@Override
public void takeItem(int itemId) {
@@ -105,7 +92,7 @@ public abstract class BluePrint implements InventoryHolder, JSONSerializable, Mo
public JSONObject jsonSerialise() {
JSONObject json = new JSONObject();
json.put("target", targetObject.getName());
json.put("target", targetObject);
json.put("required_items", requiredItems);
return json;
@@ -116,15 +103,8 @@ public abstract class BluePrint implements InventoryHolder, JSONSerializable, Mo
Document document = new Document();
document.put("completed", completed);
document.put("target", targetObject.getName());
document.put("type", this.getClass().getName());
Map<String, Integer> bsonCompatibleRequiredItems = new HashMap<>();
for (Integer key : requiredItems.keySet()) {
bsonCompatibleRequiredItems.put(String.valueOf(key), requiredItems.get(key));
}
document.put("required_items", bsonCompatibleRequiredItems);
document.put("target", targetObject);
document.put("required_items", requiredItems);
return document;
}

View File

@@ -9,7 +9,7 @@ import java.util.Map;
public class BluePrintRegistry {
static final BluePrintRegistry INSTANCE = new BluePrintRegistry();
public static final BluePrintRegistry INSTANCE = new BluePrintRegistry();
private Map<String, Class<? extends BluePrint>> blueprints;
private Map<String, String> digitizedBlueprints;
@@ -19,13 +19,13 @@ public class BluePrintRegistry {
digitizedBlueprints = new HashMap<>();
}
void registerBluePrint(Class<? extends BluePrint> clazz) {
public void registerBluePrint(Class<? extends BluePrint> clazz) {
blueprints.put(clazz.getCanonicalName(), clazz);
String bpData = new String(BluePrintUtil.bluePrintData(clazz));
digitizedBlueprints.put(bpData, clazz.getCanonicalName());
}
BluePrint deserializeBlueprint(Document document) {
public BluePrint deserializeBlueprint(Document document) {
String type = document.getString("type");
@@ -48,7 +48,7 @@ public class BluePrintRegistry {
}
}
BluePrint deserializeBluePrint(char[] chars) {
public BluePrint deserializeBluePrint(char[] chars) {
String bpData = new String(chars);

View File

@@ -52,7 +52,7 @@ class BluePrintUtil {
char[] result = new char[ARBITRARY_STRING.length * 32];
for (int i = ARBITRARY_STRING.length - 1; i >= 0; --i) {
for (int i = ARBITRARY_STRING.length - 1; i > 0; --i) {
char[] hashedBlueprint = hashMessage(ARBITRARY_STRING[i] + blueprint.getName());
if (hashedBlueprint != null) {
System.arraycopy(hashedBlueprint, 0, result,

View File

@@ -1,87 +0,0 @@
package net.simon987.constructionplugin;
import net.simon987.server.assembly.HardwareModule;
import net.simon987.server.assembly.Register;
import net.simon987.server.assembly.Status;
import net.simon987.server.game.objects.ControllableUnit;
import net.simon987.server.game.objects.GameObject;
import org.bson.Document;
import org.bson.types.ObjectId;
import java.awt.*;
public class ConstructionArmHardware extends HardwareModule {
public static final char HWID = 0x0010;
public static final int DEFAULT_ADDRESS = 0x0010;
private static final int OK = 0;
private static final int ERR_TILE_BLOCKED = 1;
private static final int ERR_NOT_ENOUGH_ENERGY = 2;
private static final int ERR_MEM_READ = 3;
private static final int ERR_INVALID_BLUEPRINT = 4;
private static final int PLACE_CONSTRUCTION_SITE = 1;
private static final int PLACE_CONSTRUCTION_SITE_COST = 10;
public ConstructionArmHardware(ControllableUnit unit) {
super(null, unit);
}
public ConstructionArmHardware(Document document, ControllableUnit unit) {
super(document, unit);
}
@Override
public void handleInterrupt(Status status) {
int a = getCpu().getRegisterSet().getRegister("A").getValue();
int x = getCpu().getRegisterSet().getRegister("X").getValue();
Register regB = getCpu().getRegisterSet().getRegister("B");
if (a == PLACE_CONSTRUCTION_SITE) {
char[] bluePrintData = getCpu().getMemory().read(x, BluePrint.DATA_LENGTH);
if (bluePrintData == null) {
regB.setValue(ERR_MEM_READ);
return;
}
BluePrint bluePrint = BluePrintRegistry.INSTANCE.deserializeBluePrint(bluePrintData);
if (bluePrint == null) {
regB.setValue(ERR_INVALID_BLUEPRINT);
return;
}
Point frontTile = unit.getFrontTile();
if (unit.getWorld().isTileBlocked(frontTile.x, frontTile.y) ||
unit.getWorld().canBuild(frontTile.x, frontTile.y)) {
regB.setValue(ERR_TILE_BLOCKED);
return;
}
if (!unit.spendEnergy(PLACE_CONSTRUCTION_SITE_COST)) {
regB.setValue(ERR_NOT_ENOUGH_ENERGY);
return;
}
GameObject constructionSite = new ConstructionSite(bluePrint);
constructionSite.setObjectId(new ObjectId());
constructionSite.setWorld(unit.getWorld());
constructionSite.setX(frontTile.x);
constructionSite.setY(frontTile.y);
unit.getWorld().addObject(constructionSite);
regB.setValue(OK);
}
}
@Override
public char getId() {
return HWID;
}
}

View File

@@ -1,6 +1,5 @@
package net.simon987.constructionplugin;
import net.simon987.constructionplugin.event.CpuInitialisationListener;
import net.simon987.server.GameServer;
import net.simon987.server.game.objects.GameRegistry;
import net.simon987.server.logging.LogManager;
@@ -18,12 +17,8 @@ public class ConstructionPlugin extends ServerPlugin {
gameRegistry.registerGameObject(Obstacle.class);
gameRegistry.registerGameObject(ConstructionSite.class);
gameRegistry.registerHardware(ConstructionArmHardware.class);
BluePrintRegistry.INSTANCE.registerBluePrint(ObstacleBlueprint.class);
listeners.add(new CpuInitialisationListener());
LogManager.LOGGER.info("(Construction Plugin) Initialized construction plugin");
}
}

View File

@@ -2,14 +2,12 @@ package net.simon987.constructionplugin;
import net.simon987.server.GameServer;
import net.simon987.server.game.item.Item;
import net.simon987.server.game.objects.*;
import net.simon987.server.game.world.World;
import net.simon987.server.game.objects.InventoryHolder;
import net.simon987.server.game.objects.Structure;
import net.simon987.server.game.objects.Updatable;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.json.simple.JSONObject;
import java.lang.reflect.InvocationTargetException;
public class ConstructionSite extends Structure implements Updatable, InventoryHolder {
public static final int MAP_INFO = 0xFFFF; //TODO: determine
@@ -49,36 +47,7 @@ public class ConstructionSite extends Structure implements Updatable, InventoryH
@Override
public boolean placeItem(Item item) {
boolean ok = bluePrint.placeItem(item);
if (ok && bluePrint.isCompleted()) {
instantiateTargetObject();
setDead(true);
}
return ok;
}
private void instantiateTargetObject() {
Class<? extends GameObject> targetClass = bluePrint.getTargetObject();
try {
GameObject targetObj = targetClass.getConstructor().newInstance();
targetObj.setWorld(getWorld());
targetObj.setObjectId(new ObjectId());
targetObj.setX(getX());
targetObj.setY(getY());
getWorld().addObject(targetObj);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace();
}
}
@Override
public boolean canPlaceItem(int itemId) {
return bluePrint.canPlaceItem(itemId);
return bluePrint.placeItem(item);
}
@Override

View File

@@ -18,15 +18,13 @@ public class Obstacle extends Structure implements Attackable, Updatable {
public Obstacle() {
super(1, 1);
setHp(MAX_HP);
}
public Obstacle(Document document) {
super(document, 1, 1);
hp = document.getInteger("hp");
color = document.getInteger("color");
hp = document.getInteger(hp);
color = document.getInteger(color);
}
@Override

View File

@@ -1,27 +0,0 @@
package net.simon987.constructionplugin.event;
import net.simon987.constructionplugin.ConstructionArmHardware;
import net.simon987.server.assembly.CPU;
import net.simon987.server.event.CpuInitialisationEvent;
import net.simon987.server.event.GameEvent;
import net.simon987.server.event.GameEventListener;
import net.simon987.server.game.objects.ControllableUnit;
public class CpuInitialisationListener implements GameEventListener {
@Override
public Class getListenedEventType() {
return CpuInitialisationEvent.class;
}
@Override
public void handle(GameEvent event) {
CPU cpu = (CPU) event.getSource();
ControllableUnit unit = ((CpuInitialisationEvent) event).getUnit();
ConstructionArmHardware constructionArmHardware = new ConstructionArmHardware(unit);
constructionArmHardware.setCpu(cpu);
unit.attachHardware(constructionArmHardware, ConstructionArmHardware.DEFAULT_ADDRESS);
}
}