Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 10 11 12 13 14 … 18 Next »
Spawning from the shared area
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Spawning from the shared area
08-11-2015, 03:11 PM,
#1
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
Spawning from the shared area
I've added a new feature for Starfall which lets you spawn a chip using code directly from the shared area (i.e. no uploading involved). To load a shared file onto your tool, right click it and choose "Load to Tool":
   

Then, pressing use and primary fire will spawn a chip/screen/HUD/emitter using the selected file as its mainfile, and all included files directly from the shared area.

Alongside this, is a new shared area permission type, execute permissions. Anyone granted execute permissions to a file can spawn them from the shared area, but cannot read the source code. Granting these permissions works the same way as the existing read/write.
   
Note that you only need to grant execute permissions for the main file of your code. Includes will be loaded regardless of whether the player has access to them or not.

Strict mode
Note however, that because players are unable to view the source code, code run from the shared area in this way runs in a more secure mode. In this mode, certain actions (such as spawning/removing entities and changing the owner's position) are locked behind user-granted permission rights. Note that chips spawned from the source code do not run in this mode, only those run from the shared area directly that you are not the author of.

Permission control
To grant/revoke these rights, there's a new tab under the shield button at the top right of the editor window.
   

In this tab, a list of current players and entities are available.
   
You can see a list of possible rights that can be granted to the entity/player. For the moment, only server-side permissions exist. In the future there may be client-side permissions too.

Granting rights
Granting rights under your player entry grants them for every chip you spawn. Granting for a specific chip grants it only to that entity. Rights granted to your player are saved, while those granted to entities are only valid for the entity's life, and are not connected to the code on it.

Requesting rights
If you are making a chip, then in order to be granted rights to perform actions, you must first register which rights you need. This is accomplished using the "permissions" library.
-- Register the need for the SPAWN_ENTITY permission.
permissions.register( permissions.SPAWN_ENTITY )
If you do not register access, you cannot be granted it, and the button to grant in the permissions control tab will be disabled.

To check if you have been granted access, do the following:
if permissions.canPerformAction( permissions.SPAWN_ENTITY ) then
-- Spawn props
end
If you attempt to perform an action without permission, then generally the action will silently fail. For example, attempting to spawn a prop without permission will just return nil. You should always check for permission to avoid confusion.
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Spawning from the shared area - by Person8880 - 08-11-2015, 03:11 PM
RE: Spawning from the shared area - by TheOneAndOnlyTee - 08-11-2015, 03:32 PM
RE: Spawning from the shared area - by Person8880 - 08-11-2015, 03:43 PM
RE: Spawning from the shared area - by TheOneAndOnlyTee - 08-11-2015, 04:04 PM
RE: Spawning from the shared area - by Person8880 - 08-11-2015, 04:35 PM
RE: Spawning from the shared area - by SuperPlayer - 08-11-2015, 04:51 PM
RE: Spawning from the shared area - by Person8880 - 08-11-2015, 05:14 PM
RE: Spawning from the shared area - by TheOneAndOnlyTee - 08-11-2015, 05:14 PM
RE: Spawning from the shared area - by TheOneAndOnlyTee - 09-11-2015, 03:11 PM
RE: Spawning from the shared area - by Person8880 - 09-11-2015, 07:02 PM
RE: Spawning from the shared area - by TheOneAndOnlyTee - 11-11-2015, 07:01 AM
RE: Spawning from the shared area - by Person8880 - 11-11-2015, 06:26 PM
RE: Spawning from the shared area - by TheOneAndOnlyTee - 12-11-2015, 02:27 AM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.