diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-07-21 19:08:34 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-07-21 19:08:34 -0400 |
| commit | 81d3d4eb333e226432a591461b84ed12f5ac9a3f (patch) | |
| tree | d802983c3caf6683f1fd8eb881c7df65afa0d27b /gamemode/core/animation/sv_animate.lua | |
| parent | bfdf805676684a838dde5d4cdeb3d8c972d5003d (diff) | |
| download | artery-81d3d4eb333e226432a591461b84ed12f5ac9a3f.tar.gz artery-81d3d4eb333e226432a591461b84ed12f5ac9a3f.tar.bz2 artery-81d3d4eb333e226432a591461b84ed12f5ac9a3f.zip | |
Various updates
* Animation api now allows sequences to be played
* items now have a .inv attribute that is set when they are added
to shaped or equipment inventories
* Refactored the way skill inventory is structured
* Added some more methods to cl_common to move items around on a
player
* Minor update to nrequire to display purple message when asked
to include a file that dosn't exist.
Diffstat (limited to 'gamemode/core/animation/sv_animate.lua')
| -rw-r--r-- | gamemode/core/animation/sv_animate.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gamemode/core/animation/sv_animate.lua b/gamemode/core/animation/sv_animate.lua index 24d0ed0..b8cec56 100644 --- a/gamemode/core/animation/sv_animate.lua +++ b/gamemode/core/animation/sv_animate.lua @@ -5,6 +5,8 @@ local meta = FindMetaTable("Player") util.AddNetworkString("art_start_animation") util.AddNetworkString("art_stop_animation") +util.AddNetworkString("art_start_sequence") +util.AddNetworkString("art_end_sequence") function meta:StartAnimation(name) net.Start("art_start_animation") @@ -19,3 +21,34 @@ function meta:StopAnimation(name) net.WriteString(name) net.Broadcast() end + +local sequences = {} + +function meta:StartSequence(name,untilstoped,speed) + untilstoped = untilstoped or false + speed = speed or 1 + local seq, time = self:LookupSequence(name) + sequences[self] = sequences[self] or {} + if untilstoped then + sequences[self] = {CurTime() + 9999999, seq, speed} + else + sequences[self] = {CurTime() + time, seq, speed} + end + self:SetCycle(0) + net.Start("art_start_sequence") + net.WriteEntity(self) + net.WriteUInt(seq,31) + net.WriteFloat(time) + net.WriteBool(untilstoped) + net.WriteFloat(speed) + net.Broadcast() +end + +function meta:EndSequence(name) + sequences[self] = nil + net.Start("art_end_sequence") + net.WriteEntity(self) + net.Broadcast() +end + +return sequences |
