Compare commits

...

2 commits

3 changed files with 52 additions and 45 deletions

View file

@ -32,25 +32,19 @@ It is, however, not compatbile with:
## Todo list
Urgent shit:
MUST BE DONE BEFORE RELEASE:
- Large amounts of damage (such as shotguns) fling NPC ragdolls to ridiculous lengths, sometimes severely injuring the player. While this is absolutely fucking hilarious, it also isn't the best experience.
- NPCs should not unfake when moved around
- Actual specific reactions to being on fire / falling / lots of pain
Stuff to do:
- Facial expressions
- Actual specific reactions to being on fire / falling / lots of pain
- Wound holding
- NPCs should not stumble when dead
- Generally improve stumbling
Stuff to fix possibly:
- NPC targeting works, but works really weirdly (sometimes it just. keeps targeting corpses when it shouldn't.) Why? Who knows!!!!
- Look into improving the unfake animation? Really scared to try and touch it again but it would be worthwhile
- Generally improve stumbling (foot stepping)
Post release ideas:
- Localization support for other languages
- ReaSFX integration would probably be nice. I mean there's so many SFX packs to choose from, so I don't even have to pack it in
- To be entirely honest Fedhoria isn't the best addon out there for euphoria physics. Maybe rebase to another addon (or alternatively build a new one?)
- To be entirely honest Fedhoria isn't the best addon out there for euphoria physics. Maybe rebase to another addon (or alternatively build a new one?)
- NPC targeting works, but works really weirdly (sometimes it just. keeps targeting corpses when it shouldn't.) It actually isn't THAT much of an issue because it doesn't feel totally outlandish but I would still love to fix it.

View file

@ -57,6 +57,16 @@ local corpses = {}
local last_corpse_tick = CurTime()
local last_tick = CurTime()
-- We need to override the default homigrad damage hook so it doesn't cause damage to ragdolls we are tryign to fake
-- Don't particularly like doing this but you gotta do what you gotta do
local homigrad_damage_hook = hook.GetTable().EntityTakeDamage["homigrad-damage"]
hook.Add("EntityTakeDamage", "homigrad-damage", function(ent, dmginfo)
if ent:IsNPC() and ent.organism_no_damage then return false end
homigrad_damage_hook(ent, dmginfo)
end)
hook.Add("CreateEntityRagdoll", "zcnpci", function(ent, ragdoll)
if !ent.organism then return end
@ -303,15 +313,16 @@ hook.Add("Tick", "zcnpci", function()
end
end
-- NPC faking is in a seperate area because we want NPCs to ragdoll as soon as they can
-- NPC faking is in a seperate area because we want NPCs to fake as soon as they can
for i,ent in pairs(npcs_to_fake) do
ent.organism_no_damage = true
local damage_info = DamageInfo()
damage_info:SetDamage(0)
damage_info:SetDamage(999999)
damage_info:SetAttacker(ent)
damage_info:SetDamageType( DMG_DIRECT )
damage_info:SetDamageForce(Vector(0, 0, 0))
ent:BecomeRagdoll(damage_info)
ent:TakeDamageInfo(damage_info)
table.remove(npcs_to_fake, 1)
end

View file

@ -42,20 +42,20 @@ local twitchable_bone_names = {
local fakeup_bone_names = {
"ValveBiped.Bip01_Pelvis",
--[[]"ValveBiped.Bip01_Spine2",]]
"ValveBiped.Bip01_Spine2",
"ValveBiped.Bip01_Head1",
--[[]"ValveBiped.Bip01_R_Thigh",
"ValveBiped.Bip01_R_Thigh",
"ValveBiped.Bip01_L_Thigh",
"ValveBiped.Bip01_L_Calf",
"ValveBiped.Bip01_R_Calf",
"ValveBiped.Bip01_R_Foot",
"ValveBiped.Bip01_L_Foot",
--[["ValveBiped.Bip01_R_Upperarm",
--[["ValveBiped.Bip01_L_Upperarm",
"ValveBiped.Bip01_R_Upperarm",
"ValveBiped.Bip01_L_Upperarm",
"ValveBiped.Bip01_R_Forearm",
"ValveBiped.Bip01_L_Forearm",
"ValveBiped.Bip01_R_Hand",
"ValveBiped.Bip01_L_Hand",]]
"ValveBiped.Bip01_L_Hand",
}
local fakeup_bone_down_names = {
@ -237,7 +237,15 @@ function MODULE:Think()
local parent = self.FakeParent
if !IsValid(parent) then return end
--parent:FrameAdvance(FrameTime())
if !self.ModelBoneList then return end
--[[for i,v in pairs(self.ModelBoneList) do
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(v)))
if !IsValid(object) then continue end
object:EnableCollisions(false)
end]]
end
if !IsValid(phys) or !phys:IsAsleep() then return end
@ -304,28 +312,23 @@ function MODULE:PhysicsSimulate(phys, dt)
local i = 0
while i < target:GetBoneCount() do
table.insert(self.ModelBoneList, target:GetBoneName(i))
local name = target:GetBoneName(i)
local object = target:LookupBone(name)
if object == -1 then i = i + 1; continue end
self.ModelBoneList[name] = target:GetBoneMatrix(object)
i = i + 1
end
end
local animation_progress = (CurTime() - self.FakeUpStart) / (self.FakeUpEnd - self.FakeUpStart)
--[[util.TraceLine({
start = parent:GetPos() + Vector(0, 128, 0),
endpos = parent:GetPos(),
collisiongroup = COLLISION_GROUP_NPC
})]]
for i,v in pairs(fakeup_bone_down_names) do
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(v)))
object:SetMass(0.5)
end
for i,v in pairs(fakeup_bone_names) do
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(v)))
local parent_bone = parent:LookupBone(v)
for i, name in pairs(fakeup_bone_names) do
print(name)
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(name)))
local parent_bone = parent:LookupBone(name)
if parent_bone == -1 then continue end
@ -333,12 +336,13 @@ function MODULE:PhysicsSimulate(phys, dt)
if !parent_bone_matrix then continue end
local parent_bone_pos, parent_bone_angle = parent_bone_matrix:GetTranslation(), parent_bone_matrix:GetAngles()
parent_bone_angle.y = parent_bone_angle.y + 90
local old_bone_pos, old_bone_angle = object:GetPos(), object:GetAngles()
--parent_bone_angle.y = parent_bone_angle.y + 90
local shadow_data = {
secondstoarrive = 0.01,
pos = LerpVector(animation_progress, object:GetPos(), parent_bone_pos),
angle = LerpAngle(animation_progress, object:GetAngles(), parent_bone_angle),
pos = LerpVector(animation_progress, old_bone_pos, parent_bone_pos),
angle = LerpAngle(animation_progress, old_bone_angle, parent_bone_angle),
maxspeed = 400,
maxangular = 2000,
maxspeeddamp = 60,
@ -348,12 +352,10 @@ function MODULE:PhysicsSimulate(phys, dt)
-- Can't set position inside physics tick, crashes the game instantly.
-- Instead, send a shadow for it to follow (I think? I don't know GMod is kinda funky)
object:ComputeShadowControl(shadow_data)
object:Wake()
object:EnableGravity(false)
object:Wake()
i = i + 1
--i = i + 1
end
return false