Project Zomboid

Project Zomboid

Survivors! (Build 39)
MNXR 24 Jan, 2017 @ 7:57am
Mac / OS
This Mod is awesome for a single player like myself and loaded fine with all my mods on Mac. The problem is the fix for the AI mirroring my keystrokes onces they get in view. The current fix is PC only so I really really really can't wait (hope) for a fix for Mac!



Super Mod otherwise! :steamhappy::steamhappy::steamhappy:
< >
Showing 1-15 of 24 comments
nolanritchie  [developer] 25 Jan, 2017 @ 11:57am 
bug TIS to add my java function to the game. and then this mod wont need any pasting fix
MNXR 26 Jan, 2017 @ 5:29am 
Someone had mentioned there was a fix in the 128+ pages of comments - I coulnt find it but if anyone does bump it in here please :D



Celadian 20 Feb, 2017 @ 6:08am 
He just says send him a friend request to fix it. I did but no response. Dug through 30 pages of comments looking for an answer. Will keep you updated

Last edited by Celadian; 20 Feb, 2017 @ 6:10am
Celadian 20 Feb, 2017 @ 6:13am 
I'm going to start breaking into the jar files. Already picked through every mod file. Maybe it's a quick fix
nolanritchie  [developer] 20 Feb, 2017 @ 6:16am 
i think the problem is that i compile the recipe java files on my WINDOWS after i add the function i need to it. so you will have to figure out how to decompile the java files to view them, then add a function and recompile without issue.
[TFS] Lewshizz 20 Feb, 2017 @ 11:03pm 
You've got more functionality out of it than me for Mac, I crash whenever a survivor spawns.
[TFS] Lewshizz 24 Feb, 2017 @ 12:12am 
If anyone cracks the code for mac compatablity let me know, I'll be doing the same
Ether9 2 Mar, 2017 @ 7:38am 
I've been trying, but have no experience with java whatsoever. Hopefully someone fixes it soon. I was doing some research and saw that .class files compiled in windows are cross-platform. So idk..
Celadian 11 Mar, 2017 @ 4:08am 
Alright here's what I got so far.
See comments following
Celadian 11 Mar, 2017 @ 4:09am 
Recipe.class

package zombie.scripting.objects;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import zombie.characters.IsoPlayer;
import zombie.characters.skills.PerkFactory;
import zombie.characters.skills.PerkFactory.Perk;
import zombie.characters.skills.PerkFactory.Perks;
import zombie.core.Translator;
import zombie.input.JoypadManager;
import zombie.inventory.InventoryItem;


















































































