Prevents plastanium conveyor unload exploit (#4098)
* Prevent unloaders from unloading plast loading dock * Use overridable boolean method unloadable instead * unloadable -> canUnload
This commit is contained in:
committed by
GitHub
parent
85a668c202
commit
9397bd57c4
@@ -384,6 +384,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
//endregion
|
//endregion
|
||||||
//region handler methods
|
//region handler methods
|
||||||
|
|
||||||
|
public boolean canUnload(){
|
||||||
|
return block.unloadable;
|
||||||
|
}
|
||||||
|
|
||||||
/** Called when an unloader takes an item. */
|
/** Called when an unloader takes an item. */
|
||||||
public void itemTaken(Item item){
|
public void itemTaken(Item item){
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,11 @@ public class StackConveyor extends Block implements Autotiler{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUnload(){
|
||||||
|
return state != stateLoad;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float efficiency(){
|
public float efficiency(){
|
||||||
return 1f;
|
return 1f;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class Unloader extends Block{
|
|||||||
int pos = (offset + i) % proximity.size;
|
int pos = (offset + i) % proximity.size;
|
||||||
var other = proximity.get(pos);
|
var other = proximity.get(pos);
|
||||||
|
|
||||||
if(other.interactable(team) && other.block.unloadable && other.block.hasItems
|
if(other.interactable(team) && other.block.unloadable && other.canUnload() && other.block.hasItems
|
||||||
&& ((sortItem == null && other.items.total() > 0) || (sortItem != null && other.items.has(sortItem)))){
|
&& ((sortItem == null && other.items.total() > 0) || (sortItem != null && other.items.has(sortItem)))){
|
||||||
//make sure the item can't be dumped back into this block
|
//make sure the item can't be dumped back into this block
|
||||||
dumpingTo = other;
|
dumpingTo = other;
|
||||||
|
|||||||
Reference in New Issue
Block a user