mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-23 14:11:16 -09:00
Fix gun bug and hashing algo bug
This commit is contained in:
parent
a0241562df
commit
19364fe304
@ -53,11 +53,12 @@
|
|||||||
}
|
}
|
||||||
ModAPI.reflect.prototypeStack(itemClass, nmi_ItemPistol);
|
ModAPI.reflect.prototypeStack(itemClass, nmi_ItemPistol);
|
||||||
nmi_ItemPistol.prototype.$onItemRightClick = function ($itemstack, $world, $player) {
|
nmi_ItemPistol.prototype.$onItemRightClick = function ($itemstack, $world, $player) {
|
||||||
|
var magic = ModAPI.reflect.getClassByName("DamageSource").staticVariables.magic;
|
||||||
var world = ModAPI.util.wrap($world);
|
var world = ModAPI.util.wrap($world);
|
||||||
var entityplayer = ModAPI.util.wrap($player);
|
var entityplayer = ModAPI.util.wrap($player);
|
||||||
var shotentity = entityRayCast(entityplayer, world, 12.0)
|
var shotentity = entityRayCast(entityplayer, world, 12.0)
|
||||||
if (shotentity != null){
|
if (shotentity != null){
|
||||||
shotentity.heal(-10);
|
shotentity.attackEntityFrom(magic, 10);
|
||||||
world.playSoundAtEntity(entityplayer.getRef(), ModAPI.util.str("tile.piston.out"), 1.0, 1.8);
|
world.playSoundAtEntity(entityplayer.getRef(), ModAPI.util.str("tile.piston.out"), 1.0, 1.8);
|
||||||
}
|
}
|
||||||
return $itemstack;
|
return $itemstack;
|
||||||
@ -98,12 +99,12 @@
|
|||||||
"thirdperson": {
|
"thirdperson": {
|
||||||
"rotation": [ 5, 80, -45 ],
|
"rotation": [ 5, 80, -45 ],
|
||||||
"translation": [ 0, 1, -3 ],
|
"translation": [ 0, 1, -3 ],
|
||||||
"scale": [ 0.55, 0.55, 0.55 ]
|
"scale": [ 0.1, 0.1, 0.1 ]
|
||||||
},
|
},
|
||||||
"firstperson": {
|
"firstperson": {
|
||||||
"rotation": [ 0, -135, 25 ],
|
"rotation": [ 0, -135, 25 ],
|
||||||
"translation": [ 0, 4, 2 ],
|
"translation": [ 0, 4, 2 ],
|
||||||
"scale": [ 1.7, 1.7, 1.7 ]
|
"scale": [ 1.8, 1.8, 1.8 ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -955,8 +955,8 @@ globalThis.modapi_postinit = "(" + (() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function qhash(txt, arr) {
|
function qhash(txt, arr) {
|
||||||
var interval = 4095 - arr.length;
|
var interval = 4095; //used to be 4095 - arr.length, but that increases incompatibility based on load order and otehr circumstances
|
||||||
if (interval < 1) {
|
if (arr.length >= 4095) {
|
||||||
console.error("[ModAPI.keygen] Ran out of IDs while generating for " + txt);
|
console.error("[ModAPI.keygen] Ran out of IDs while generating for " + txt);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -969,7 +969,7 @@ globalThis.modapi_postinit = "(" + (() => {
|
|||||||
}
|
}
|
||||||
var hash = x;
|
var hash = x;
|
||||||
while (arr.includes(hash)) {
|
while (arr.includes(hash)) {
|
||||||
hash = (hash + 1) % (interval + arr.length);
|
hash = (hash + 1) % interval;
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user