mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
105 lines
2.2 KiB
Plaintext
105 lines
2.2 KiB
Plaintext
include library.locations;
|
|
include library.regions;
|
|
include library.utils;
|
|
|
|
trigger OnAttach()
|
|
{
|
|
location here = getLocation (self);
|
|
string planet = here.area;
|
|
|
|
region rgnTest = getSmallestVisibleRegionAtPoint(here);
|
|
|
|
if (rgnTest == null)
|
|
{
|
|
debugServerConsoleMsg(self, "DAN FAILED");
|
|
debugServerConsoleMsg(self, "location is "+here);
|
|
region[] rgnFoos= getRegionsAtPoint(here);
|
|
if(rgnFoos==null || rgnFoos.length == 0)
|
|
{
|
|
debugServerConsoleMsg(self, "fucked");
|
|
}
|
|
for(int intI = 0; intI<rgnFoos.length; intI++)
|
|
{
|
|
debugServerConsoleMsg(self, "rgnFooes["+intI+"] is "+rgnFoos[intI].getName());
|
|
|
|
}
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
string strTest = rgnTest.getName();
|
|
|
|
string_id city = utils.unpackString(strTest);
|
|
|
|
if (city == null)
|
|
{
|
|
setObjVar (self, "city", "none");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//string_id cityName = new string_id ("tatooine_region_names", city);
|
|
|
|
utils.setScriptVar(self, "cityName", strTest);
|
|
messageTo(self, "setCityName", null, 5, false);
|
|
|
|
//setName (self, city);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnInitialize()
|
|
{
|
|
location here = getLocation (self);
|
|
string planet = here.area;
|
|
|
|
region rgnTest = getSmallestVisibleRegionAtPoint(here);
|
|
|
|
if (rgnTest == null)
|
|
{
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
string strTest = rgnTest.getName();
|
|
|
|
string_id city = utils.unpackString(strTest);
|
|
|
|
if (city == null)
|
|
{
|
|
setObjVar (self, "city", "none");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//string_id cityName = new string_id ("tatooine_region_names", city);
|
|
utils.setScriptVar(self, "cityName", strTest);
|
|
//LOG("jloy","OnInitialize");
|
|
messageTo(self, "setCityName", null, 5, false);
|
|
|
|
//setName (self, city);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler setCityName()
|
|
{
|
|
|
|
//LOG("jloy","madeit");
|
|
if(!utils.hasScriptVar(self, "cityName"))
|
|
{
|
|
//LOG("jloy","noscriptvar");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
string cityName = utils.getStringScriptVar(self, "cityName");
|
|
//LOG("jloy","cityName "+cityName);
|
|
string_id city = utils.unpackString(cityName);
|
|
//LOG("jloy","city "+city);
|
|
if (city == null)
|
|
{
|
|
//LOG("jloy","cityNull");
|
|
setObjVar (self, "city", "none");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
//LOG("jloy","settingName");
|
|
if(!setName (self, cityName))
|
|
{
|
|
//LOG("jloy","fail");
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
} |