forked from Mirrors/openclonk
signpost and stone sign: clean up scripts and lessen code duplication
parent
84063e1917
commit
0c0c5df94d
|
@ -2,51 +2,32 @@
|
||||||
Stone Sign
|
Stone Sign
|
||||||
Is attached to a wall and has an inscription.
|
Is attached to a wall and has an inscription.
|
||||||
|
|
||||||
@author Maikel
|
@author Maikel, Foaly (graphics)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include EnvPack_Guidepost
|
||||||
|
|
||||||
local inscription = "";
|
|
||||||
|
|
||||||
// Players can read the sign via the interaction bar.
|
public func Construction()
|
||||||
public func IsInteractable() { return inscription != ""; }
|
|
||||||
|
|
||||||
// Adapt appearance in the interaction bar.
|
|
||||||
public func GetInteractionMetaInfo(object clonk)
|
|
||||||
{
|
{
|
||||||
return { Description = "$MsgRead$", Selected = false };
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Called on player interaction.
|
|
||||||
public func Interact(object clonk)
|
|
||||||
{
|
|
||||||
if (!clonk)
|
|
||||||
return false;
|
|
||||||
Dialogue->MessageBox(GetTranslatedString(inscription), clonk, this, clonk->GetController(), true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public func SetInscription(to_text)
|
|
||||||
{
|
|
||||||
inscription = to_text ?? "";
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color for messages.
|
// Color for messages.
|
||||||
public func GetColor() { return 0xffb0b0b0; }
|
public func GetColor() { return 0xffb0b0b0; }
|
||||||
|
|
||||||
public func Definition(def)
|
public func Definition(proplist def)
|
||||||
{
|
{
|
||||||
// Inscription editor props.
|
// Inscription editor props.
|
||||||
if (!def.EditorProps)
|
if (!def.EditorProps)
|
||||||
def.EditorProps = {};
|
def.EditorProps = {};
|
||||||
def.EditorProps.inscription = { Name="$Inscription$", Type="string", EditorHelp="$InscriptionHelp$", Set="SetInscription", Save="Inscription", Translatable=true };
|
def.EditorProps.inscription = { Name="$Inscription$", Type="string", EditorHelp="$InscriptionHelp$", Set="SetInscription", Save="Inscription", Translatable=true };
|
||||||
|
def.MeshTransformation = Trans_Mul(Trans_Translate(-5600, -300), Trans_Rotate(90, 0, 1, 0));
|
||||||
|
def.PictureTransformation = Trans_Rotate(90, 0, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-- Properties --*/
|
/*-- Properties --*/
|
||||||
|
|
||||||
local Name = "$Name$";
|
local Name = "$Name$";
|
||||||
local Description = "$Description$";
|
local Description = "$Description$";
|
||||||
local MeshTransformation = [0, 0, 1000, -5600, 0, 1000, 0, -300, -1000, 0, 0, 0]; // Trans_Mul(Trans_Translate(-5600, -300), Trans_Rotate(90, 0, 1, 0))
|
|
||||||
local PictureTransformation = [0, 0, 1000, 0, 0, 1000, 0, 0, -1000, 0, 0, 0]; // Trans_Rotate(90, 0, 1, 0)
|
|
|
@ -1,5 +1,4 @@
|
||||||
Name=Steintafel
|
Name=Steintafel
|
||||||
Description=Behält wichtige Informationen.
|
Description=Behält wichtige Informationen.
|
||||||
MsgRead=Lesen
|
|
||||||
Inscription=Beschriftung
|
Inscription=Beschriftung
|
||||||
InscriptionHelp=Text der beim Lesen der Steintafel angezeigt wird.
|
InscriptionHelp=Text der beim Lesen der Steintafel angezeigt wird.
|
|
@ -1,5 +1,4 @@
|
||||||
Name=Stone Sign
|
Name=Stone Sign
|
||||||
Description=Contains important information.
|
Description=Contains important information.
|
||||||
MsgRead=Read
|
|
||||||
Inscription=Inscription
|
Inscription=Inscription
|
||||||
InscriptionHelp=Text that can be read by interacting with the stone sign.
|
InscriptionHelp=Text that can be read by interacting with the stone sign.
|
|
@ -1,12 +1,13 @@
|
||||||
/**
|
/**
|
||||||
|
Guidepost
|
||||||
|
|
||||||
@author Graphics Dustin Neß (dness.de), Script Sven2
|
@author Graphics Dustin Neß (dness.de), Script Sven2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
local Name="$Name$";
|
|
||||||
local Description="$Description$";
|
|
||||||
|
|
||||||
local inscription = "";
|
local inscription = "";
|
||||||
|
|
||||||
|
|
||||||
// Players can read the sign via the interaction bar.
|
// Players can read the sign via the interaction bar.
|
||||||
public func IsInteractable() { return inscription != ""; }
|
public func IsInteractable() { return inscription != ""; }
|
||||||
|
|
||||||
|
@ -33,20 +34,30 @@ public func SetInscription(to_text)
|
||||||
// Color for messages
|
// Color for messages
|
||||||
public func GetColor() { return 0xffcf9c1a; }
|
public func GetColor() { return 0xffcf9c1a; }
|
||||||
|
|
||||||
protected func Construction()
|
public func Construction()
|
||||||
{
|
{
|
||||||
// Pick an angle range that looks good (some angles show it from the side, which looks weird)
|
// Pick an angle range that looks good (some angles show it from the side, which looks weird)
|
||||||
var angle;
|
var angle;
|
||||||
if (!Random(2)) angle = -80 + Random(105); else angle = 90 + Random(110);
|
if (!Random(2))
|
||||||
this.MeshTransformation = Trans_Mul(Trans_Rotate(angle,0,10), GetID().MeshTransformation);
|
angle = -80 + Random(105);
|
||||||
|
else
|
||||||
|
angle = 90 + Random(110);
|
||||||
|
this.MeshTransformation = Trans_Mul(Trans_Rotate(angle, 0, 10), GetID().MeshTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public func Definition(def)
|
public func Definition(proplist def)
|
||||||
{
|
{
|
||||||
// Model file is way too large
|
// Model file is way too large.
|
||||||
def.MeshTransformation = Trans_Scale(360);
|
def.MeshTransformation = Trans_Scale(360);
|
||||||
def.PictureTransformation = Trans_Scale(900);
|
def.PictureTransformation = Trans_Scale(900);
|
||||||
// Inscription props
|
// Inscription props.
|
||||||
if (!def.EditorProps) def.EditorProps = {};
|
if (!def.EditorProps)
|
||||||
def.EditorProps.inscription = { Name="$Inscription$", Type="string", EditorHelp="$InscriptionHelp$", Set="SetInscription", Save="Inscription", Translatable=true };
|
def.EditorProps = {};
|
||||||
|
def.EditorProps.inscription = { Name = "$Inscription$", Type = "string", EditorHelp = "$InscriptionHelp$", Set = "SetInscription", Save = "Inscription", Translatable = true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-- Properties --*/
|
||||||
|
|
||||||
|
local Name = "$Name$";
|
||||||
|
local Description = "$Description$";
|
||||||
|
|
|
@ -1,25 +1,29 @@
|
||||||
/**
|
/**
|
||||||
@author Nachtfalter
|
Guidepost
|
||||||
|
|
||||||
|
@author Sven2, Nachtfalter (graphics)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include EnvPack_Guidepost
|
#include EnvPack_Guidepost
|
||||||
|
|
||||||
local Name="$Name$";
|
|
||||||
local Description="$Description$";
|
|
||||||
|
|
||||||
protected func Construction(...)
|
public func Construction(...)
|
||||||
{
|
{
|
||||||
// Pick an angle range that looks good (some angles show it from the side, which looks weird)
|
// Pick an angle range that looks good (some angles show it from the side or back, which looks weird).
|
||||||
var angle;
|
this.MeshTransformation = Trans_Mul(Trans_Rotate(-60 + Random(90), 0, 10), GetID().MeshTransformation);
|
||||||
if (!Random(2)) angle = -60 + Random(90); else angle = 120 + Random(90);
|
return;
|
||||||
this.MeshTransformation = Trans_Mul(Trans_Rotate(angle,0,10), GetID().MeshTransformation);
|
|
||||||
return _inherited(...);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func Definition(def)
|
public func Definition(proplist def)
|
||||||
{
|
{
|
||||||
_inherited(def);
|
_inherited(def);
|
||||||
// Model file is way too large
|
// Model file is way too large.
|
||||||
def.MeshTransformation = Trans_Scale(130);
|
def.MeshTransformation = Trans_Scale(130);
|
||||||
def.PictureTransformation = Trans_Mul(Trans_Translate(-5000, -60000, 150000), Trans_Rotate(-20, 0, 1), Trans_Scale(400));
|
def.PictureTransformation = Trans_Mul(Trans_Translate(-5000, -60000, 150000), Trans_Rotate(-20, 0, 1), Trans_Scale(400));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-- Properties --*/
|
||||||
|
|
||||||
|
local Name = "$Name$";
|
||||||
|
local Description = "$Description$";
|
Loading…
Reference in New Issue