Jump to content

sthalik

Member
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

sthalik's Achievements

  1. Hey, I did a bit of researching and prototyping. I'm able to inject code without creating a derivative work of PZ. That is, I don't need to provide a modified version of PZ's copyrighted bytecode. BUT! I still need to modify it in the right place where Lua initializes its Java support, i.e. metatables et al. This is obviously a violation of the copyright agreement PZ comes with. Basically it's an executable change, except it's bytecode and not machine code. It's not a difference though. In case the PZ team considers this inappropriate, please say so and I'll stop all technically-infringing activity. Things that don't work: 1) Static initializers in own code copied into .class won't work. The code has to be referenced by PZ code in order to load the static initializer, in Java. 2) Recompiling kahlua2. It has some mild modifications that won't allow for a drop-in replacement of the entire kahlua codebase.[1] 3) Adding do kahlua metatables for Java classes. I tried adding to _call or _index and there was no effect. What's strange is that the metatables are empty after exposing the Java classes. My prototype approach is to expose global Lua functions instead. That thing always works. I'd go for[2]: __get_field_descriptor(name, some-exposed-java-datum) -- get Java's "Field" class via reflection __get_field_value(datum, descriptor) -- get given datum's actual field value. I haven't done any of the prototype approach. No time. Things that might work: 1) Find out what the kahlua2 modifications are and replicate them from scratch to make a drop-in replacement. Too much effort, I won't do it. Still able to defeat via particular copyright legal clauses. 2) Modify just _some_ of kahlua2 code. It's brittle and still theoretically able to defeat via copyright. Things depend on whether the PZ authors are hostile or neutral toward the approach. In the former case it's pointless to work on it since it won't be visible in modding community anyway. [1] It crashed on startup missing "currentFile" in some of kahlua2 classes. [2] After the prototype stage, we'd need to whitelist exposed fields since unlimited access to internal values is a can of worms. sh
  2. @Morry It's only necessary to create a static intiializer that calls into kahlua, and forcing it to run. That's way less complex than a custom class loader which I suggested earlier. See that there are apps requiring Xposed for Android on the official store. As an analogy to PZ, there can be Workshop mods that won't run without Java internals. > it might look silly if slow zombies try to intercept you from far away. It's on the contrary actually in flight simulation. The distances are large enough (30-50 nautical miles) that PZ zombies seem fast
  3. @Morry I notice that the behavior is limited to LungeState. Would you comment on the feasibility of the following changes? - There are state machine targets like `WalkTowardState' et al. that could use running an intercept course. - We'd need either a target or a tile location of the target. - We'd need to invoke Bresenham over the target's position as well as the preferred intercept course. See that it's pointless to intercept with obstacles around. The non-antialiased Bresenham algorithm version. Finally, the important bit: - How feasible is it to hook the Java class loader and add `getTarget' method ourselves? This reminds me of Xposed on Android where one could "advice" the function, running around it, replacing it, running before or after, etc. - Please keep in mind that messing with the class loader isn't something that could be downloaded from the Workshop. On the other hand, it can be used for all kinds of stuff, without the need to coordinate with the development team. If stuff is fixed in mainline after a time, good, but one could start modifying classes programmatically, and making all the stuff from the debugger visible to Lua. What is the general sentiment about that kind of mod "helper"? Would users allow for it, despite the potential lack of sandboxing it causes? I can work on it if there are others that want to potentially use it. See here for nitty gritty detail of what can be done: - https://github.com/krka/kahlua2/blob/64ff71a8b213f3a4d7b0319f974a878771a6ab89/j2se/src/se/krka/kahlua/j2se/KahluaTableImpl.java#L49 - https://stackoverflow.com/questions/3560103/how-to-force-a-class-to-be-initialised In fact one needn't a full "advice", merely add elements to existing kahlua2's metatable. @Morry thank you for being responsive on the Steam comment page. Also I like your mod's general ideas.
  4. Hey, I've made a rudimentary mod that changes permanent infection to hypochondriac-like infection. There's a question -- can one define the length of the fake infection or reset its duration to the beginning? Also, I just couldn't get the list of body parts to work. Enumerating them is a real PITA in the present code. Looked like the enumerator didn't work without further explanation, hence hand-unrolled version. Can you see anything else dubious in the code? local function do_part(dmg, part, acc) local part = dmg:getBodyPart(part) if part:IsInfected() then part:SetInfected(false) part:SetFakeInfected(true) return true end return acc end local function maybe_clear_infected(dmg) local ret = false ret = do_part(dmg, BodyPartType.Foot_L, ret) ret = do_part(dmg, BodyPartType.Foot_R, ret) ret = do_part(dmg, BodyPartType.ForeArm_L, ret) ret = do_part(dmg, BodyPartType.ForeArm_R, ret) ret = do_part(dmg, BodyPartType.Groin, ret) ret = do_part(dmg, BodyPartType.Hand_L, ret) ret = do_part(dmg, BodyPartType.Hand_R, ret) ret = do_part(dmg, BodyPartType.Head, ret) ret = do_part(dmg, BodyPartType.LowerLeg_L, ret) ret = do_part(dmg, BodyPartType.LowerLeg_R, ret) ret = do_part(dmg, BodyPartType.Neck, ret) ret = do_part(dmg, BodyPartType.Torso_Lower, ret) ret = do_part(dmg, BodyPartType.Torso_Upper, ret) ret = do_part(dmg, BodyPartType.UpperArm_L, ret) ret = do_part(dmg, BodyPartType.UpperArm_R, ret) ret = do_part(dmg, BodyPartType.UpperLeg_L, ret) ret = do_part(dmg, BodyPartType.UpperLeg_R, ret) return ret end local function check_player_infected(player) local dmg = player:getBodyDamage() local inf_level = dmg:getInfectionLevel() if inf_level > 0. and maybe_clear_infected(dmg) then local fake_inf_level = dmg:getFakeInfectionLevel() dmg:setInfectionLevel(0) dmg:setFakeInfectionLevel(fake_inf_level + inf_level) dmg:setInf(false) dmg:setIsFakeInfected(true) end end Events.OnPlayerUpdate.Add(check_player_infected)
×
×
  • Create New...