Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
3c73d95
Misc minor tweaks, including style changes, balancing, sprite edits a…
fourZK Feb 11, 2021
d2e88e1
Give the Silver Man some dope wound fx
fourZK Feb 11, 2021
402608e
Doors to settle into "Mangled Metal" which is now also stronger
fourZK Feb 11, 2021
13fa82d
Imperatus infantry makeover!
fourZK Feb 11, 2021
9d56025
Animated ladder node
fourZK Feb 11, 2021
9601537
Added geiger click, legacy servo sounds (robot device switch)
fourZK Feb 11, 2021
03bbb99
Fix OMA activities giving you non-buyable items
fourZK Feb 11, 2021
f703ac2
Further cf-143 related rework (GibImpulseLimit, JointStrength, FGLeg.…
fourZK Feb 11, 2021
009324e
AI tweaks and fixes
fourZK Feb 11, 2021
d94fafc
This was a bug, I think?
fourZK Feb 11, 2021
3f02b3f
Some edits to digging/breaching tool descriptions
fourZK Feb 11, 2021
894c94c
Return of the Dummy Shielder!
fourZK Feb 11, 2021
d631b1a
Digger nerf! Thanks to ShellEjectAngle, diggers now use the Shell par…
fourZK Feb 11, 2021
07dc087
New weight indicators (see source branch)
fourZK Feb 11, 2021
13bb8fd
Utilize Actor.Inventory for a multitude of scripts;
fourZK Feb 11, 2021
af0b309
New shove system (needs further tweaking)
fourZK Feb 11, 2021
2b0d2d6
Fix constant gold income running on bunker building phase;
fourZK Feb 11, 2021
8757847
Slugger pistol edits, formatting fixes
fourZK Feb 11, 2021
234c33a
Hammerfist and Bulldog firerate decrease, as requested by pawnis
fourZK Feb 11, 2021
e88b86e
Define lua-used soundcontainers in .ini (to-do: more of this)
fourZK Feb 11, 2021
346affa
Whitebot sprite edits
fourZK Feb 11, 2021
f0ff9c6
Implement some shell fx with the new ShellEjectAngle property;
fourZK Feb 11, 2021
1ed862c
Prevent craft turret from firing while unstable/dead
fourZK Feb 12, 2021
c1b3448
More SoundContainers getting proper .ini representation
fourZK Feb 12, 2021
fd4dbbc
Fix cases where IndividualRadius is desired over new total Radius
fourZK Feb 12, 2021
d679621
Fix some recoil-related issues
fourZK Feb 12, 2021
f5dbfa6
Techion Sounds.ini directory
fourZK Feb 12, 2021
9752527
Touch ups of Backblast, Chunker, Heatlance, Shielder, Turbo Digger
fourZK Feb 12, 2021
cc11b1e
Getting used to using InheritedRotAngleOffset properly instead of Rot…
fourZK Feb 12, 2021
10ff705
Added Ronin Stoner 63 (WIP)
fourZK Feb 12, 2021
87ae7b1
Fix misspelling for Ricochet
fourZK Feb 15, 2021
d4562ca
Buff Riot Shield, Browncoat Flash
fourZK Feb 15, 2021
f203b79
Sprite edits, balancing, fixes
fourZK Feb 15, 2021
6233f3c
RPC and Chainsaw fixes/edits (Chainsaw is missing a proper fire sound)
fourZK Feb 15, 2021
18b58f0
Forgot to include removal of misspelled ricochet sounds
fourZK Feb 15, 2021
0e69a1f
Smoothen out dropship engines by halving emission mass and doubling rate
fourZK Feb 18, 2021
e2e52ac
Refer properly to .wav until someone converts these to .flac
fourZK Feb 18, 2021
fceed3f
RE: Refer properly to .wav until someone converts these to .flac
fourZK Feb 18, 2021
aae29a9
"Flame Smoke 1 Micro" edits
fourZK Feb 18, 2021
77c4a64
New visuals for Medic Drone
fourZK Feb 18, 2021
6041192
More Radius-related tweaks
fourZK Feb 18, 2021
a5ebaeb
Dock tweaks (to-do: somehow fix entering actors colliding with craft …
fourZK Feb 18, 2021
2bdd119
Taking a step back with door strengths - looking for that sweet spot
fourZK Feb 18, 2021
a357624
Minor formatting changes, edits, balancing
fourZK Feb 18, 2021
448bf04
Shielder sounds + balancing
fourZK Feb 18, 2021
1e56079
Browncoat Heavy Head edits
fourZK Feb 18, 2021
ed73d33
Browncoat weapon edits
fourZK Feb 18, 2021
6a89120
Remove these glows, don't need 'em no more
fourZK Feb 18, 2021
4f4fbbb
Merge branch 'development' into 4zk-content
fourZK Feb 18, 2021
2004cf2
Reinforce "door material layer" material so it doesn't get dug by acc…
fourZK Feb 19, 2021
cf86ae8
Introduce Browncoat Digger, "Blowtorch"
fourZK Feb 19, 2021
796313e
Buff Devastator + move "Short" grenade fragment definitions into Base
fourZK Feb 21, 2021
5892bcd
Fix craft-related gib stuff
fourZK Feb 21, 2021
3105fd6
Weakened door motors, edited base diggers and Blowtorch
fourZK Feb 21, 2021
9ac9012
Browncoat pyro gun balancing
fourZK Feb 21, 2021
ed7101f
Full angle eliminations for craft are now enabled on source-level
fourZK Feb 23, 2021
d2da806
Data followup to HFlipped and OrientToVel edits
fourZK Feb 23, 2021
f290c17
Misc changes / fixes
fourZK Feb 23, 2021
c7dfb76
Ronin Shovel edits
fourZK Feb 23, 2021
9b8eff5
Ronin RPG-7 edits
fourZK Feb 23, 2021
b50fd57
tons of sound-based changes
pawnishoovy Mar 2, 2021
b3dab5e
Merge branch 'development' into 4zk-content
fourZK Mar 2, 2021
68a9666
monoify blowtorch
pawnishoovy Mar 2, 2021
40d27f6
Rename "Bouncy Military Stuff" as "Bouncy Stuff" and move it to Base
fourZK Mar 5, 2021
321dc9f
Techion Nano Rifle glow effects
fourZK Mar 5, 2021
4b4a13e
Some Ronin edits, mostly weapon-related
fourZK Mar 5, 2021
fc128f5
Removing Deactivate() lines from pump/bolt-action scripts and hoping …
fourZK Mar 5, 2021
a23edad
Cleaning up lua constants list and editing maximum MOID logic
fourZK Mar 8, 2021
a86582c
Metagame: Replace old NOPLAYER enum,
fourZK Mar 8, 2021
25c54bd
Edited some TerrainFrostings and smoothened out snowy terrain bitmaps
fourZK Mar 8, 2021
4a2daeb
Merge branch '4zk-content' of https://github.com/cortex-command-commu…
fourZK Mar 12, 2021
c4ff4c4
Merge branch 'development' into 4zk-content
fourZK Mar 12, 2021
97f9229
HumanFunctions.DoAlternativeGib to use new wound and attachable relat…
fourZK Mar 12, 2021
91819a1
Craft-related edits and balancing
fourZK Mar 12, 2021
5c9c8ab
Whoops yeah also add HatchCloseSounds
fourZK Mar 12, 2021
1ce4156
Misc edits in Base.rte
fourZK Mar 12, 2021
d32c62d
Reinstating the legacy Base SMG sprite with some touchups because I g…
fourZK Mar 12, 2021
24ddcd2
Fire and flame-related edits, mainly in favor of the Browncoat Heatlance
fourZK Mar 12, 2021
fa54ca0
Vanilla implementation of new property BGArmFlailScalar
fourZK Mar 12, 2021
ff23fd8
Misc edits and fixes across factions
fourZK Mar 12, 2021
ba4e1b4
Merge branch 'development' into 4zk-content
fourZK Mar 17, 2021
a8c4da4
My followup to renaming of CollidesWithTerrainWhenAttached to Collide…
fourZK Mar 19, 2021
f6388df
Edits to Ronin machinegun sprites
fourZK Mar 19, 2021
e7ad08b
Minor fixes and balancing
fourZK Mar 23, 2021
8066b27
Crab stuff
fourZK Mar 23, 2021
c93378d
Misc edits e.g. TrailLength lua explosal followup
fourZK Mar 28, 2021
d6bffb3
Added Null Actor that can be used for things such as observer or curs…
fourZK Apr 3, 2021
ac6550a
Allow HumanFunctions.DoAutomaticEquip to unequip BG item and equip it…
fourZK Apr 3, 2021
9b21a84
Fixed minor bug in Ronin Commander
fourZK Apr 3, 2021
aaa2fcf
Allow AHuman squad members in radius of leader to move in sync
fourZK Apr 3, 2021
998e6ed
Imperatus Bullpup tweaks
fourZK Apr 9, 2021
104f09f
Techion Pulse Shot tweaks
fourZK Apr 9, 2021
d9901e5
RPC tweaks
fourZK Apr 9, 2021
5f6c61f
Minor script tweaks
fourZK Apr 9, 2021
1895dba
Merge branch 'development' into 4zk-content
fourZK Apr 9, 2021
eef2733
Snake nose job
fourZK Apr 19, 2021
f2602d0
Lua bugfixes
fourZK Apr 19, 2021
d621979
Review changes
fourZK May 4, 2021
73a97b7
Techion Pulse Shot refactor
fourZK May 4, 2021
48169bd
Misc ini fixes
fourZK May 4, 2021
7f8e101
whoops lol
fourZK May 4, 2021
a2acc01
More review changes
fourZK May 8, 2021
51769cc
Merge branch 'development' into 4zk-content
fourZK May 8, 2021
7338c1c
Merge branch 'development' into 4zk-content
fourZK May 10, 2021
319beb0
Convert a bunch of wavs to flac
MaximDude May 25, 2021
8c0f7ce
Rename some sounds for consistency
MaximDude May 25, 2021
4e7f8da
Review changes / Maxim
fourZK Jun 1, 2021
8c6ab8a
Review changes / Gacyr
fourZK Jun 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions Base.rte/AI/CrabBehaviors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ end
function CrabBehaviors.Sentry(AI, Owner, Abort)
local sweepUp = true
local sweepDone = false
local maxAng = Owner.AimRange
local minAng = -maxAng
-- to-do: refer to upper/lower limits!
local maxAng = Owner.AimRange--Owner.AimRangeUpperLimit
local minAng = -maxAng--Owner.AimRangeLowerLimit
local aim

if AI.OldTargetPos then -- try to reacquire an old target
Expand Down
10 changes: 0 additions & 10 deletions Base.rte/AI/DropShipAI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,4 @@ end

function UpdateAI(self)
self.AI:Update(self)
end

function Update(self)
--Re-orient the craft at 180 degrees to help rotational AI
if self.RotAngle > math.pi then
self.RotAngle = self.RotAngle - (math.pi * 2);
end
if self.RotAngle < -math.pi then
self.RotAngle = self.RotAngle + (math.pi * 2);
end
end
34 changes: 23 additions & 11 deletions Base.rte/AI/HumanBehaviors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ function HumanBehaviors.CalculateThreatLevel(MO, Owner)
else
priority = priority + 0.3
end
elseif MO.ClassName == "ADoor" then
priority = priority * 0.5
end

return priority - MO.Health / 500 -- prioritize damaged targets
Expand Down Expand Up @@ -2113,23 +2115,29 @@ function HumanBehaviors.GoProne(AI, Owner, TargetPos, targetID)
end

AI.proneState = AHuman.PRONE
if Dist.X > 0 then
AI.lateralMoveState = Actor.LAT_RIGHT
else
AI.lateralMoveState = Actor.LAT_LEFT
if not Owner.EquippedBGItem then
if Dist.X > 0 then
AI.lateralMoveState = Actor.LAT_RIGHT
else
AI.lateralMoveState = Actor.LAT_LEFT
end
end

return true
end

-- get the projectile properties from the magazine
function HumanBehaviors.GetProjectileData(Owner)
local Weapon = ToHDFirearm(Owner.EquippedItem)
local Round = Weapon.Magazine.NextRound
local Projectile = Round.NextParticle
local PrjDat = {MagazineName=Weapon.Magazine.PresetName}

if Round.IsEmpty then -- set default values if there is no particle
local Weapon, Round, Projectile, PrjDat
if Owner.EquippedItem and IsHDFirearm(Owner.EquippedItem) then
Weapon = ToHDFirearm(Owner.EquippedItem)
if Weapon.Magazine then
Round = Weapon.Magazine.NextRound
Projectile = Round.NextParticle
PrjDat = {MagazineName=Weapon.Magazine.PresetName}
end
end
if Round == nil or Round.IsEmpty then -- set default values if there is no particle
PrjDat.g = 0
PrjDat.vel = 100
PrjDat.rng = math.huge
Expand Down Expand Up @@ -2533,6 +2541,10 @@ function HumanBehaviors.ShootTarget(AI, Owner, Abort)
if Owner.EquippedItem and ToHeldDevice(Owner.EquippedItem):IsReloading() then
ShootTimer:Reset()
AI.Ctrl.AnalogAim = SceneMan:ShortestDistance(Owner.Pos, AI.Target.Pos, false).Normalized
if AI.lateralMoveState == Actor.LAT_STILL then
AI.proneState = AHuman.PRONE
--AI.Ctrl:SetState(Controller.BODY_CROUCH, true)
end
elseif Owner:EquipFirearm(true) then
local _ai, _ownr, _abrt = coroutine.yield() -- wait until next frame, just in case the magazine is replenished by another script
if _abrt then return true end
Expand Down Expand Up @@ -2828,7 +2840,7 @@ function HumanBehaviors.AttackTarget(AI, Owner, Abort)
local startPos = Vector(Owner.EyePos.X, Owner.EyePos.Y)

if Owner:EquipDeviceInGroup("Tools - Diggers", true) or Owner:EquipDeviceInGroup("Weapons - Melee", true) then
meleeDist = Owner.Radius + 25
meleeDist = Owner.IndividualRadius + 25
startPos = Vector(Owner.EquippedItem.Pos.X, Owner.EquippedItem.Pos.Y)
elseif Owner.armSway then
local arm = Owner.FGArm or Owner.BGArm
Expand Down
218 changes: 117 additions & 101 deletions Base.rte/AI/HumanFunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ HumanFunctions = {};
function HumanFunctions.DoAlternativeGib(actor)
--Detach limbs instead of regular gibbing
if actor.detachWoundLimit or actor.detachImpulseLimit then
if actor.detachWoundLimit and actor.WoundCount > actor.detachWoundLimit then
actor.detachWoundLimit = actor.WoundCount + 1;
local torsoWoundCount = actor:GetWoundCount(false, false, false);
if actor.detachWoundLimit and torsoWoundCount > actor.detachWoundLimit then
actor.detachWoundLimit = torsoWoundCount + 1;

local parts = {actor.BGArm, actor.BGLeg, actor.FGArm, actor.FGLeg, actor.Head}; --Priority order
local parts = {actor.BGArm, actor.BGLeg, actor.FGLeg, actor.Head}; --Priority order (Never detach FG Arm)
local mostWounds, detachLimb;
--Pick the limb with most wounds and detach it
for _, limb in pairs(parts) do
Expand All @@ -16,12 +17,12 @@ function HumanFunctions.DoAlternativeGib(actor)
end
end
if detachLimb then
detachLimb.JointStrength = -1;
actor:RemoveAttachable(detachLimb, true, true);
end
end
if actor.detachImpulseLimit and actor.TravelImpulse.Magnitude > actor.detachImpulseLimit then
local parts = {actor.BGLeg, actor.BGArm, actor.FGLeg, actor.FGArm, actor.Head}; --Priority order
local impulsePoint = actor.Pos - actor.TravelImpulse/(actor.Mass == 0 and 0.0001 or actor.Mass);
if actor.detachImpulseLimit and actor.TravelImpulse.Magnitude > actor.detachImpulseLimit and actor.Mass > 0 then
local parts = {actor.BGLeg, actor.BGArm, actor.FGLeg, actor.Head}; --Priority order (Never detach FG Arm)
local impulsePoint = actor.Pos - actor.TravelImpulse/actor.Mass;
local closestDist, detachLimb;
--Pick the limb closest to the direction of impulse
for _, limb in pairs(parts) do
Expand All @@ -34,10 +35,10 @@ function HumanFunctions.DoAlternativeGib(actor)
end
end
end
if detachLimb then
local limbImpulse = actor.TravelImpulse.Magnitude/(detachLimb.Mass == 0 and 0.0001 or detachLimb.Mass);
if detachLimb and detachLimb.Mass > 0 then
local limbImpulse = actor.TravelImpulse.Magnitude/detachLimb.Mass;
if limbImpulse > detachLimb.JointStrength then
detachLimb.JointStrength = -1;
actor:RemoveAttachable(detachLimb, true, true);
if math.random() * limbImpulse > detachLimb.GibImpulseLimit then
detachLimb:GibThis();
end
Expand All @@ -57,124 +58,139 @@ function HumanFunctions.DoAlternativeGib(actor)
end

function HumanFunctions.DoAutomaticEquip(actor)
--Equip a weapon automatically if the one held by a player is destroyed
if actor:IsPlayerControlled() and actor.EquippedItem == nil and actor.InventorySize > 0 and not actor.controller:IsState(Controller.WEAPON_FIRE) then
--Equip a weapon automatically if the one held by a player is destroyed (To-do: move this to cpp?)
if actor.EquippedItem == nil and not actor.controller:IsState(Controller.WEAPON_FIRE) and (actor:IsPlayerControlled() or actor:UnequipBGArm()) then
actor:EquipFirearm(true);
end
end

function HumanFunctions.DoArmSway(actor, pushStrength)
--Control arm movements
local aimAngle = actor:GetAimAngle(false);
if not actor.lastHandPos then --Initialize
actor.lastAngle = aimAngle;
actor.lastHandPos = {actor.Pos, actor.Pos};
if actor.weight then
actor:RemoveAttachable(actor.weight);
actor.weight = nil;
end
--Flail around if aiming around too fast
local angleMovement = actor.lastAngle - aimAngle;
actor.AngularVel = actor.AngularVel - (2 * angleMovement * actor.FlipFactor)/(math.abs(actor.AngularVel) * 0.1 + 1);
actor.lastAngle = aimAngle;
--Shove when unarmed
if actor:IsInventoryEmpty() and actor.controller:IsState(Controller.WEAPON_FIRE) and (actor.FGArm or actor.BGArm) and not (actor.EquippedItem or actor.EquippedBGItem) and actor.Status == Actor.STABLE then
actor.AngularVel = actor.AngularVel/(actor.shoved and 1.3 or 3) + (aimAngle - actor.RotAngle * actor.FlipFactor - 1.57) * (actor.shoved and 0.3 or 3) * actor.FlipFactor/(1 + math.abs(actor.RotAngle));
if not actor.shoved then
actor.Vel = actor.Vel + Vector(2/(1 + actor.Vel.Magnitude), 0):RadRotate(actor:GetAimAngle(true)) * math.abs(math.cos(actor:GetAimAngle(true)));
actor.shoved = true;
if actor.Status == Actor.STABLE and actor.lastHandPos then
--Unequip weapons by pressing both weapon switch keys at once
if actor.controller:IsState(Controller.WEAPON_CHANGE_NEXT) and actor.controller:IsState(Controller.WEAPON_CHANGE_PREV) then
local item = CreateHeldDevice("Null Item");
actor:AddInventoryItem(item);
actor:EquipNamedDevice("Null Item", true);
item.ToDelete = true;
end
else
actor.shoved = false;
end
local armPairs = {{actor.FGArm, actor.FGLeg, actor.BGLeg}, {actor.BGArm, actor.BGLeg, actor.FGLeg}};
for i = 1, #armPairs do
local arm = armPairs[i][1];
if arm then
arm = ToArm(arm);

local armLength = ToMOSprite(arm):GetSpriteWidth();
local rotAng = actor.RotAngle - (1.57 * actor.FlipFactor);
local legMain = armPairs[i][2];
local legAlt = armPairs[i][3];

if actor.controller:IsState(Controller.MOVE_LEFT) or actor.controller:IsState(Controller.MOVE_RIGHT) then
rotAng = (legAlt and legAlt.RotAngle) or (legMain and (-legMain.RotAngle + math.pi) or rotAng);
elseif legMain then
rotAng = legMain.RotAngle;
end
--Flail arms in tandem with leg movement or raise them them up for a push if aiming
if actor.controller:IsState(Controller.AIM_SHARP) then
arm.IdleOffset = Vector(0, 1):RadRotate(aimAngle);
else
arm.IdleOffset = Vector(0, (armLength + arm.SpriteOffset.X) * 1.1):RadRotate(rotAng * actor.FlipFactor + 1.5 + (i * 0.2));
--Control arm movements
--Flail around if aiming around too fast
local angleMovement = actor.lastAngle - aimAngle;
actor.AngularVel = actor.AngularVel - (2 * angleMovement * actor.FlipFactor)/(math.abs(actor.AngularVel) * 0.1 + 1);
--Shove when unarmed
if actor.controller:IsState(Controller.WEAPON_FIRE) and (actor.FGArm or actor.BGArm) and not (actor.EquippedItem or actor.EquippedBGItem) then
actor.AngularVel = actor.AngularVel/(actor.shoved and 1.3 or 3) + (aimAngle - actor.RotAngle * actor.FlipFactor - 1.57) * (actor.shoved and 0.3 or 3) * actor.FlipFactor/(1 + math.abs(actor.RotAngle));
if not actor.shoved then
actor.Vel = actor.Vel + Vector(2/(1 + actor.Vel.Magnitude), 0):RadRotate(actor:GetAimAngle(true)) * math.abs(math.cos(actor:GetAimAngle(true)));
actor.shoved = true;
end
if actor.shoved or (actor.EquippedItem and IsTDExplosive(actor.EquippedItem) and actor.controller:IsState(Controller.WEAPON_FIRE)) then
arm.IdleOffset = Vector(armLength + (pushStrength * armLength), 0):RadRotate(aimAngle);
local handVector = SceneMan:ShortestDistance(actor.lastHandPos[i], arm.HandPos, SceneMan.SceneWrapsX);
--Diminish hand relocation vector to potentially prevent post-superhuman pushing powers
handVector:SetMagnitude(handVector.Magnitude/(1 + handVector.Magnitude * 0.01));
--Emphasize the first frames that signify contracted arm = highest potential energy
local dots = math.sqrt(arm.Radius)/(1 + arm.Frame/arm.FrameCount);
local armStrength = (arm.Mass + arm.Material.StructuralIntegrity) * pushStrength;
for i = 1, dots do
local part = CreateMOPixel("Smack Particle Light");
part.Pos = arm.HandPos - Vector(handVector.X * 0.5, handVector.Y * 0.5);
part.Vel = Vector(handVector.X, handVector.Y):RadRotate(RangeRand(-0.1, 0.1)) + Vector(0, -0.5);
part.Mass = armStrength; part.Sharpness = math.random() * 0.1;
part.Team = actor.Team; part.IgnoresTeamHits = true;
MovableMan:AddParticle(part);
else
actor.shoved = false;
end
local shove = {};
local armPairs = {{actor.FGArm, actor.FGLeg, actor.BGLeg}, {actor.BGArm, actor.BGLeg, actor.FGLeg}};
for i = 1, #armPairs do
local arm = armPairs[i][1];
if arm then
arm = ToArm(arm);

local armLength = ToMOSprite(arm):GetSpriteWidth();
local rotAng = actor.RotAngle - (1.57 * actor.FlipFactor);
local legMain = armPairs[i][2];
local legAlt = armPairs[i][3];

if actor.controller:IsState(Controller.MOVE_LEFT) or actor.controller:IsState(Controller.MOVE_RIGHT) then
rotAng = (legAlt and legAlt.RotAngle) or (legMain and (-legMain.RotAngle + math.pi) or rotAng);
elseif legMain then
rotAng = legMain.RotAngle;
end
--Flail arms in tandem with leg movement or raise them them up for a push if aiming
if actor.controller:IsState(Controller.AIM_SHARP) then
arm.IdleOffset = Vector(0, 1):RadRotate(aimAngle);
else
arm.IdleOffset = Vector(0, (armLength + arm.SpriteOffset.X) * 1.1):RadRotate(rotAng * actor.FlipFactor + 1.5 + (i * 0.2));
end
--Apply some additional forces if the travel vector of the moving hand is half an arms length
if handVector.Magnitude > (armLength * 0.5) then
local moCheck = SceneMan:GetMOIDPixel(arm.HandPos.X, arm.HandPos.Y)
if moCheck ~= rte.NoMOID then
local mo = MovableMan:GetMOFromID(MovableMan:GetMOFromID(moCheck).RootID);
if mo and mo.Team ~= actor.Team and IsActor(mo) and actor.Mass > (mo.Mass * 0.5) then
mo:AddForce(handVector * (actor.Mass * 0.5), Vector());
ToActor(mo).Status = Actor.UNSTABLE;
if actor.shoved or (actor.EquippedItem and IsTDExplosive(actor.EquippedItem) and actor.controller:IsState(Controller.WEAPON_FIRE)) then
arm.IdleOffset = Vector(armLength + (pushStrength * armLength), 0):RadRotate(aimAngle);
local handVector = SceneMan:ShortestDistance(actor.lastHandPos[i], arm.HandPos, SceneMan.SceneWrapsX);
--Diminish hand relocation vector to prevent superhuman pushing powers
handVector:SetMagnitude(math.min(handVector.Magnitude, 1 + armLength * 0.1));
local armStrength = (arm.Mass + arm.Material.StructuralIntegrity * 0.5) * pushStrength;

shove.Pos = shove.Pos and shove.Pos + SceneMan:ShortestDistance(shove.Pos, arm.HandPos, SceneMan.SceneWrapsX) * 0.5 or arm.HandPos;
shove.Power = shove.Power and shove.Power + armStrength or armStrength;
shove.Vector = shove.Vector and shove.Vector + handVector * 0.5 or handVector * 0.5;
end
actor.lastHandPos[i] = arm.HandPos;
end
end
if shove.Pos then
--local moCheck = SceneMan:GetMOIDPixel(shove.Pos.X + actor.FlipFactor, shove.Pos.Y - 1);
local moCheck = SceneMan:CastMORay(shove.Pos, shove.Vector, actor.ID, actor.Team, rte.airID, false, shove.Vector.Magnitude - 1);
if moCheck ~= rte.NoMOID then
local mo = MovableMan:GetMOFromID(MovableMan:GetMOFromID(moCheck).RootID);
if mo and mo.Team ~= actor.Team and IsActor(mo) then
if actor.Mass > mo.Mass then
ToActor(mo).Status = Actor.UNSTABLE;
--Simulate target actor weight with an attachable
if not actor.weight then
actor.weight = CreateAttachable("Null Attachable");
actor.weight.Mass = mo.Mass;
actor:AddAttachable(actor.weight);
end
local shoveVel = shove.Vector/rte.PxTravelledPerFrame;
mo.Vel = mo.Vel * 0.5 + shoveVel:SetMagnitude(math.min(shoveVel.Magnitude, math.sqrt(actor.IndividualDiameter))) - SceneMan.GlobalAcc * GetMPP() * rte.PxTravelledPerFrame;
mo.AngularVel = (aimAngle - actor.lastAngle) * actor.FlipFactor * math.pi;
else
mo:AddForce(shove.Vector * (actor.Mass * 0.5) * shove.Power, Vector());
end
end
end
actor.lastHandPos[i] = arm.HandPos;
end
actor.lastAngle = aimAngle;
else
actor.lastAngle = aimAngle;
actor.lastHandPos = {actor.Pos, actor.Pos};
end
end

function HumanFunctions.DoVisibleInventory(actor, showAll)
--Visualize inventory with primitive bitmaps
if actor.Status < Actor.DYING and not actor:IsInventoryEmpty() then
if actor.Status < Actor.DYING then
local heldCount, thrownCount, largestItem = 0, 0, 0;
for i = 1, actor.InventorySize do
local item = actor:Inventory();
if item then
if item.ClassName == "TDExplosive" then
thrownCount = thrownCount + 1;
elseif item.ClassName == "HDFirearm" or item.ClassName == "HeldDevice" then
if showAll or item.Diameter + item.Mass > largestItem then
item = ToMOSprite(item);
largestItem = item.Diameter + item.Mass;
heldCount = heldCount + 1;
local itemCount = math.sqrt(heldCount);
for item in actor.Inventory do
if item.ClassName == "TDExplosive" then
thrownCount = thrownCount + 1;
elseif item.ClassName == "HDFirearm" or item.ClassName == "HeldDevice" then
if showAll or item.Diameter + item.Mass > largestItem then
item = ToMOSprite(item);
largestItem = item.Diameter + item.Mass;
heldCount = heldCount + 1;
local itemCount = math.sqrt(heldCount);

local actorBack = Vector(ToMOSprite(actor):GetSpriteWidth() + actor.SpriteOffset.X, ToMOSprite(actor):GetSpriteHeight() + actor.SpriteOffset.Y);
local stackX = item.Radius * 0.2 + itemCount;
--Bigger actors carry weapons higher up, smaller weapons are carried lower down
local drawPos = actor.Pos + Vector((-actorBack.X * 0.5 - stackX) * actor.FlipFactor, -actorBack.Y * 0.75):RadRotate(actor.RotAngle);
--Display tall objects upright
local widthToHeightRatio = item:GetSpriteWidth()/item:GetSpriteHeight();
local orientation = widthToHeightRatio > 1 and 1.57 * actor.FlipFactor or 0;
local actorBack = Vector(ToMOSprite(actor):GetSpriteWidth() + actor.SpriteOffset.X, ToMOSprite(actor):GetSpriteHeight() + actor.SpriteOffset.Y);
local stackX = item.Radius * 0.2 + itemCount;
--Bigger actors carry weapons higher up, smaller weapons are carried lower down
local drawPos = actor.Pos + Vector((-actorBack.X * 0.5 - stackX) * actor.FlipFactor, -actorBack.Y * 0.75):RadRotate(actor.RotAngle);
--Display tall objects upright
local widthToHeightRatio = item:GetSpriteWidth()/item:GetSpriteHeight();
local orientation = widthToHeightRatio > 1 and 1.57 * actor.FlipFactor or 0;

local tilt = (itemCount/item.Radius) * widthToHeightRatio * actor.FlipFactor;
local rotAng = actor.RotAngle + orientation + (tilt * 2) - tilt * (itemCount - 1);
local tilt = (itemCount/item.Radius) * widthToHeightRatio * actor.FlipFactor;
local rotAng = actor.RotAngle + orientation + (tilt * 2) - tilt * (itemCount - 1);

for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
local screen = ActivityMan:GetActivity():ScreenOfPlayer(player);
if screen ~= -1 and not SceneMan:IsUnseen(drawPos.X, drawPos.Y, ActivityMan:GetActivity():GetTeamOfPlayer(player)) then
PrimitiveMan:DrawBitmapPrimitive(screen, drawPos, item, rotAng, item.Frame, actor.HFlipped, true);
end
for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
local screen = ActivityMan:GetActivity():ScreenOfPlayer(player);
if screen ~= -1 and not SceneMan:IsUnseen(drawPos.X, drawPos.Y, ActivityMan:GetActivity():GetTeamOfPlayer(player)) then
PrimitiveMan:DrawBitmapPrimitive(screen, drawPos, item, rotAng, item.Frame, actor.HFlipped, true);
end
end
end
actor:SwapNextInventory(item, true);
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion Base.rte/AI/NativeDropShipAI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function NativeDropShipAI:Create(Owner)
elseif Members.AIMode == Actor.AIMODE_BOMB then
Members.hoverAlt = Owner.Radius * 6
else
Members.hoverAlt = Owner.Radius * 2
Members.hoverAlt = Owner.Radius * 2
end

-- The controllers
Expand Down
Loading