public class Recipe
extends BaseScriptObject
{
private boolean canBeDoneFromFloor = false;
public float TimeToMake;
public String Sound;
public ArrayList<Recipe.Source> Source;
public Recipe.Result Result;
public String LuaTest;
public String LuaCreate;
public String LuaGrab;
public String name;
private String originalname;
private String nearItem;

public boolean isCanBeDoneFromFloor()
{
return canBeDoneFromFloor;
}

public void setCanBeDoneFromFloor(boolean paramBoolean)
{
canBeDoneFromFloor = paramBoolean;
}

public Recipe()
{
TimeToMake = 0.0F;
Source = new ArrayList();
Result = null;
LuaTest = null;
LuaCreate = null;
LuaGrab = null;
name = "recipe";
setOriginalname("recipe");
}

public int FindIndexOf(InventoryItem paramInventoryItem)
{
return -1;
}

public ArrayList<Recipe.Source> getSource()
{
return Source;
}

public static void SetPlayerIndex(IsoPlayer paramIsoPlayer, int paramInt) {
PlayerIndex = paramInt;
JoypadBind = paramInt;
zombie.GameWindow.ActivatedJoyPad = JoypadManager.instance.addJoypad(paramInt, username);
IsoPlayer.players[paramInt] = paramIsoPlayer;
}

public int getNumberOfNeededItem()
{
int i = 0;
for (int j = 0; j < getSource().size(); j++)
{
Recipe.Source localSource = (Recipe.Source)getSource().get(j);
if (!localSource.getItems().isEmpty()) {
i = (int)(i + localSource.getCount());
}
}
return i;
}

public float getTimeToMake()
{
return TimeToMake;
}

public String getName()
{
return name;
}

public void Load(String paramString, String[] paramArrayOfString)
{
name = Translator.getRecipeName(paramString);
originalname = paramString;
boolean bool = false;
for (int i = 0; i < paramArrayOfString.length; i++) {
if (!paramArrayOfString.trim().isEmpty()) {
if (paramArrayOfString.contains(":"))
{
String[] arrayOfString1 = paramArrayOfString.split(":");
String str1 = arrayOfString1[0].trim();
String str2 = arrayOfString1[1].trim();
if (str1.equals("Override"))
{
bool = str2.trim().equalsIgnoreCase("true");
if (bool) {
break;
}
}
if (str1.equals("Time")) {
TimeToMake = Float.parseFloat(str2);
}
if (str1.equals("Sound")) {
Sound = str2.trim();
}
if (str1.equals("Result")) {
DoResult(str2);
}
if (str1.equals("OnTest")) {
LuaTest = str2;
}
if (str1.equals("OnCreate")) {
LuaCreate = str2;
}
if (str1.equals("OnGrab")) {
LuaGrab = str2;
}
if (str1.toLowerCase().equals("needtobelearn")) {
setNeedToBeLearn(str2.trim().equalsIgnoreCase("true"));
}
if (str1.toLowerCase().equals("category")) {
setCategory(str2.trim());
}
if (str1.equals("CanBeDoneFromFloor")) {
setCanBeDoneFromFloor(str2.trim().equalsIgnoreCase("true"));
}
if (str1.equals("NearItem")) {
setNearItem(str2.trim());
}
if (str1.equals("SkillRequired"))
{
skillRequired = new HashMap();
String[] arrayOfString2 = str2.split(";");
for (int j = 0; j < arrayOfString2.length; j++)
{
String[] arrayOfString3 = arrayOfString2[j].split("=");
skillRequired.put(arrayOfString3[0], Integer.valueOf(Integer.parseInt(arrayOfString3[1])));
}
}
if (str1.equals("OnGiveXP")) {
LuaGiveXP = str2;
}
if ((str1.equals("Obsolete")) && (str2.trim().toLowerCase().equals("true")))
{
module.RecipeMap.remove(this);
}
}
else
{
DoSource(paramArrayOfString.trim());
}
}
}
if (bool)
{
Recipe localRecipe = module.getRecipe(paramString);
if (localRecipe != null) {
module.RecipeMap.remove(localRecipe);
}
}
}

private void DoSource(String paramString)
{
Recipe.Source localSource = new Recipe.Source(this);
if (paramString.contains("="))
{
count = new Float(paramString.split("=")[1].trim()).floatValue();
paramString = paramString.split("=")[0].trim();
}
if (paramString.indexOf("keep") == 0)
{
paramString = paramString.replace("keep ", "");
keep = true;
}
if (paramString.contains(";"))
{
String[] arrayOfString = paramString.split(";");
paramString = arrayOfString[0];
use = Float.parseFloat(arrayOfString[1]);
}
if (paramString.indexOf("destroy") == 0)
{
paramString = paramString.replace("destroy ", "");
destroy = true;
}
if (paramString.equals("null"))
{
localSource.getItems().clear();
}
else if (paramString.contains("/"))
{
paramString = paramString.replaceFirst("keep ", "").trim();
localSource.getItems().addAll(Arrays.asList(paramString.split("/")));
}
else
{
localSource.getItems().add(paramString);
}
if (!paramString.isEmpty()) {
Source.add(localSource);
}
}

private void DoResult(String paramString)
{
Recipe.Result localResult = new Recipe.Result(this);
String[] arrayOfString; if (paramString.contains("="))
{
arrayOfString = paramString.split("=");

paramString = arrayOfString[0].trim();
count = Integer.parseInt(arrayOfString[1].trim());
}
if (paramString.contains(";"))
{
arrayOfString = paramString.split(";");

paramString = arrayOfString[0].trim();
drainableCount = Integer.parseInt(arrayOfString[1].trim());
}
if (paramString.contains("."))
{
type = paramString.split("\\.")[1];
module = paramString.split("\\.")[0];
}
else
{
type = paramString;
}
Result = localResult;
}

public Recipe.Result getResult()
{
return Result;
}

public String getSound()
{
return Sound;
}

public String getOriginalname()
{
return originalname;
}

public void setOriginalname(String paramString)
{
originalname = paramString;
}

public boolean needToBeLearn()
{
return needToBeLearn;
}

public void setNeedToBeLearn(boolean paramBoolean)
{
needToBeLearn = paramBoolean;
}

public String getCategory()
{
return category;
}

public void setCategory(String paramString)
{
category = paramString;
}

public ArrayList<String> getRequiredSkills()
{
ArrayList localArrayList = null;
if (skillRequired != null)
{
localArrayList = new ArrayList();
Iterator localIterator = skillRequired.keySet().iterator();
while (localIterator.hasNext())
{
String str1 = (String)localIterator.next();
String str2 = getPerkFromStringname + " ";
str2 = str2 + skillRequired.get(str1);
localArrayList.add(str2);
}
}
return localArrayList;
}

public Recipe.Source findSource(String paramString)
{
for (int i = 0; i < Source.size(); i++)
{
Recipe.Source localSource = (Recipe.Source)Source.get(i);
for (int j = 0; j < localSource.getItems().size(); j++) {
if (((String)localSource.getItems().get(j)).equals(paramString)) {
return localSource;
}
}
}
return null;
}

public boolean isDestroy(String paramString)
{
Recipe.Source localSource = findSource(paramString);
if (localSource != null) {
return localSource.isDestroy();
}
throw new RuntimeException("recipe " + getOriginalname() + " doesn't use item " + paramString);
}

public boolean isKeep(String paramString)
{
Recipe.Source localSource = findSource(paramString);
if (localSource != null) {
return localSource.isKeep();
}
throw new RuntimeException("recipe " + getOriginalname() + " doesn't use item " + paramString);
}

public int getWaterAmountNeeded()
{
Recipe.Source localSource = findSource("Water");
if (localSource != null) {
return (int)localSource.getCount();
}
return 0;
}

public String getNearItem()
{
return nearItem;
}

public void setNearItem(String paramString)
{
nearItem = paramString;
}

public Map<String, Integer> skillRequired = null;
public String LuaGiveXP;
private boolean needToBeLearn = false;
private String category = null;
}

