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 ## 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: Stuff to do:
- Facial expressions - Facial expressions
- Actual specific reactions to being on fire / falling / lots of pain - Generally improve stumbling (foot stepping)
- 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
Post release ideas: Post release ideas:
- Localization support for other languages - 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 - 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_corpse_tick = CurTime()
local last_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) hook.Add("CreateEntityRagdoll", "zcnpci", function(ent, ragdoll)
if !ent.organism then return end if !ent.organism then return end
@ -303,15 +313,16 @@ hook.Add("Tick", "zcnpci", function()
end end
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 for i,ent in pairs(npcs_to_fake) do
ent.organism_no_damage = true
local damage_info = DamageInfo() local damage_info = DamageInfo()
damage_info:SetDamage(0) damage_info:SetDamage(999999)
damage_info:SetAttacker(ent) damage_info:SetAttacker(ent)
damage_info:SetDamageType( DMG_DIRECT )
damage_info:SetDamageForce(Vector(0, 0, 0)) damage_info:SetDamageForce(Vector(0, 0, 0))
ent:BecomeRagdoll(damage_info) ent:TakeDamageInfo(damage_info)
table.remove(npcs_to_fake, 1) table.remove(npcs_to_fake, 1)
end end

View file

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