wiki.sine.space | sinespace

Difference between revisions of "Scripting/SSeat"

From wiki.sine.space
Jump to: navigation, search
(Replaced content with "This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sseat")
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
+
This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sseat
=Members=
+
 
+
{{ScriptFunction|void|SitPlayer|();|Make a player sit.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
function Seat()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;seat.SitPlayer()<br>
+
end
+
}}
+
 
+
{{ScriptFunction|void|UnseatPlayer|();|Make a player unseat.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
function UnSeat()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;seat.UnseatPlayer()<br>
+
end
+
}}
+
 
+
{{ScriptFunction|void|OnStandUp|(Closure e);|Binds a function to the Seat's On Stand Up event|5=<pre>
+
e = function()
+
Space.Log("On Stand Up event")
+
end
+
 
+
Space.Host.ExecutingObject.Seat.OnStandUp(e)
+
</pre>
+
}}
+
 
+
{{ScriptFunction|void|OnSit|(Closure e);|Binds a function to the Seat's On Sit event|5=<pre>
+
e = function()
+
Space.Log("On Sit event")
+
end
+
 
+
Space.Host.ExecutingObject.Seat.OnSit(e)
+
</pre>
+
}}
+
 
+
{{ScriptFunction|void|OnPlayerStandUp|(Closure e);|Binds a function to the Seat's On Player Stand Up event which is fired only on the Player's client|5=<pre>
+
e = function()
+
Space.Log("On Player Stand Up")
+
end
+
 
+
Space.Host.ExecutingObject.Seat.OnPlayerStandUp(e)
+
</pre>|6=
+
<pre>--the below script will teleport the player above the seat after standing up
+
--so that they do not go back to original position, but rather be standing next to the seat
+
--(Example: if the seat moves - such as in a vehicle- and we want to stand up next to it)
+
--[Requires Seat Component in the GameObject running this script]
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
 
+
OnPlayerStandUp = function()
+
seatPosition = thisGameObject.WorldPosition
+
teleportPosition = Vector.New(seatPosition.X, seatPosition.Y + 1, seatPosition.Z)
+
Space.Scene.PlayerAvatar.Teleport(seatPosition)
+
end
+
 
+
thisGameObject.Seat.OnPlayerStandUp(OnPlayerStandUp)</pre>
+
}}
+
 
+
{{ScriptFunction|void|OnPlayerSit|(Closure e);|Binds a function to the Seat's On Player Sit event which is fired only on the Player's client|5=<pre>
+
e = function()
+
Space.Log("On Player Sit event")
+
end
+
 
+
Space.Host.ExecutingObject.Seat.OnPlayerSit(e)
+
</pre>
+
}}
+
 
+
 
+
 
+
=Properties=
+
 
+
{{ScriptFunction|bool|Enabled|{get; set;}|Whether the seat component is enabled.|5=
+
local seat=thisObject.seat<br>
+
Space.Log(seat.Enabled)<br>
+
''--print true.''
+
}}
+
 
+
{{ScriptFunction|bool|InUse|(get;)|Return that whether the seat is in use.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
function InUse()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;local inUse=seat.InUse<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(inUse)<br>
+
end
+
}}
+
 
+
{{ScriptFunction|long|PlayerSeated|(get;);|Return the ID of the seating player.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
function PlaySeated ()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;local playSeated=seat.PlayerSeated<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(playSeated)<br>
+
end
+
}}
+
 
+
{{ScriptFunction|bool|UseSlotID|(get;set;);|Return true if uses SlotID|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
function UseSlotID ()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;local useSlotID=seat.UseSlotID<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(useSlotID)<br>
+
end
+
}}
+
 
+
{{ScriptFunction|string|SlotID|(get;set;);|Return the slot ID of the seat.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
function SlotID ()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;local slotID=seat.SlotID<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(slotID)<br>
+
end
+
}}
+
 
+
{{ScriptFunction|SCollider|ClickableCollider|(get;set;);|Return the clickable collider.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
function ClickableCollider()<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;local clickcoll=seat.ClickableCollider<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(clickcoll.Enabled)<br>
+
end
+
}}
+
 
+
{{ScriptFunction|SResource|Animation|(get;set;);|Return the animation clip.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
local animation=seat.Animation<br>
+
Space.Log(animation.Name)<br>
+
''--print the name of animation.''
+
}}
+
 
+
{{ScriptFunction|SResource|AnimationMale|(get;set;);|Return the animation clip.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
local animation=seat.AnimationMale<br>
+
Space.Log(animation.Name)<br>
+
''--print the name of animation.''
+
}}
+
 
+
{{ScriptFunction|SResource|AnimationFemale|(get;set;);|Return the animation clip.|5=
+
local thisObject=Space.Host.ExecutingObject<br>
+
local seat=thisObject.Children[0].Seat<br>
+
local animation=seat.AnimationFemale<br>
+
Space.Log(animation.Name)<br>
+
''--print the name of animation.''
+
}}
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 06:23, 19 September 2022

This page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/sseat