Celadian 11 Mar, 2017 @ 4:09am 
Recipe$Result.class

package zombie.scripting.objects;

import zombie.scripting.objects.Recipe;

public class Recipe.Result {
public String type;
public int count;
public int drainableCount;
public String module;

public Recipe.Result() {
this.count = 1;
this.drainableCount = 0;
this.module = null;
}

public String getType() {
return this.type;
}

public int getCount() {
return this.count;
}

public String getModule() {
return this.module;
}

public String getFullType() {
return this.module + "." + this.type;
}

public int getDrainableCount() {
return this.drainableCount;
}
}
Celadian 11 Mar, 2017 @ 4:10am 
Recipe$Source.class

package zombie.scripting.objects;

import java.util.ArrayList;
import zombie.scripting.objects.Recipe;

public class Recipe.Source {
public boolean keep;
private ArrayList<String> items;
public boolean destroy;
public float count;
public float use;

public Recipe.Source() {
this.keep = false;
this.items = new ArrayList();
this.destroy = false;
this.count = 1.0f;
this.use = 0.0f;
}

public boolean isDestroy() {
return this.destroy;
}

public boolean isKeep() {
return this.keep;
}

public float getCount() {
return this.count;
}

public float getUse() {
return this.use;
}

public ArrayList<String> getItems() {
return this.items;
}

public String getOnlyItem() {
if (this.items.size() != 1) {
throw new RuntimeException("items.size() == " + this.items.size());
}
return this.items.get(0);
}
}
Celadian 11 Mar, 2017 @ 4:11am 
Going to try to re-compile with mac through my own IDE. Should that work I'll share the files. My guess however is that some code will need to be changed. Any heads on this will help! Let's get survivors for mac!
Celadian 11 Mar, 2017 @ 4:13am 
He mentioned the isoPlayer was the cause of the characters following your keystrokes so maybe it's in the code involving isoPlayer
Celadian 11 Mar, 2017 @ 4:16am 
also found this guy out while researching. I'm going to test it to. Makes sense. "EDIT: Use controller if you dont want your NPCs to aim at the same place as you. (Thanks to davisilva26)" worth an investigation
< >
Showing 1-15 of 24 comments
Per page: 1530 50