where is the why to the do helping of the what

Started by sibile, April 05, 2017, 03:48:45 AM

Previous topic - Next topic

sibile

[DebuggerHidden]
public override IEnumerable<Gizmo> GetGizmos()
{
Building_Door.<GetGizmos>c__Iterator13C <GetGizmos>c__Iterator13C = new Building_Door.<GetGizmos>c__Iterator13C();
<GetGizmos>c__Iterator13C.<>f__this = this;
Building_Door.<GetGizmos>c__Iterator13C expr_0E = <GetGizmos>c__Iterator13C;
expr_0E.$PC = -2;
return expr_0E;
}


what is it
what does it do
why does it break every compiler
how do i make it stop

skullywag

Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

RawCode

this is result of "yield return" syntax sugar compilation

sibile

now the old thing is gone but it has issues with the new one

[DebuggerHidden]
public override IEnumerable<Gizmo> GetGizmos()
{
foreach (Gizmo g in base.GetGizmos())
{
yield return g;
}
if (base.Faction == Faction.OfPlayer)
{
yield return new Command_Toggle
{
defaultLabel = "CommandToggleDoorHoldOpen".Translate(),
defaultDesc = "CommandToggleDoorHoldOpenDesc".Translate(),
hotKey = KeyBindingDefOf.Misc3,
icon = TexCommand.HoldOpen,
isActive = (() => this.<>f__this.holdOpenInt),
toggleAction = delegate
{
this.<>f__this.holdOpenInt = !this.<>f__this.holdOpenInt;
this.<>f__this.Map.reachability.ClearCache();
if (this.<>f__this.Open && this.<>f__this.holdOpenInt)
{
this.<>f__this.freePassageUntilClosed = true;
}
}
};
}
}

sibile

ok I actually figured it out by just going to the source code for the door and now my totally original door works but it has no animations and i totally dont know why

RawCode

you should try dnspy with compilergenerated code displayed, to make sure, that entire code is present and nothing is missed.

sibile

Kk ill try that after my comp is done getting deep fried by tropical storm thx guys

Im just trying to make an exact copy of the base door class with a different class name so that i can use the copied class for different doors that are affected by dooropenspeed differently since its hardcoded how much an autodoor is faster than a normal door

skullywag

Just so you know core has hard coded references to the core door class you will have to detour every pathfinding method etc that mentions the core one to also check for your one. This is why modders dont mod doors...
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?