forked from Mirrors/openclonk
signpost and stone sign: clean up scripts and lessen code duplication
parent
03d0bb49dc
commit
478a4e7f85
|
@ -2,51 +2,32 @@
|
|||
Stone Sign
|
||||
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 IsInteractable() { return inscription != ""; }
|
||||
|
||||
// Adapt appearance in the interaction bar.
|
||||
public func GetInteractionMetaInfo(object clonk)
|
||||
public func Construction()
|
||||
{
|
||||
return { Description = "$MsgRead$", Selected = false };
|
||||
}
|
||||
|
||||
// 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;
|
||||
return;
|
||||
}
|
||||
|
||||
// Color for messages.
|
||||
public func GetColor() { return 0xffb0b0b0; }
|
||||
|
||||
public func Definition(def)
|
||||
public func Definition(proplist def)
|
||||
{
|
||||
// Inscription editor props.
|
||||
if (!def.EditorProps)
|
||||
def.EditorProps = {};
|
||||
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 --*/
|
||||
|
||||
local Name = "$Name$";
|
||||
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)
|
||||
local Description = "$Description$";
|
|
@ -1,5 +1,4 @@
|
|||
Name=Steintafel
|
||||
Description=Behält wichtige Informationen.
|
||||
MsgRead=Lesen
|
||||
Inscription=Beschriftung
|
||||
InscriptionHelp=Text der beim Lesen der Steintafel angezeigt wird.
|
|
@ -1,5 +1,4 @@
|
|||
Name=Stone Sign
|
||||
Description=Contains important information.
|
||||
MsgRead=Read
|
||||
Inscription=Inscription
|
||||
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
|
||||
*/
|
||||
|
||||
local Name="$Name$";
|
||||
local Description="$Description$";
|
||||
|
||||
local inscription = "";
|
||||
|
||||
|
||||
// Players can read the sign via the interaction bar.
|
||||
public func IsInteractable() { return inscription != ""; }
|
||||
|
||||
|
@ -33,20 +34,30 @@ public func SetInscription(to_text)
|
|||
// Color for messages
|
||||
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)
|
||||
var angle;
|
||||
if (!Random(2)) angle = -80 + Random(105); else angle = 90 + Random(110);
|
||||
this.MeshTransformation = Trans_Mul(Trans_Rotate(angle,0,10), GetID().MeshTransformation);
|
||||
if (!Random(2))
|
||||
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.PictureTransformation = Trans_Scale(900);
|
||||
// Inscription props
|
||||
if (!def.EditorProps) def.EditorProps = {};
|
||||
def.EditorProps.inscription = { Name="$Inscription$", Type="string", EditorHelp="$InscriptionHelp$", Set="SetInscription", Save="Inscription", Translatable=true };
|
||||
// Inscription props.
|
||||
if (!def.EditorProps)
|
||||
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
|
||||
|
||||
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)
|
||||
var angle;
|
||||
if (!Random(2)) angle = -60 + Random(90); else angle = 120 + Random(90);
|
||||
this.MeshTransformation = Trans_Mul(Trans_Rotate(angle,0,10), GetID().MeshTransformation);
|
||||
return _inherited(...);
|
||||
// Pick an angle range that looks good (some angles show it from the side or back, which looks weird).
|
||||
this.MeshTransformation = Trans_Mul(Trans_Rotate(-60 + Random(90), 0, 10), GetID().MeshTransformation);
|
||||
return;
|
||||
}
|
||||
|
||||
public func Definition(def)
|
||||
public func Definition(proplist def)
|
||||
{
|
||||
_inherited(def);
|
||||
// Model file is way too large
|
||||
// Model file is way too large.
|
||||
def.MeshTransformation = Trans_Scale(130);
|
||||
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