mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-19 23:11:03 +00:00
Allow changing string argument properties via Lua
This commit is contained in:
parent
76f6483829
commit
4aa373aba8
3 changed files with 47 additions and 4 deletions
|
@ -396,6 +396,22 @@ namespace CodeImp.DoomBuilder.Config
|
|||
|
||||
if(this.enumlist == null) this.enumlist = new EnumList();
|
||||
}
|
||||
internal ArgumentInfo(ActorStructure actor, int i, bool stringarg)
|
||||
{
|
||||
if (!actor.HasPropertyWithValue("$stringarg" + i))
|
||||
{
|
||||
used = false;
|
||||
return;
|
||||
}
|
||||
|
||||
string argtitle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$stringarg" + i));
|
||||
string tooltip = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$stringarg" + i + "tooltip").Replace("\\n", Environment.NewLine));
|
||||
|
||||
this.used = true;
|
||||
this.title = argtitle;
|
||||
this.tooltip = tooltip;
|
||||
|
||||
}
|
||||
|
||||
// Constructor for unknown argument info
|
||||
internal ArgumentInfo(int argindex, bool isstringarg)
|
||||
|
|
|
@ -582,6 +582,14 @@ namespace CodeImp.DoomBuilder.Config
|
|||
args[i] = arg;
|
||||
}
|
||||
|
||||
//sphere: Custom string argument titles?
|
||||
for (int i = 0; i < stringargs.Length; i++)
|
||||
{
|
||||
ArgumentInfo arg = actor.GetStringArgumentInfo(i);
|
||||
if (arg != null)
|
||||
stringargs[i] = arg;
|
||||
}
|
||||
|
||||
//mxd. Some SLADE compatibility
|
||||
if (actor.HasProperty("$angled"))
|
||||
{
|
||||
|
|
|
@ -62,9 +62,10 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
|
||||
// [ZZ] direct ArgumentInfos (from game configuration), or own ArgumentInfos (from props)
|
||||
internal ArgumentInfo[] args = new ArgumentInfo[Thing.NUM_ARGS];
|
||||
internal ArgumentInfo[] stringargs = new ArgumentInfo[Thing.NUM_STRING_ARGS];
|
||||
|
||||
// States
|
||||
internal Dictionary<string, StateStructure> states;
|
||||
// States
|
||||
internal Dictionary<string, StateStructure> states;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -411,6 +412,13 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
args[i] = new ArgumentInfo(this, i);
|
||||
else args[i] = null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Thing.NUM_STRING_ARGS; i++)
|
||||
{
|
||||
if (HasProperty("$stringarg" + i))
|
||||
stringargs[i] = new ArgumentInfo(this, i, true);
|
||||
else stringargs[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public ArgumentInfo GetArgumentInfo(int idx)
|
||||
|
@ -423,8 +431,19 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
if (baseclass != null)
|
||||
return baseclass.GetArgumentInfo(idx);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
public ArgumentInfo GetStringArgumentInfo(int idx)
|
||||
{
|
||||
if (stringargs[idx] != null)
|
||||
return stringargs[idx];
|
||||
// if we have $clearargs, don't inherit anything!
|
||||
if (props.ContainsKey("$clearargs"))
|
||||
return null;
|
||||
if (baseclass != null)
|
||||
return baseclass.GetStringArgumentInfo(idx);
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue