Page MenuHomeCode

No OneTemporary

diff --git a/README b/README
index 4bb9b74..3d374cf 100644
--- a/README
+++ b/README
@@ -1,164 +1,164 @@
ZzzzzzZ zz
Z z z The spatial gallery / social network / lounge
z z (c) 2010, Dereckson, some rights reserved.
z zzzzz zzzzz
z z z z z 0.1 alpha technical preview
z zzzzzzz z z
z z z z Last update hypership time: 5.096
z Z z z z z
ZzzzzzZ zzzzz zzzzzz
=========
INSTALL
=========
* Zed is a PHP 5.3 application.
* You can import dev/schema-mysql.sql as original SQL schema
* The configuration file is includes/config.php
* Files are cached in 3 directories of the cache folder, sets appropriate
write permissions to:
compiled openid sessions
* Zed needs but doesn't include in its code the Janrain OpenID PHP libraries:
http://www.janrain.com/openid-enabled - http://github.com/openid/php-openid
Put the Auth folder somewhere in your include_dir path.
- bcmath and GDM php extensions are recommended (required?) for OpenID.
- Our dev environment outputs a white page without error if GDM isn't here.
+ bcmath and GMP php extensions are recommended (required?) for OpenID.
+ Our dev environment outputs a white page without error if GMP isn't here.
If you don't wish to enable OpenID, replace your includes/login.php by
- http://bitbucket.org/dereckson/zed/src/0ffd1b08f33c/includes/login.php
+ http://hg.dereckson.be/zed/src/0ffd1b08f33c/includes/login.php
* Another used PHP extension is the WDDX one, to store session information in
a human-readable format, easier to debug.
If you don't want that, comment the following line from includes/config.php:
ini_set('session.serialize_handler', 'wddx');
=========
UPGRADE
=========
* For our main prod install, we use a script exporting last repo revision with
hg archive and applying a patch to config.php.
===========
LOCATIONS
===========
* Global location is a 9 letters code
<B,S> <body or spaceship id> <place where you are in this body/spaceship>
zerofilled 5 digits zerofilled 3 digits
You can also find 6 digits expressions e.g. B00001 is the hypership
* Local location varies of the place.
- On hypership core (B00001002): Sector C<0-8> Level <z> Zone <x-y>
- 0 is the gravity center
- 1-8 the 8 cubes surrounding it: 1-4 below, 5-8 above
- On the ship tower (B00001001): Sector T<z> Couloir <1-6>
- z is the level
- couloir depends of your x, y position (polar coordinates could help)
=================
HYPERSHIP TIME?
=================
* The amount of days since hypership launch, July 3rd 2010 00:00 UTC
* So the decimal part is like internet time, but in GMT and not CET/CEST
===============
SIDE PROJECTS
===============
* A pazaak game, to have something to play
* Will be an Arzakon client
=================
I WANT TO HELP!
=================
* You can create new SmartLine commands
* You can translate it in a new language
Start point: http://zed.dereckson.be/lang/en/core.conf
* You can code a bit of adventure, places description, stuff to do
as long you don't transform it in ogame clone (we're building a community
who want or don't want to play, but not a mechanic game)
and as long no money is involved (if you ask why, read Iain M. Banks novels)
in the hypership (in far asteroids, orbitals, planets you do what you want)
============
KNOWN BUGS
============
* Javascript get_hypership_time will returns 5.94 instead 5.094
Some %03d to add in /js/misc.js
* The floater rendering adds a black line under Opera
dojox.layout.floatingPane bug, need to check with last dojo version
* API /location query will break indent on location->body->location
beautify XML code to improve
* do.php allows any local location move, discarding FrL status
* The upload artwork dojo form can't be closed under Opera
=======================
API - General methods
=======================
* /api.php/time
Returns hypership time
Public access
* /api.php/perso/<perso_id>
Returns perso object
Created only to test extensively recursivity of api xml output
It's disabled since 10.811 on zed.dereckson.be, if you need an alternative,
open a bug report with the fields you need. Ship API should be able to manage
inventory if user is on. Ship API must also be able to get/set custom flags.
Requires a key
* /api.php/location/<location code or name>
Returns location object
Tip: to get the full name, use string eg /api.php/location/Zeta?format=string
Requires a key
* GET/POST API parameters
- key
API key, ask it at zed at dereckson be, object [DEV] api key request
- format
- preview print_r representation, so you've an idea of the object
- json json_encode() output
- php serialize() output
- wddx WDDX were an early universal serialization attempt
- xml XML document
- string output "as is" (or if it's an object, calls __toString())
============
API - Ship
=============
* /api.php/ship/authenticate/<perso nickname>
=================
ACKNOWLEDGEMENT
=================
Elfix, to have let me figure a regexp correction, instead to throw away regexp
validation for places local location.
diff --git a/apps/hotglue/config.inc.php b/apps/hotglue/config.inc.php
index b1d5fcf..f257832 100644
--- a/apps/hotglue/config.inc.php
+++ b/apps/hotglue/config.inc.php
@@ -1,91 +1,111 @@
<?php
/**
* These are the default configuration settings of this hotglue
* installation. Do not edit this file directly but overwrite specific
* variables by setting them in the user-config.inc.php file, which
* will not be overwritten by future updates.
*/
error_reporting(E_ALL); // see php documentation
// try to include user configuration
@include('user-config.inc.php');
+/**
+ * Gets the server URL
+ * @todo find a way to detect https:// on non standard port
+ *
+ * @return string the server URL
+ */
+function get_server_url () {
+ switch ($port = $_SERVER['SERVER_PORT']) {
+ case '80':
+ return "http://$_SERVER[SERVER_NAME]";
+
+ case '443':
+ return "https://$_SERVER[SERVER_NAME]";
+
+ default:
+ return "http://$_SERVER[SERVER_NAME]:$_SERVER[SERVER_PORT]";
+ }
+}
+
+
// otherwise fall back to these defaults
@define('ALWAYS_PROMPT_CREATE_PAGE', false); // invoke the "create page" controller when trying to access a non-existing page even if the user is not logged in yet (otherwise they receive a 404)
@define('AUTH_METHOD', 'none'); // can be digest, basic or none
@define('AUTH_USER', 'admin');
@define('AUTH_PASSWORD', 'changeme');
-@define('BASE_URL', 'http://zed51.dereckson.be/apps/hotglue/');
+@define('BASE_URL', get_server_url() . '/apps/hotglue/');
@define('CACHE_TIME', 60*60); // cache time in seconds (zero to disable)
@define('CONTENT_DIR', 'content'); // content directory, must be writable
@define('DEFAULT_PAGE', 'start');
@define('FAVICON', 'img/favicon.ico'); // can be empty or an absolute url
@define('HOTGLUE_VERSION', '0.99.1'); // expected api.version.patchlevel
@define('IE8_COMPAT', true); // try to be compatible with internet explorer 8 in viewing mode
@define('JQUERY', 'js/jquery-1.4.4.min.js');// can be an absolute url
@define('LOCK_TIME', 5000); // maximum time in ms to wait for an object lock
@define('LOG_FILE', 'content/log.txt'); // log file, must be writable
@define('LOG_LEVEL', 'warn'); // minimum log level (can be error, warn, info, debug)
@define('SHORT_URLS', false); // use short urls
@define('SHOW_FRONTEND_ERRORS', true);
@define('SITE_NAME', 'hotglue 1.0');
@define('SNAPSHOT_MAX_AGE', 60*60*24*7); // auto- revisions are automatically deleted after n seconds (zero to disable)
@define('SNAPSHOT_MIN_AGE', 60*60); // auto- revisions are created every n seconds (zero to disable)
@define('USE_MIN_FILES', true); // use minified files if possible (see also JQUERY define)
// default modules
@define('IMAGE_JPEG_QUAL', 80); // quality for jpeg resizing (0 < 100)
@define('IMAGE_PNG_QUAL', 5); // quality for png resizing (9 < 0)
@define('IMAGE_RESIZING', true); // resize uploaded images on the server (needs gd installed)
@define('IMAGE_UPLOAD_RESIZE_LARGER', '120%'); // automatically resize uploaded image when larger than n% of window width or height (set to 0% to disable)
@define('IMAGE_UPLOAD_RESIZE_TO', '80%'); // target size in n% of window width or height
@define('OBJECT_DEFAULT_COLORS', '#61b9cf #ff00ff #ffff00'); // default colors for new objects (space-separated string)
@define('PAGE_DEFAULT_GRID_X', 50); // default grid x spacing in px
@define('PAGE_DEFAULT_GRID_Y', 50); // default grid y spacing in px
@define('PAGE_GUIDES_X', ''); // show a grid line after n horizontal px (space-separated string)
@define('PAGE_GUIDES_Y', ''); // show a grid line after n vertical px (space-separated string)
@define('PAGES_NEED_AUTH', true); // page browser needs authentication
@define('REVISIONS_NEED_AUTH', true); // revisions browser needs authentication
@define('TEXT_AUTO_BR', true); // automatically add <br> elements for newlines
@define('VIDEO_START_ON_CLICK', true); // start video on click when autoplay is off
/**
* use this function to get the site's base url
*
* @return string base url (not html-encoded)
*/
function base_url()
{
global $base_url_cached;
//dieprint_r("Hello, we're in base_url and the cached value is $base_url_cached");
$temp = BASE_URL;
if (!empty($temp)) {
return $temp;
} elseif (!isset($base_url_cached)) {
if (empty($_SERVER['HTTPS'])) {
$base_url_cached = 'http://'.$_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_PORT'] != '80') {
$base_url_cached .= $_SERVER['SERVER_PORT'];
}
} else {
$base_url_cached = 'https://'.$_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_PORT'] != '443') {
$base_url_cached .= $_SERVER['SERVER_PORT'];
}
}
$base_url_cached .= dirname($_SERVER['PHP_SELF']);
// make sure we have a trailing slash at the end
if (substr($base_url_cached, -1) != '/') {
$base_url_cached .= '/';
}
}
return $base_url_cached;
}
?>
diff --git a/content/scenes/B00001001.tpl b/content/scenes/B00001001.tpl
index 0ea5fb7..3adf6e8 100644
--- a/content/scenes/B00001001.tpl
+++ b/content/scenes/B00001001.tpl
@@ -1,177 +1,212 @@
<!--
Global location: B00001001
-->
<!-- Tower navigation and passage CSS -->
<style>
body {
overflow: hidden;
}
/* Tower map */
#tower {
background-image: url({$SCENE_URL}/{$CurrentPerso->location_global}/all.png);
background-position: left;
background-repeat: no-repeat;
height: 442px;
}
#tower_hl {
position: relative;
}
/* Passage */
#passage {
width: 960px;
height: 401px;
background-image: url({$SCENE_URL}/{$CurrentPerso->location_global}/couloir/bay/void.png);
background-position: top left;
background-repeat: no-repeat;
}
#passage_left {
position: relative;
background-image: url({$SCENE_URL}/{$CurrentPerso->location_global}/couloir/GoLeft.png);
width: 38px;
height: 38px;
}
#passage_right {
position: relative;
background-image: url({$SCENE_URL}/{$CurrentPerso->location_global}/couloir/GoRight.png);
width: 38px;
height: 38px;
}
#passage_gallery ul {
position: relative;
top: 145px;
left: 120px;
margin-top: inherit;
margin-bottom: inherit;
}
#passage_gallery li {
display: block;
float: left;
margin-right: 60px;
width: 170px;
height: 170px;
padding: 4px 4px;
background-image: url({$SCENE_URL}/{$CurrentPerso->location_global}/couloir/frame.png);
background-repeat: no-repeat;
background-position: top left;
}
#screen {
position: absolute;
left: 10%;
top: 10%;
width: 80%;
height: 80%;
}
#screen img {
position: absolute;
cursor: pointer;
visibility: hidden;
width: 0px;
height: 0px;
}
#screen .tvover {
border: solid #343434;
opacity: 1;
filter: alpha(opacity=100);
}
#screen .tvout {
border: solid #fff;
opacity: 0.7;
}
#bankImages {
display: none;
}
#uploadDialog label {
color: black;
}
+
+ /* Couloir info */
+ #couloir_info {
+ background-image: url({$SCENE_URL}/{$CurrentPerso->location_global}/couloir/info.png);
+ height: 42px;
+ padding-top: 20px;
+ color: black;
+ }
+
+ #couloir_info a {
+ color: white;
+ }
+
+ #couloir_info a:hover {
+ font-weight: 900;
+ }
+
+ #domain_name {
+ margin-left: 1em;
+ }
</style>
<!-- Javascript bits: dojo -->
<script>
dojo.require("dojo.parser");
dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");
</script>
<!-- Tower -->
<!--<div id="tower"></div>-->
<!-- Navigation -->
{$loc = explode('C', $CurrentPerso->location_local)}{$loc[0] = substr($loc[0], 1)}
<div class="grid_7 alpha">
{#Sector#} T<span id="TowerFloor">{$loc[0]}</span>
</div>
<div class="grid_2" style="text-align: center">
{#Couloir#} <span id="TowerCouloir">{$loc[1]}</span>
</div>
<div class="grid_7 omega" style="text-align: right">
<a href="{if $loc[0] == 1}#{else}/do.php/set_local_location/T{$loc[0] - 1}C{$loc[1]}?redirectTo={get_url()}{/if}" onClick="passage.goUp(); return false;">{#GoUp#}</a> | <a href="/do.php/set_local_location/T{$loc[0] + 1}C{$loc[1]}?redirectTo={get_url()}" onClick="passage.goDown(); return false;">{#GoDown#}</a>
</div>
<!-- Passage -->
<div class="grid_16 alpha omega">
<div id="passage">
<div id="passage_gallery"></div>
<!-- Navigation -->
</div>
</div>
+ <div class="clear"></div>
+
+
+ <!-- Info -->
+ <div id="couloir_info">
+ <div class="grid_6 prefix_2 alpha">
+ <span id="domain_name">{#FreeDomain#}</span>
+ </div>
+ <div class="grid_6 suffix_2 omega" style="text-align: right">
+ <span id="domain_owner">{sprintf(#ClaimDomain#, '#')}</span>
+ </div>
+ <div class="clear"></div>
+ </div>
+
+ <div class="clear"></div>
<!-- Upload dialog -->
<div dojoType="dijit.Dialog" id="uploadDialog" style="display: none;" title="{#UploadNewArtwork#}">
<p>{#UploadNewArtworkDescription#}</p>
<form method="post" id="test" action="{get_xhr_hashed_url('upload_content', {$CurrentPerso->location_global})}?redirectTo={get_url()}" enctype="multipart/form-data">
<input type="hidden" id="location_local" name="location_local" value='{$CurrentPerso->location_local}' />
<input type="hidden" id="i" name="location_k" value="-1">
<div class="row">
<label for="artwork" class="firstLabel">{#UploadNewArtworkPicture#} (max. {ini_get('upload_max_filesize')})</label>
<input type="file" name="artwork" id="artwork" class="long" />
</div>
<div class="row">
<label for="title" class="firstLabel">{#UploadNewArtworkTitle#}</label>
<input dojoType="dijit.form.TextBox" name="title" id="title" type="text" class="long" />
</div>
<div class="row center">
<button dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconSave" type="submit" value="Save" />OK</button>
</div>
</form>
</div>
<!-- Javascript bits: script.aculo.us -->
<script src="{#StaticContentURL#}/js/prototype.js"></script>
<script src="{#StaticContentURL#}/js/effects.js"></script>
<!-- Javascript bits: tower and couloir/passage/corridor/gallery/whatNameYouGiveToIt -->
<script src="{$SCENE_URL}/{$CurrentPerso->location_global}/tower.js"></script>
<script>
//Initializes tower map
//tower.hl = '{$SCENE_URL}/{$CurrentPerso->location_global}/hl.png';
//tower.highlight(1);
//Initializes passage view
passage.bayPath = '{$SCENE_URL}/{$CurrentPerso->location_global}/couloir/bay/';
passage.initialize('{$location->global}', '{$CurrentPerso->location_local}');
//Initializes gallery
gallery.initialize('{#StaticContentURL#}', '{get_xhr_hashed_url('get_content', {$CurrentPerso->location_global})}');
- </script>
\ No newline at end of file
+ </script>
diff --git a/content/scenes/B00001001/couloir/info.png b/content/scenes/B00001001/couloir/info.png
new file mode 100644
index 0000000..9bfa421
Binary files /dev/null and b/content/scenes/B00001001/couloir/info.png differ
diff --git a/content/scenes/B00001002.tpl b/content/scenes/B00001002.tpl
index 9330b7a..df56679 100644
--- a/content/scenes/B00001002.tpl
+++ b/content/scenes/B00001002.tpl
@@ -1,64 +1,56 @@
<!--
Global location: B00001002
-->
-
<div class="grid_7 alpha">
{$xyz = explode(',', substr($CurrentPerso->location_local, 1, -1))}
{$x = $xyz[0]}{$y = $xyz[1]}{$z = $xyz[2]}
- Sector C<span id="sector">{GeoOctocube::get_sector($x, $y, $z)}</span>
+ {#Sector#} C<span id="sector">{GeoOctocube::get_sector($x, $y, $z)}</span>
</div>
<div class="grid_2" style="text-align: center;">
- Zone <span id="area">{abs($x)}-{abs($y)}</span>
+ {#Zone#} <span id="area">{abs($x)}-{abs($y)}</span>
</div>
<div class="grid_7 omega" style="text-align: right; margin-bottom: 1em;">
- Niveau <span id="level">{abs($z)}</span>
+ {#Level#} <span id="level">{abs($z)}</span>
</div>
<div class="clear"></div>
{if $zone}
{if $zone->type == "hotglue"}
<!-- Content iframe -->
<script type="text/javascript">
function hijacklinks(iframe){
var as = iframe.contentDocument.getElementsByTagName('a');
for(i=0;i<as.length;i++){
as[i].setAttribute('target','_parent');
}
}
</script>
<iframe src="/apps/hotglue/?zone_{$zone->id}" width="960" height="600" id="content_iframe" frameborder="0" scrolling="no" style="margin-bottom: 1em" onload="hijacklinks(this)"></iframe>
{else}
-{print_r($zone)}
+<p>{#CantRender#}</p>
+{dprint_r($zone)}
{/if}
{else}
<div class="content_wrapper">
- <h1>HyperShip builder</h1>
+ <h1>{#Builder#}</h1>
<div class="grid_9 suffix_1 content alpha">
- <h2>This area is buildable.</h2>
- <p>You can take over this part of the ship, transform it and design it as you want.</p>
- <p>To start, you can:</p>
- <ul>
- <li>Create a 960px wide picture with your scene background.</li>
- <li>Define which parts of your picture are exits to another zone or level.</li>
- </ul>
- <p>If you want, you will also able to:</p>
- <ul>
- <li>Add descriptions to part of the area (like in the 90s adventure games)</li>
- <li>Create a textual scenario (like in 80s choose your own adventure books)</li>
- <li>Enhance the area with javascript or HTML5 (like in 2010)</li>
- </ul>
+ {#BuildInfo#}
</div>
<div class="grid_6 omega">
- <p><a href="{get_url('builder')}">Start to build</a></p>
+ <p><a href="{get_url('builder')}">{#StartBuild#}</a></p>
- <p><a href="{get_url('do.php')}/local_move/0,1,0?redirectTo=/">Go north</a><br />
- <a href="{get_url('do.php')}/local_move/1,0,0?redirectTo=/">Go east</a><br />
- <a href="{get_url('do.php')}/local_move/0,-1,0?redirectTo=/">Go south</a><br />
- <a href="{get_url('do.php')}/local_move/-1,0,0?redirectTo=/">Go west</a></p>
+ <p><a href="{get_url('do.php')}/local_move/0,1,0?redirectTo=/">{#GoNorth#}</a><br />
+ <a href="{get_url('do.php')}/local_move/1,0,0?redirectTo=/">{#GoEast#}</a><br />
+ <a href="{get_url('do.php')}/local_move/0,-1,0?redirectTo=/">{#GoSouth#}</a><br />
+ <a href="{get_url('do.php')}/local_move/-1,0,0?redirectTo=/">{#GoWest#}</a></p>
- <p><a href="{get_url('do.php')}/local_move/0,0,1?redirectTo=/">Climb up</a><br />
- <a href="{get_url('do.php')}/local_move/0,0,-1?redirectTo=/">Climb down</a></p>
+ <p><a href="{get_url('do.php')}/local_move/0,0,1?redirectTo=/">{#GoUp#}</a><br />
+ <a href="{get_url('do.php')}/local_move/0,0,-1?redirectTo=/">{#GoDown#}</a></p>
+
+ <p><a href="{get_url('builder', 'map')}">{#ViewMap#}</a></p>
+
+ <p><a href="{get_xhr_hashed_url('global_move', 'B00001001', 'T2C3')}?redirectTo={get_url()}">{#GoTower#}</a></p>
</div>
<div class="clear fixclear"></div>
</div>
-{/if}
\ No newline at end of file
+{/if}
diff --git a/content/scenes/B00001002_C0.tpl b/content/scenes/B00001002_C0.tpl
index 5cee0e3..8ba0e92 100644
--- a/content/scenes/B00001002_C0.tpl
+++ b/content/scenes/B00001002_C0.tpl
@@ -1,34 +1,34 @@
<!--
Global location: B00001002
Local location: (0, 0, 0)
-->
<div class="grid_7 alpha">
- Sector C<span id="sector">0</span>
+ {#Sector#} C<span id="sector">0</span>
</div>
<div class="grid_9 omega" style="text-align: right; margin-bottom: 1em;">
- HyperShip core
+ {#Core#}
</div>
<div class="clear"></div>
<div class="content_wrapper">
- <h1>HyperShip core</h1>
+ <h1>{#Core#}</h1>
<div class="grid_9 suffix_1 content alpha">
- <h2>You're in the HyperShip core.</h2>
- <p>This area is the real center of the HyperShip.</p>
- <h2>Ship navigation control</h2>
- <p><strong>Current location:</strong> {$location}</p>
+ <h2>{#YouAreInCore#}</h2>
+ {#CoreInfo#}
+ <h2>{#ShipNavigationControl#}</h2>
+ <p><strong>{#CurrentLocation#}{#_t#}</strong> {$location}</p>
</div>
<div class="grid_6 omega">
<p><a href="{get_url('do.php')}/local_move/-1,1,-1?redirectTo=/">C1</a><br>
<a href="{get_url('do.php')}/local_move/1,1,-1?redirectTo=/">C2</a><br>
<a href="{get_url('do.php')}/local_move/-1,-1,-1?redirectTo=/">C3</a><br>
<a href="{get_url('do.php')}/local_move/1,-1,-1?redirectTo=/">C4</a><br></p>
<p><a href="{get_url('do.php')}/local_move/-1,1,1?redirectTo=/">C5</a><br>
<a href="{get_url('do.php')}/local_move/1,1,1?redirectTo=/">C6</a><br>
<a href="{get_url('do.php')}/local_move/-1,-1,1?redirectTo=/">C7</a><br>
<a href="{get_url('do.php')}/local_move/1,-1,1?redirectTo=/">C8</a><br></p>
</div>
<div class="clear fixclear"></div>
-</div>
\ No newline at end of file
+</div>
diff --git a/controllers/builder.php b/controllers/builder.php
index 358aa98..dd43ff8 100644
--- a/controllers/builder.php
+++ b/controllers/builder.php
@@ -1,77 +1,137 @@
<?php
/**
* Builder
*
* Zed. The immensity of stars. The HyperShip. The people.
*
* (c) 2010, Dereckson, some rights reserved.
* Released under BSD license.
*
* @package Zed
* @subpackage Controllers
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @copyright 2010 Sébastien Santoro aka Dereckson
* @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
* @version 0.1
* @link http://scherzo.dereckson.be/doc/zed
* @link http://zed.dereckson.be/
* @filesource
- *
- * @todo create a build.xml document to set what's buildable, and by who
*/
+require_once('includes/content/zone.php');
+
//
-// Temporary initialization code, to allow some build during the Zed alphatest
+// Helper methods
//
-$build_location = $CurrentPerso->location;
-$build_mode = 'hotglue';
-if (!$build_location->body->hypership) {
- message_die("You can only invoke the HyperShip builder facilities inside the HyperShip.");
-}
+/**
+ * Determines if a specified location is buildable
+ *
+ * @param GeoLocation $location the location to check
+ * @param string if the location isn't buidable, a textual description of why.
+ * @return bool true if the location is buildable ; otherwise, false
+ *
+ * @todo create a build.xml document to set what's buildable, and by who
+ */
+function is_buildable ($location, &$error = '') {
+ //We currently allow build only in the hypership tower and core.
+ if (!$location->body->hypership) {
+ $error = "You can only invoke the HyperShip builder facilities inside the HyperShip.";
+ return false;
+ }
-if ($build_location->place->code == "003") {
- message_die("Bays aren't buildable.");
-}
+ //if ($build_location->place->code == "001") {
+ // //Don't allow custom builds in the corridor (T?C?)
+ //}
-//
-// Prepare zone
-//
+ if ($build_location->place->code == "003") {
+ message_die("Bays aren't buildable.");
+ return false;
+ }
-//TODO: get local zone
-include('includes/content/zone.php');
-if (true) {
- //Gets or creates a new zone at build location
- $zone = ContentZone::at($build_location->global, $build_location->local, true);
- $zone->title = "Sandbox hotglue zone for $build_location->global $build_location->local";
- $zone->type = 'hotglue';
- $zone->save_to_database();
+ return true;
}
//
-// HTML output
+// Determines mode and initializes resources
//
-//Serves header
-$smarty->assign('PAGE_TITLE', 'Builder');
-include('header.php');
+switch ($build_mode = $url[1]) {
+ case 'map':
+ require_once('includes/geo/octocube.php');
+
+ $build_mode = 'map';
+
+ //Get zones at this floor
+ if ($CurrentPerso->location->global == 'B00001002') {
+ $point = GeoPoint3D::fromString($CurrentPerso->location->local);
+ $sector = GeoOctocube::get_sector_from_point3D($point);
+ $pattern = GeoOctocube::get_rlike_pattern_from_sector($sector, $point->z);
+ $zones = ContentZone::search($CurrentPerso->location->global, $pattern, true);
+ } else {
+ message_die(GENERAL_ERROR, "Can't map this area.", "Builder :: Map");
+ }
-//Hotglue iframe
-$smarty->assign('location', $build_location);
-$smarty->assign('zone', $zone);
-switch ($build_mode) {
+ //Template
+ define('DOJO', true);
+ $smarty->assign('zones', $zones);
+ $template = "builder_map.tpl";
+
+ break;
+
+ case '':
case 'hotglue':
+ //Temporary initialization code, to allow some build during the Zed alphatest
+ $build_location = $CurrentPerso->location;
+ $build_mode = 'hotglue';
+
+ $error = '';
+ if (!is_buildable($build_location, $error)) {
+ message_die(GENERAL_ERROR, $error, "Can't build");
+ }
+
+ //Gets or creates a new zone at build location
+ $zone = ContentZone::at($build_location->global, $build_location->local, true);
+ switch ($zone->type) {
+ case 'hotglue':
+ //All rulez
+ break;
+
+ case '':
+ //New zone
+ $zone->title = "Sandbox hotglue zone for $build_location->global $build_location->local";
+ $zone->type = 'hotglue';
+ $zone->save_to_database();
+ break;
+
+ default:
+ message_die("This isn't a zone managed by hotglue.");
+ }
+ unset($error);
+
+ //Template
+ $smarty->assign('location', $build_location);
+ $smarty->assign('zone', $zone);
$smarty->assign('IFRAME_SRC', '/apps/hotglue/?zone_' . $zone->id . '/edit');
- $smarty->display('builder_hotglue.tpl');
+ $template = 'builder_hotglue.tpl';
break;
default:
message_die(GENERAL_ERROR, "Unknown build mode: $build_mode");
- break;
}
-//Servers footer
+//
+// HTML output
+//
+//Serves header
+$smarty->assign('PAGE_TITLE', 'Builder');
+include('header.php');
+
+//Serves content
+$smarty->display($template);
+
+//Serves footer
include('footer.php');
?>
diff --git a/img/map/map-kub-top-build.png b/img/map/map-kub-top-build.png
new file mode 100644
index 0000000..e41566a
Binary files /dev/null and b/img/map/map-kub-top-build.png differ
diff --git a/img/map/map-kub-top-mine.png b/img/map/map-kub-top-mine.png
new file mode 100644
index 0000000..9309294
Binary files /dev/null and b/img/map/map-kub-top-mine.png differ
diff --git a/img/map/map-kub-top.png b/img/map/map-kub-top.png
new file mode 100644
index 0000000..06bcba3
Binary files /dev/null and b/img/map/map-kub-top.png differ
diff --git a/img/map/zone-build.png b/img/map/zone-build.png
new file mode 100644
index 0000000..5efe9e0
Binary files /dev/null and b/img/map/zone-build.png differ
diff --git a/img/map/zone-edit.png b/img/map/zone-edit.png
new file mode 100644
index 0000000..2c729ba
Binary files /dev/null and b/img/map/zone-edit.png differ
diff --git a/img/map/zone-goto.png b/img/map/zone-goto.png
new file mode 100644
index 0000000..b533ec5
Binary files /dev/null and b/img/map/zone-goto.png differ
diff --git a/js/builder/map.js b/js/builder/map.js
new file mode 100644
index 0000000..c35a961
--- /dev/null
+++ b/js/builder/map.js
@@ -0,0 +1,103 @@
+/* -------------------------------------------------------------
+ Zed
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ Author: Dereckson
+ Tags: map
+ Filename: map.js
+ Version: 1.0
+ Created: 2010-12-23
+ Updated: 2010-12-23
+ Licence: Dual licensed: BSD and Creative Commons BY 3.0.
+ Dependencies: dojo
+ ------------------------------------------------------------- */
+/**
+ * Map
+ */
+var map = {
+ id: null,
+ zones: null,
+ bounds: null,
+
+ init: function (id, zones) {
+ map.id = id;
+ map.zones = zones;
+ map.render();
+ },
+
+ /**
+ * Get coordinates
+ *
+ * @returns An array [x, y, z]
+ */
+ get_coordinates: function (expr) {
+ var coordinates = expr.substring(1, expr.length - 1).split(', ');
+ return [parseInt(coordinates[0]), parseInt(coordinates[1]), parseInt(coordinates[2])];
+ },
+
+ /**
+ * Calculates the zones bounds and stores the result in bounds property
+ */
+ calculate_bounds: function () {
+ var start = map.get_coordinates(map.zones[0][0]);
+ map.bounds = [
+ [start[0], start[0]],
+ [start[1], start[1]],
+ [start[2], start[2]]
+ ];
+ for (i = 1 ; i < map.zones.length ; i++) {
+ point = map.get_coordinates(map.zones[i][0]);
+ if (point[0] < map.bounds[0][0]) map.bounds[0][0] = point[0];
+ if (point[1] < map.bounds[1][0]) map.bounds[1][0] = point[1];
+ if (point[2] < map.bounds[2][0]) map.bounds[2][0] = point[2];
+ if (point[0] > map.bounds[0][1]) map.bounds[0][1] = point[0];
+ if (point[1] > map.bounds[1][1]) map.bounds[1][1] = point[1];
+ if (point[2] > map.bounds[2][1]) map.bounds[2][1] = point[2];
+ }
+ },
+
+ render_zone: function (x, y, z) {
+ var location = "(" + x + ", " + y + ", " + z + ")";
+ for (i = 0 ; i < map.zones.length ; i++) {
+ if (location == map.zones[i][0]) {
+ return '<span class="zone zone-edit" id="zone-' + map.zones[i][1] + '" onMouseOut="map.reset_info()" onMouseOver="map.set_info(\'' + location + '\')" onClick="map.menu_edit(\'' + location + '\', ' + map.zones[i][1] + ');"><img src="/img/map/map-kub-top.png" alt="Built" /></span>';
+ }
+ }
+ return '<span class="zone zone-build" onMouseOut="map.reset_info()" onMouseOver="map.set_info(\'' + location + '\')" onClick="map.menu_build(\'' + location + '\');"><img src="/img/map/map-kub-top-build.png" alt="Build" /></span>';
+ },
+
+ render: function () {
+ map.calculate_bounds();
+ var html = "";
+ z = map.bounds[2][0];
+ for (y = map.bounds[1][1] ; y >= map.bounds[1][0] ; y--) {
+ for (x = map.bounds[0][0] ; x <= map.bounds[0][1] ; x++) {
+ html += '<div class="grid_1">' + map.render_zone(x, y, z) + "</div>";
+ }
+ html += '</div><div class="clear fixclear"></div>';
+ dojo.byId(map.id).innerHTML = html;
+ }
+ },
+
+ menu_edit: function (local_location, zone_id) {
+ //alert("Goto or edit #" + zone_id);
+ //map/zone-edit.png
+ //map/zone-goto.png
+ window.location = "/do.php/set_local_location/" + local_location + "?redirectTo=/";
+ },
+
+ menu_build: function (local_location) {
+ //alert("Build at " + local_location);
+ //map/zone-build.png
+ //window.location = "/do.php/set_local_location/" + escape(local_location) + "?redirectTo=/builder";
+ window.location = "/do.php/set_local_location/" + local_location + "?redirectTo=/";
+ },
+
+ set_info: function (local_location) {
+ coord = map.get_coordinates(local_location);
+ dojo.byId("info_area").innerHTML = 'Zone <span id="area">' + Math.abs(coord[0]) + '-' + Math.abs(coord[1]) + '</span>';
+ },
+
+ reset_info: function () {
+ dojo.byId("info_area").innerHTML = "&nbsp;";
+ }
+}
diff --git a/lang/en/scenes.conf b/lang/en/scenes.conf
index 0221a92..f6edb32 100644
--- a/lang/en/scenes.conf
+++ b/lang/en/scenes.conf
@@ -1,21 +1,51 @@
#Zed language config file - scenes
#Language: English
#Code: en
#Author: Dereckson
###
### Hypership tower
###
[B00001001]
Tower = Tour
Floor = Floor
Sector = Sector
Couloir = Couloir
GoUp = Climb up
GoDown = Climb down
UploadNewArtwork = "Upload new artwork"
UploadNewArtworkDescription = "This frame is free. You can display here your artwork or any other artwork you like."
UploadNewArtworkPicture = "Picture"
-UploadNewArtworkTitle = "Title"
\ No newline at end of file
+UploadNewArtworkTitle = "Title"
+
+FreeDomain = "These sleeping quarters are free."
+ClaimDomain = 'You can <a href="%s">claim</a> them.'
+
+[B00001002]
+Sector = Sector
+Zone = Zone
+Level = Niveau
+
+Builder = HyperShip builder
+BuildInfo = <h2>This area is buildable.</h2><p>You can take over this part of the ship, transform it and design it as you want.</p><p>To start, you can:</p><ul> <li>Create a 960px wide picture with your scene background.</li><li>Define which parts of your picture are exits to another zone or level.</li></ul><p>If you want, you will also able to:</p><ul><li>Add descriptions to part of the area (like in the 90s adventure games)</li><li>Create a textual scenario (like in 80s choose your own adventure books)</li><li>Enhance the area with javascript or HTML5 (like in 2010)</li></ul>
+
+StartBuild = Start to build
+GoNorth = Go north
+GoEast = Go east
+GoSouth = Go south
+GoWest = Go west
+GoUp = Climb up
+GoDown = Climb down
+ViewMap = Print the level map
+GoTower = Go to the tower
+
+CantRender = Unable to render this zone:
+
+Core = HyperShip core
+YouAreInCore = You're in the HyperShip core.
+CoreInfo = <p>This area is the real center of the HyperShip.</p>
+
+ShipNavigationControl = Ship navigation control
+CurrentLocation = Current location
diff --git a/skins/zed/builder_map.tpl b/skins/zed/builder_map.tpl
new file mode 100644
index 0000000..ab0c6ff
--- /dev/null
+++ b/skins/zed/builder_map.tpl
@@ -0,0 +1,49 @@
+ <div class="grid_7 alpha">
+{$xyz = explode(',', substr($CurrentPerso->location_local, 1, -1))}
+{$x = $xyz[0]}{$y = $xyz[1]}{$z = $xyz[2]}
+ Sector C<span id="sector">{GeoOctocube::get_sector($x, $y, $z)}</span>
+ </div>
+ <div class="grid_2" style="text-align: center;" id="info_area">
+ Zone <span id="area">{abs($x)}-{abs($y)}</span>
+ </div>
+ <div class="grid_7 omega" style="text-align: right; margin-bottom: 1em;">
+ Niveau <span id="level">{abs($z)}</span>
+ </div>
+
+ <div class="clear"></div>
+
+ <!-- Map -->
+{if $zones}
+ <div id="map"></div>
+ <style>
+ .zone-build img {
+ opacity: 0.10;
+ }
+ </style>
+ <script type="text/javascript" src="/js/builder/map.js"></script>
+ <script>
+ var zones = [
+{foreach from=$zones item=zone name=zones}
+ ['{$zone->location_local}', {$zone->id}, '{$zone->type}', '{$zone->params}']{if !$smarty.foreach.zones.last},{/if}
+
+{/foreach}
+ ];
+ dojo.ready(function() {
+ map.init('map', zones);
+ });
+ </script>
+ <noscript>
+ <p>You've zones at:</p>
+ <ul>
+{foreach from=$zones item=zone}
+ <li>{$zone->location_local}</li>
+{/foreach}
+ </ul>
+ <p>A patch for a pure HTML renderer to print a map without javascript is welcome.</p>
+ </noscript>
+{else}
+ <div class="grid_16 alpha omega">
+ <div class="notify">This area is empty.</div>
+ </div>
+ <div class="clear"></div>
+{/if}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Nov 3, 01:02 (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
20977
Default Alt Text
(37 KB)

Event Timeline