Fix knockback on unconscious, preserve organism when getting up
This commit is contained in:
parent
439e152b19
commit
bd83f1db26
3 changed files with 27 additions and 21 deletions
32
README.md
32
README.md
|
|
@ -1,25 +1,21 @@
|
|||
# Z-City NPC Integration
|
||||
|
||||
I made this in an angry fugue after desperately trying to improve my frames by creating a more optimized euphoria ragdoll mod. Now that I'm done with that I figured out how tio actually fix my frames, and it was not this addon. However, I have another issue: NPCs with Z-City suck. Like they tank hits like crazy. You could unload a mag on someone's leg and there would be a non-zero chance they would still be perfectly fine. I'd like to turn my optimized Fedhoria mod into a base for a Z-City NPC improvement mod.
|
||||
Adds better NPC integration for the Garry's Mod addon Z-City. While Z-City has a convar that enables the custom health system on NPCs, it really isn't the best or most advanced thing in the world. This has irritated me since I first started using Z-City. Therefore, I've decided to take care of the problem myself with my own plugin.
|
||||
|
||||
Here are the current features:
|
||||
- NPCs can now be alive while ragdolled, and can move around in that state.
|
||||
- NPCs can collapse due to unconsciousness or pain.
|
||||
- NPCs can get back up after being ragdolled.
|
||||
|
||||
- NPCs are now integrated with Z-City's health system. They wriggle when conscious, and don't when they aren't.
|
||||
|
||||
Some ideas:
|
||||
|
||||
- Generally, enemies need to be closer to players in terms of fleshiness. Extreme pain, broken limbs, etc. currently knock over players, but not NPCs. This is something I'd like to fix.
|
||||
- Enemies should target downed enemies of hostile factions.
|
||||
- Enemies should be able to get back up from being ragdolled if they're in good enough shape.
|
||||
|
||||
Since theoretically the NPCs use the same health system that players use, these shouldn't be too hard to implement.
|
||||
|
||||
More optimistic ideas:
|
||||
|
||||
- NPCs will back out of combat when injured.
|
||||
- Friendly NPCs can heal each other.
|
||||
- NPCs can heal themselves to a limited degree.
|
||||
This plugin is based off of Kazarei's Euphoria, which in turn is a fork of Fedhoria by Rama.
|
||||
|
||||
## Incompatibilities
|
||||
|
||||
- Any mod that modifies the behavior of death ragdolls (Reagdoll, Artagdoll, Fedhoria)
|
||||
- Any mod that modifies the behavior of death ragdolls (Reagdoll, Artagdoll, Fedhoria)
|
||||
|
||||
## Future plans
|
||||
|
||||
No guarantees any of this will become real.
|
||||
|
||||
- NPCs will back out of combat when injured.
|
||||
- Friendly NPCs can heal each other.
|
||||
- NPCs can heal themselves to a limited degree.
|
||||
|
|
@ -86,9 +86,15 @@ hook.Add("Think", "zcnpci", function()
|
|||
ent.organism.llegamputated or
|
||||
ent.organism.rlegamputated or
|
||||
(ent.organism.consciousness <= 0.3) or
|
||||
(ent.organism.pain > 0.9)
|
||||
(ent.organism.pain > 90)
|
||||
) then
|
||||
ent:TakeDamage(ent:Health())
|
||||
local damage_info = DamageInfo()
|
||||
damage_info:SetDamage(ent:Health())
|
||||
damage_info:SetAttacker(ent)
|
||||
damage_info:SetDamageType( DMG_DIRECT )
|
||||
damage_info:SetDamageForce(Vector(0, 0, 0))
|
||||
|
||||
ent:TakeDamageInfo(damage_info)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -264,7 +264,8 @@ function MODULE:PhysicsSimulate(phys, dt)
|
|||
if (
|
||||
(minimum_down_timer >= 1.0) and
|
||||
(target.class_in_previous_life != nil) and
|
||||
!(target.organism.llegamputated or target.organism.rlegamputated or target.organism.larmamputated or target.organism.rarmamputated)
|
||||
!(target.organism.llegamputated or target.organism.rlegamputated or target.organism.larmamputated or target.organism.rarmamputated) and
|
||||
(target.organism.pain <= 80)
|
||||
) then
|
||||
local ent = ents.Create(target.class_in_previous_life)
|
||||
ent:SetPos(target:GetPos())
|
||||
|
|
@ -281,6 +282,9 @@ function MODULE:PhysicsSimulate(phys, dt)
|
|||
|
||||
ent:Spawn()
|
||||
|
||||
ent.organism = table.Copy(target.organism)
|
||||
ent.organism.owner = ent
|
||||
|
||||
self.StopProcessing = true
|
||||
|
||||
self:Remove()
|
||||
|
|
|
|||
Loading…
Reference in a new issue