Skip to content

Commit

Permalink
BETA-1.5_r10
Browse files Browse the repository at this point in the history
OK    Tweek thermal resistance values
OK    Fix battery heating
OK    Fix turbine "over" heating at map reload
OK    Add a pulse signal button bloc
OK    Fix wireless signal throug block attenuation
OK    Fix sixnode destruction bug
OK    Redo wireless system. Now repeater retransmit all channel, and RX can aggregate multiple transmeter source !
OK    Aggregaton are Biggest,Smallest,Toogle (for lamp controle it's useful)
OK    Wireless button
OK    wireless tutorial
OK    Tutorial plate model integration
  • Loading branch information
Dolu1990 committed Jul 9, 2014
1 parent 3e59119 commit 7e5c365
Show file tree
Hide file tree
Showing 31 changed files with 661 additions and 195 deletions.
33 changes: 27 additions & 6 deletions mods/eln/Eln.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
import mods.eln.sixnode.electricaldatalogger.ElectricalDataLoggerDescriptor;
import mods.eln.sixnode.electricalentitysensor.ElectricalEntitySensorDescriptor;
import mods.eln.sixnode.electricalgatesource.ElectricalGateSourceDescriptor;
import mods.eln.sixnode.electricalgatesource.ElectricalGateSourceRenderObj;
import mods.eln.sixnode.electricallightsensor.ElectricalLightSensorDescriptor;
import mods.eln.sixnode.electricalmath.ElectricalMathDescriptor;
import mods.eln.sixnode.electricalredstoneinput.ElectricalRedstoneInputDescriptor;
Expand Down Expand Up @@ -127,6 +128,7 @@
import mods.eln.sixnode.wirelesssignal.WirelessSignalAnalyserItemDescriptor;
import mods.eln.sixnode.wirelesssignal.repeater.WirelessSignalRepeaterDescriptor;
import mods.eln.sixnode.wirelesssignal.rx.WirelessSignalRxDescriptor;
import mods.eln.sixnode.wirelesssignal.source.WirelessSignalSourceDescriptor;
import mods.eln.sixnode.wirelesssignal.tx.WirelessSignalTxDescriptor;
import mods.eln.sixnode.wirelesssignal.tx.WirelessSignalTxElement;
import mods.eln.solver.ConstSymbole;
Expand Down Expand Up @@ -219,6 +221,7 @@ public class Eln {
public static final String[] objNames = new String[] {
"/model/condo200/condo200.obj",
"/model/WallClock/WallClock.obj",
"/model/TutoPlate/TutoPlate.obj",
"/model/relay800/relay800.obj",
"/model/hub/hub.obj",
"/model/electricalweathersensor/electricalweathersensor.obj",
Expand Down Expand Up @@ -1593,7 +1596,7 @@ private void registerSixNodeMisc(int id) {
name = "Tutorial sign";

TutorialSignDescriptor desc = new TutorialSignDescriptor(
name, obj.getObj("voltagesource"));
name, obj.getObj("TutoPlate"));
sixNodeItem.addDescriptor(subId + (id << 6), desc);
}
}
Expand Down Expand Up @@ -1916,14 +1919,16 @@ void registerElectricalRelay(int id) {
void registerElectricalGateSource(int id) {
int subId, completId;
String name;
ElectricalGateSourceDescriptor desc;


ElectricalGateSourceRenderObj signalsourcepot = new ElectricalGateSourceRenderObj(obj.getObj("signalsourcepot"));
ElectricalGateSourceRenderObj ledswitch = new ElectricalGateSourceRenderObj(obj.getObj("ledswitch"));

{
subId = 0;

name = "Signal Trimmer";

desc = new ElectricalGateSourceDescriptor(name, obj.getObj("signalsourcepot"), false);
ElectricalGateSourceDescriptor desc = new ElectricalGateSourceDescriptor(name, signalsourcepot, false);

sixNodeItem.addDescriptor(subId + (id << 6), desc);
}
Expand All @@ -1932,7 +1937,7 @@ void registerElectricalGateSource(int id) {

name = "Signal Switch";

desc = new ElectricalGateSourceDescriptor(name, obj.getObj("ledswitch"), true);
ElectricalGateSourceDescriptor desc = new ElectricalGateSourceDescriptor(name, ledswitch, true);

sixNodeItem.addDescriptor(subId + (id << 6), desc);
}
Expand All @@ -1941,10 +1946,26 @@ void registerElectricalGateSource(int id) {

name = "Signal Button";

desc = new ElectricalGateSourceDescriptor(name, obj.getObj("ledswitch"), true);
ElectricalGateSourceDescriptor desc = new ElectricalGateSourceDescriptor(name, ledswitch, true);
desc.setWithAutoReset();
sixNodeItem.addDescriptor(subId + (id << 6), desc);
}
{
subId = 12;

name = "Wireless Button";

WirelessSignalSourceDescriptor desc = new WirelessSignalSourceDescriptor(name, ledswitch,wirelessTxRange, true);
sixNodeItem.addDescriptor(subId + (id << 6), desc);
}
{
subId = 16;

name = "Wireless Switch";

WirelessSignalSourceDescriptor desc = new WirelessSignalSourceDescriptor(name, ledswitch,wirelessTxRange, false);
sixNodeItem.addDescriptor(subId + (id << 6), desc);
}

}

Expand Down
4 changes: 2 additions & 2 deletions mods/eln/misc/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public final class Version {
public final static int MAJOR = 1;

/** Minor version code. */
public final static int MINOR = 5;
public final static int MINOR = 6;

/**
* Unique version code. Must be a String for annotations. Used to check if a
* new version if available. Each update must increment this number.
*/
public final static String REVISION = "10";
public final static String REVISION = "11";

public final static String getVersionName() {
return String.format("BETA-%d.%d r%s", MAJOR, MINOR, REVISION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,128 +29,66 @@

public class ElectricalGateSourceDescriptor extends SixNodeDescriptor {

private Obj3DPart rot;
private Obj3DPart main;
private Obj3D obj;
private float rotAlphaOn, rotAlphaOff;

public boolean onOffOnly;
private Obj3DPart lever;
private Obj3DPart led;
private Obj3DPart halo;
public float speed;

public boolean autoReset = false;

public ElectricalGateSourceDescriptor(String name, Obj3D obj, boolean onOffOnly) {
super(name, ElectricalGateSourceElement.class, ElectricalGateSourceRender.class);
this.obj = obj;
if(obj != null){
main = obj.getPart("main");

if(obj.getString("type").equals("pot")) {
objType = ObjType.Pot;
rot = obj.getPart("rot");
if(rot != null) {
rotAlphaOff = rot.getFloat("alphaOff");
rotAlphaOn = rot.getFloat("alphaOn");
speed = rot.getFloat("speed");
}
}

if(obj.getString("type").equals("button")) {
lever = obj.getPart("button");
led = obj.getPart("led");
halo = obj.getPart("halo");

objType = ObjType.Button;
if(lever != null) {
speed = lever.getFloat("speed");
leverTx = lever.getFloat("tx");
}
}
}
this.onOffOnly = onOffOnly;
}


public ElectricalGateSourceDescriptor(String name, ElectricalGateSourceRenderObj render, boolean onOffOnly) {
super(name, ElectricalGateSourceElement.class, ElectricalGateSourceRender.class);
this.render = render;
this.onOffOnly = onOffOnly;
}

@Override
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer,
List list, boolean par4) {
super.addInformation(itemStack, entityPlayer, list, par4);
list.add("Provides signal voltage");
list.add("from user control");
}


public void setWithAutoReset(){

public void setWithAutoReset() {
autoReset = true;
}

enum ObjType {Pot, Button};

enum ObjType {
Pot, Button
};

ObjType objType;
float leverTx;
ElectricalGateSourceRenderObj render;
void draw(float factor, float distance, TileEntity e) {
switch (objType) {
case Button:
if(main != null)main.draw();

GL11.glTranslatef(leverTx * factor, 0f, 0f);
if(lever != null) lever.draw();

// if(factor < 0.5f) {
// GL11.glColor3f(234f / 255f, 80 / 255f, 0f);
UtilsClient.ledOnOffColor(factor > 0.5f);
UtilsClient.disableLight();
if(led != null) led.draw();
UtilsClient.enableBlend();

if(halo != null) {
if(e == null)
UtilsClient.drawLight(halo);
else {
Color c = UtilsClient.ledOnOffColorC(factor > 0.5f);
UtilsClient.drawHaloNoLightSetup(halo, c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, e, false);
}
}

UtilsClient.disableBlend();
UtilsClient.enableLight();
// }
/* else {
if(led != null) led.draw();
}*/

break;
case Pot:
if(main != null) main.draw();
if(rot != null) rot.draw(factor * (rotAlphaOn - rotAlphaOff) + rotAlphaOff, 1f, 0f, 0f);
break;
}
render.draw(factor, distance, e);
}

@Override
public void setParent(Item item, int damage) {
super.setParent(item, damage);
Data.addSignal(newItemStack());
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return true;
}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return true;
}

@Override
public boolean shouldUseRenderHelperEln(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {

return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glScalef(1.5f, 1.5f, 1.5f);
if(type == ItemRenderType.INVENTORY) GL11.glScalef(1.5f, 1.5f, 1.5f);
if (type == ItemRenderType.INVENTORY) GL11.glScalef(1.5f, 1.5f, 1.5f);
draw(0f, 1f, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public ElectricalGateSourceElement(SixNode sixNode, Direction side, SixNodeDescr
electricalComponentList.add(outputGateProcess);

if (this.descriptor.autoReset) {
electricalProcessList.add(autoResetProcess = new AutoResetProcess());
slowProcessList.add(autoResetProcess = new AutoResetProcess());
autoResetProcess.reset();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class ElectricalGateSourceRender extends SixNodeElementRender {
public ElectricalGateSourceRender(SixNodeEntity tileEntity, Direction side, SixNodeDescriptor descriptor) {
super(tileEntity, side, descriptor);
this.descriptor = (ElectricalGateSourceDescriptor) descriptor;
interpolator = new RcInterpolator(this.descriptor.speed);
interpolator = new RcInterpolator(this.descriptor.render.speed);
}

LRDU front;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package mods.eln.sixnode.electricalgatesource;

import java.awt.Color;

import net.minecraft.tileentity.TileEntity;

import org.lwjgl.opengl.GL11;

import mods.eln.misc.Obj3D;
import mods.eln.misc.UtilsClient;
import mods.eln.misc.Obj3D.Obj3DPart;
import mods.eln.sixnode.electricalgatesource.ElectricalGateSourceDescriptor.ObjType;

public class ElectricalGateSourceRenderObj {

private Obj3DPart rot;
private Obj3DPart main;
private Obj3D obj;
private Obj3DPart lever;
private Obj3DPart led;
private Obj3DPart halo;
ObjType objType;
float leverTx;


private float rotAlphaOn, rotAlphaOff;
public float speed;

public ElectricalGateSourceRenderObj(Obj3D obj) {
this.obj = obj;
if (obj != null) {
main = obj.getPart("main");

if (obj.getString("type").equals("pot")) {
objType = ObjType.Pot;
rot = obj.getPart("rot");
if (rot != null) {
rotAlphaOff = rot.getFloat("alphaOff");
rotAlphaOn = rot.getFloat("alphaOn");
speed = rot.getFloat("speed");
}
}

if (obj.getString("type").equals("button")) {
lever = obj.getPart("button");
led = obj.getPart("led");
halo = obj.getPart("halo");

objType = ObjType.Button;
if (lever != null) {
speed = lever.getFloat("speed");
leverTx = lever.getFloat("tx");
}
}
}
}


public void draw(float factor, float distance, TileEntity e) {
switch (objType) {
case Button:
if (main != null) main.draw();

GL11.glTranslatef(leverTx * factor, 0f, 0f);
if (lever != null) lever.draw();

UtilsClient.ledOnOffColor(factor > 0.5f);
UtilsClient.disableLight();
if (led != null) led.draw();
UtilsClient.enableBlend();

if (halo != null) {
if (e == null)
UtilsClient.drawLight(halo);
else {
Color c = UtilsClient.ledOnOffColorC(factor > 0.5f);
UtilsClient.drawHaloNoLightSetup(halo, c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, e, false);
}
}

UtilsClient.disableBlend();
UtilsClient.enableLight();

break;
case Pot:
if (main != null) main.draw();
if (rot != null) rot.draw(factor * (rotAlphaOn - rotAlphaOff) + rotAlphaOff, 1f, 0f, 0f);
break;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public boolean shouldUseRenderHelperEln(ItemRenderType type, ItemStack item, Ite
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
if(type == ItemRenderType.INVENTORY) {
GL11.glScalef(2.2f, 2.2f, 2.2f);
//GL11.glTranslatef(-0.1f, 0.0f, 0f);
}
draw(1f);
}
Expand Down
2 changes: 1 addition & 1 deletion mods/eln/sixnode/modbusrtu/ModbusRtuElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import mods.eln.sim.nbt.NbtElectricalGateInputOutput;
import mods.eln.sim.nbt.NbtElectricalGateOutputProcess;
import mods.eln.sixnode.wirelesssignal.IWirelessSignalSpot;
import mods.eln.sixnode.wirelesssignal.IWirelessSignalTx;
import mods.eln.sixnode.wirelesssignal.WirelessUtils;
import mods.eln.sixnode.wirelesssignal.tx.IWirelessSignalTx;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
Expand Down
2 changes: 1 addition & 1 deletion mods/eln/sixnode/modbusrtu/ServerWirelessRxStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.google.common.base.CaseFormat;

import mods.eln.misc.Utils;
import mods.eln.sixnode.wirelesssignal.IWirelessSignalTx;
import mods.eln.sixnode.wirelesssignal.aggregator.BiggerAggregator;
import mods.eln.sixnode.wirelesssignal.tx.IWirelessSignalTx;
import mods.eln.sixnode.wirelesssignal.tx.WirelessSignalTxElement;

public class ServerWirelessRxStatus extends WirelessRxStatus implements IModbusSlot{
Expand Down
Loading

0 comments on commit 7e5c365

Please sign in to comment.