Docs: Difference between revisions
Appearance
Dat Hack3r (talk | contribs) m Added page to Documentation category. |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 3,332: | Line 3,332: | ||
return !world.no_copy; | return !world.no_copy; | ||
}, | }, | ||
</syntaxhighlight> | |||
|- | |||
|can_protect_tiles | |||
|Checks if user can protect tiles. | |||
|<syntaxhighlight lang="js" line="1" start="41"> | |||
can_protect_tiles: function(user, world) { | |||
if(user.is_owner) return true; | |||
return world.feature_membertiles_addremove && user.is_member; | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|can_erase | |||
|Checks if user can use the built-in eraser. | |||
|<syntaxhighlight lang="js" line="1" start="45"> | |||
can_erase: function(user, world) { | |||
if(user.is_owner) return true; | |||
return Permissions.user_matches_perm(user, world, world.quick_erase); | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|can_read | |||
|Checks if user can view the world. | |||
|<syntaxhighlight lang="js" line="1" start="49"> | |||
can_read: function(user, world) { | |||
return Permissions.user_matches_perm(user, world, world.readability); | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|can_urllink | |||
|Checks if user can create links leading to other URL's. | |||
|<syntaxhighlight lang="js" line="1" start="52"> | |||
can_urllink: function(user, world) { | |||
return Permissions.user_matches_perm(user, world, world.feature_url_link); | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|can_write | |||
|Checks if user can write on the world. | |||
|<syntaxhighlight lang="js" line="1" start="55"> | |||
can_write: function(user, world) { | |||
if(!Permissions.can_read(user, world)) { | |||
return false; | |||
} | |||
return Permissions.user_matches_perm(user, world, world.writability); | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|can_chat | |||
|Checks if user can chat. | |||
|<syntaxhighlight lang="js" line="1" start="61"> | |||
can_chat: function(user, world) { | |||
return Permissions.user_matches_perm(user, world, world.chat_permission); | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|can_show_cursor | |||
|Checks if showing cursors is enabled for a user. | |||
|<syntaxhighlight lang="js" line="1" start="64"> | |||
can_show_cursor: function(user, world) { | |||
return Permissions.user_matches_perm(user, world, world.show_cursor); | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|can_color_text | |||
|Checks if user can change their text colour. | |||
|<syntaxhighlight lang="js" line="1" start="67"> | |||
can_color_text: function(user, world) { | |||
return Permissions.user_matches_perm(user, world, world.color_text); | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|can_color_cell | |||
|Checks if user can change their cell colour. | |||
|<syntaxhighlight lang="js" line="1" start="70"> | |||
can_color_cell: function(user, world) { | |||
return Permissions.user_matches_perm(user, world, world.color_cell); | |||
}, | |||
</syntaxhighlight> | |||
|- | |||
|user_matches_perm | |||
|Gets users permissions. | |||
|<syntaxhighlight lang="js" line="1" start="73"> | |||
user_matches_perm: function(user, world, perm) { | |||
if(perm == -1) { // no one | |||
return false; | |||
} | |||
if(perm == PERM.PUBLIC) { // anyone | |||
return true; | |||
} | |||
if(user.is_owner) { | |||
return true; | |||
} | |||
if(perm == PERM.ADMIN) { | |||
return false; | |||
} | |||
if(perm == PERM.MEMBERS && user.is_member) { | |||
return true; | |||
} | |||
return false; | |||
} | |||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
[[Category:Articles nominated by Guest-1052]] | |||
[[Category:Documentation]] |